finish exec4.14-15
This commit is contained in:
parent
7660d524f4
commit
0512b0d497
@ -13,4 +13,4 @@ define add-symbol-file-auto
|
||||
end
|
||||
|
||||
add-symbol-file-auto ./build/kernel.img
|
||||
add-symbol-file-auto ./user/build/ramdisk/yield_multi_aff.bin
|
||||
add-symbol-file-auto ./user/build/ramdisk/spawn_info.bin
|
||||
|
@ -144,8 +144,8 @@ struct thread *rr_sched_choose_thread(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
kdebug("[RR] Cpu #%d Select thread %lx, sp = %lx\n",
|
||||
smp_get_cpu_id(), result->thread_ctx, result->thread_ctx->ec.reg[SP_EL0]);
|
||||
// kdebug("[RR] Cpu #%d Select thread %lx, sp = %lx\n",
|
||||
// smp_get_cpu_id(), result->thread_ctx, result->thread_ctx->ec.reg[SP_EL0]);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ int rr_sched(void)
|
||||
// 若非空闲线程,放入队列
|
||||
if (current_thread->thread_ctx->type != TYPE_IDLE) {
|
||||
rr_sched_enqueue(current_thread);
|
||||
kdebug("[RR] Cpu #%d yield thread %lx to queue\n", smp_get_cpu_id(), current_thread->thread_ctx);
|
||||
// kdebug("[RR] Cpu #%d yield thread %lx to queue\n", smp_get_cpu_id(), current_thread->thread_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,8 +259,8 @@ int launch_process_with_pmos_caps(struct user_elf *user_elf,
|
||||
* process.
|
||||
* You do not need to modify code in this scope
|
||||
*/
|
||||
pmo_requests[0].size = LAB4_SPAWN_BLANK;
|
||||
pmo_requests[0].type = LAB4_SPAWN_BLANK;
|
||||
pmo_requests[0].size = MAIN_THREAD_STACK_SIZE;
|
||||
pmo_requests[0].type = PMO_DATA;
|
||||
|
||||
ret = usys_create_pmos((void *)pmo_requests, 1);
|
||||
if (ret != 0) {
|
||||
@ -284,7 +284,7 @@ int launch_process_with_pmos_caps(struct user_elf *user_elf,
|
||||
* Transfer the capbilities (nr_caps) of current process to the
|
||||
* capbilities of child process
|
||||
*/
|
||||
|
||||
// 将需要转移的 Caps 进行转移
|
||||
if (nr_caps > 0) {
|
||||
/* usys_transfer_caps is used during process creation */
|
||||
ret = usys_transfer_caps(new_process_cap, caps, nr_caps,
|
||||
@ -302,7 +302,8 @@ int launch_process_with_pmos_caps(struct user_elf *user_elf,
|
||||
* Use the given pmo_mao_reqs to map the vmspace in the child
|
||||
* process
|
||||
*/
|
||||
if (nr_pmo_map_reqs) {
|
||||
// 将参数中需要映射子进程的 PMOs 进行映射,即可实现共享内存
|
||||
if (nr_pmo_map_reqs > 0) {
|
||||
ret =
|
||||
usys_map_pmos(new_process_cap, (void *)pmo_map_reqs,
|
||||
nr_pmo_map_reqs);
|
||||
@ -329,13 +330,13 @@ int launch_process_with_pmos_caps(struct user_elf *user_elf,
|
||||
* thread's stack?
|
||||
*
|
||||
* For stack_offset, when the main thread gets
|
||||
* to execute the first time, what's the virtual adress the sp
|
||||
* to execute the first time, what's the virtual address the sp
|
||||
* register points to?
|
||||
* stack_offset is the offset from main thread's stack base to
|
||||
* that address.
|
||||
*/
|
||||
stack_top = LAB4_SPAWN_BLANK;
|
||||
stack_offset = LAB4_SPAWN_BLANK;
|
||||
stack_top = MAIN_THREAD_STACK_BASE + MAIN_THREAD_STACK_SIZE;
|
||||
stack_offset = MAIN_THREAD_STACK_SIZE - PAGE_SIZE;
|
||||
|
||||
/* Construct the parameters on the top page of the stack */
|
||||
construct_init_env(init_env, stack_top, &user_elf->elf_meta,
|
||||
@ -364,9 +365,9 @@ int launch_process_with_pmos_caps(struct user_elf *user_elf,
|
||||
* map the the main thread stack's pmo in the new process.
|
||||
* Both VM_READ and VM_WRITE permission should be set.
|
||||
*/
|
||||
pmo_map_requests[0].pmo_cap = LAB4_SPAWN_BLANK;
|
||||
pmo_map_requests[0].addr = LAB4_SPAWN_BLANK;
|
||||
pmo_map_requests[0].perm = LAB4_SPAWN_BLANK;
|
||||
pmo_map_requests[0].pmo_cap = main_stack_cap;
|
||||
pmo_map_requests[0].addr = MAIN_THREAD_STACK_BASE;
|
||||
pmo_map_requests[0].perm = VM_READ | VM_WRITE;
|
||||
|
||||
ret =
|
||||
usys_map_pmos(new_process_cap, (void *)pmo_map_requests, 1);
|
||||
@ -384,7 +385,7 @@ int launch_process_with_pmos_caps(struct user_elf *user_elf,
|
||||
* create main thread in the new process.
|
||||
* Please fill the stack_va!
|
||||
*/
|
||||
stack_va = LAB4_SPAWN_BLANK;
|
||||
stack_va = MAIN_THREAD_STACK_BASE + stack_offset;
|
||||
main_thread_cap =
|
||||
usys_create_thread(new_process_cap, stack_va, pc,
|
||||
(u64) NULL, MAIN_THREAD_PRIO, aff);
|
||||
@ -397,6 +398,12 @@ int launch_process_with_pmos_caps(struct user_elf *user_elf,
|
||||
|
||||
{
|
||||
/* Step C: Output the child process & thread capabilities */
|
||||
if (child_process_cap != NULL) {
|
||||
|
||||
}
|
||||
if (child_main_thread_cap != NULL) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user