finish lab4
This commit is contained in:
parent
0512b0d497
commit
83e83abf39
@ -13,4 +13,4 @@ define add-symbol-file-auto
|
||||
end
|
||||
|
||||
add-symbol-file-auto ./build/kernel.img
|
||||
add-symbol-file-auto ./user/build/ramdisk/spawn_info.bin
|
||||
add-symbol-file-auto ./user/build/ramdisk/ipc_reg.bin
|
||||
|
@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.14)
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||
|
||||
set(CMAKE_BUILD_TYPE "Debug") # "Release" or "Debug"
|
||||
set(CMAKE_BUILD_TYPE "Release") # "Release" or "Debug"
|
||||
set(CHCORE_PLAT "raspi3")
|
||||
set(CHCORE_ARCH "aarch64")
|
||||
|
||||
|
@ -114,19 +114,19 @@ static u64 thread_migrate_to_server(struct ipc_connection *conn, u64 arg)
|
||||
* This command set the sp register, read the file to find which field
|
||||
* of the ipc_connection stores the stack of the server thread?
|
||||
* */
|
||||
arch_set_thread_stack(target, LAB4_IPC_BLANK);
|
||||
arch_set_thread_stack(target, conn->server_stack_top);
|
||||
/**
|
||||
* Lab4
|
||||
* This command set the ip register, read the file to find which field
|
||||
* of the ipc_connection stores the instruction to be called when switch
|
||||
* to the server?
|
||||
* */
|
||||
arch_set_thread_next_ip(target, LAB4_IPC_BLANK);
|
||||
arch_set_thread_next_ip(target, conn->target->server_ipc_config->callback);
|
||||
/**
|
||||
* Lab4
|
||||
* The argument set by sys_ipc_call;
|
||||
*/
|
||||
arch_set_thread_arg(target, LAB4_IPC_BLANK);
|
||||
arch_set_thread_arg(target, arg);
|
||||
|
||||
/**
|
||||
* Passing the scheduling context of the current thread to thread of
|
||||
@ -166,9 +166,10 @@ u64 sys_ipc_call(u32 conn_cap, ipc_msg_t * ipc_msg)
|
||||
|
||||
/**
|
||||
* Lab4
|
||||
* Here, you need to transfer all the capbiliies of client thread to
|
||||
* capbilities in server thread in the ipc_msg.
|
||||
* Here, you need to transfer all the capabilities of client thread to
|
||||
* capabilities in server thread in the ipc_msg.
|
||||
*/
|
||||
ipc_send_cap(conn, ipc_msg);
|
||||
|
||||
r = copy_to_user((char *)&ipc_msg->server_conn_cap,
|
||||
(char *)&conn->server_conn_cap, sizeof(u64));
|
||||
@ -180,7 +181,8 @@ u64 sys_ipc_call(u32 conn_cap, ipc_msg_t * ipc_msg)
|
||||
* The arg is actually the 64-bit arg for ipc_dispatcher
|
||||
* Then what value should the arg be?
|
||||
* */
|
||||
arg = LAB4_IPC_BLANK;
|
||||
arg = (u64) ipc_msg;
|
||||
arg = arg - conn->buf.client_user_addr + conn->buf.server_user_addr;
|
||||
thread_migrate_to_server(conn, arg);
|
||||
|
||||
BUG("This function should never\n");
|
||||
@ -196,5 +198,19 @@ u64 sys_ipc_call(u32 conn_cap, ipc_msg_t * ipc_msg)
|
||||
* */
|
||||
u64 sys_ipc_reg_call(u32 conn_cap, u64 arg0)
|
||||
{
|
||||
return -1;
|
||||
struct ipc_connection *conn = NULL;
|
||||
int r;
|
||||
|
||||
conn = obj_get(current_thread->process, conn_cap, TYPE_CONNECTION);
|
||||
if (!conn) {
|
||||
r = -ECAPBILITY;
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
thread_migrate_to_server(conn, arg0);
|
||||
|
||||
BUG("This function should never\n");
|
||||
|
||||
out_fail:
|
||||
return r;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ static int thread_migrate_to_client(struct ipc_connection *conn, u64 ret_value)
|
||||
* Lab4
|
||||
* The return value returned by server thread;
|
||||
*/
|
||||
arch_set_thread_return(source, LAB4_IPC_BLANK);
|
||||
arch_set_thread_return(source, ret_value);
|
||||
/**
|
||||
* Switch to the client
|
||||
*/
|
||||
|
@ -90,6 +90,8 @@ const void *syscall_table[NR_SYSCALL] = {
|
||||
[SYS_read_pmo] = sys_read_pmo,
|
||||
[SYS_transfer_caps] = sys_transfer_caps,
|
||||
|
||||
[SYS_ipc_reg_call] = sys_ipc_reg_call,
|
||||
|
||||
/* TMP FS */
|
||||
[SYS_fs_load_cpio] = sys_fs_load_cpio,
|
||||
|
||||
|
@ -399,10 +399,10 @@ int launch_process_with_pmos_caps(struct user_elf *user_elf,
|
||||
{
|
||||
/* Step C: Output the child process & thread capabilities */
|
||||
if (child_process_cap != NULL) {
|
||||
|
||||
*child_process_cap = new_process_cap;
|
||||
}
|
||||
if (child_main_thread_cap != NULL) {
|
||||
|
||||
*child_main_thread_cap = main_thread_cap;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user