diff --git a/kernel/ap.c b/kernel/ap.c index 72c4bcce..cf9dce13 100644 --- a/kernel/ap.c +++ b/kernel/ap.c @@ -3,6 +3,7 @@ #include #include #include +#include int num_processors = 1; static volatile int ap_stop = 1; @@ -20,8 +21,12 @@ static void ap_wait(void) barrier(); cpu_pause(); } + kprintf("ap started.\n"); + kmalloc_init(); + sched_init(); + init_host_syscall_channel(); - ap_idle(); + schedule(); } void ap_start(void) diff --git a/kernel/host.c b/kernel/host.c index f1a6d294..6d959e5e 100644 --- a/kernel/host.c +++ b/kernel/host.c @@ -142,7 +142,7 @@ static void process_msg_init_acked(unsigned long pphys) lparam->post_fin = 1; - kprintf("Syscall parameters:\n"); + kprintf("Syscall parameters: (%d)\n", aal_mc_get_processor_id()); kprintf(" Response: %lx, %p\n", lparam->response_pa, lparam->response_va); kprintf(" Request : %lx, %lx, %p\n", diff --git a/kernel/init.c b/kernel/init.c index 0dea6448..ec7a8f0d 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -114,7 +114,6 @@ static void rest_init(void) mc_ikc_init(); sched_init(); - ap_start(); } int host_ikc_inited = 0; @@ -129,6 +128,7 @@ static void post_init(void) } init_host_syscall_channel(); + ap_start(); } int main(void) diff --git a/kernel/process.c b/kernel/process.c index c49fe672..4694064c 100644 --- a/kernel/process.c +++ b/kernel/process.c @@ -221,7 +221,7 @@ void schedule(void) if (switch_ctx) { kprintf("schedule: %p (%p) => %p (%p) \n", prev, - prev->page_table, next, next->page_table); + prev ? prev->page_table : NULL, next, next->page_table); aal_mc_load_page_table(next->page_table); if (prev) { diff --git a/kernel/syscall.c b/kernel/syscall.c index c4ddcd71..15b96978 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -21,6 +21,10 @@ static void send_syscall(struct syscall_request *req) res->status = 0; + kprintf("CPU : %lx\n", aal_mc_get_processor_id()); + kprintf("Target is %lx\n", cpu_local_var(scp).request_pa); + kprintf("SC req: %ld %ld %ld\n", req->valid, req->number, req->args[0]); + memcpy_async(cpu_local_var(scp).request_pa, virt_to_phys(req), sizeof(*req), 0, &fin); @@ -249,7 +253,7 @@ long sys_uname(int n, aal_mc_user_context_t *ctx) request.number = n; request.args[0] = phys; - return do_syscall(&request); + return do_syscall(&request), stop(); } long sys_getxid(int n, aal_mc_user_context_t *ctx) @@ -311,6 +315,14 @@ long syscall(int num, aal_mc_user_context_t *ctx) cpu_enable_interrupt(); + kprintf("SC(%d)[%3d](%lx, %lx, %lx, %lx, %lx) @ %lx | %lx\n", + aal_mc_get_processor_id(), + num, + aal_mc_syscall_arg0(ctx), aal_mc_syscall_arg1(ctx), + aal_mc_syscall_arg2(ctx), aal_mc_syscall_arg3(ctx), + aal_mc_syscall_arg4(ctx), aal_mc_syscall_pc(ctx), + aal_mc_syscall_sp(ctx)); + if (syscall_table[num]) { l = syscall_table[num](num, ctx); return l; diff --git a/linux/mod_mcctrl/control.c b/linux/mod_mcctrl/control.c index 98c08e8e..63504f98 100644 --- a/linux/mod_mcctrl/control.c +++ b/linux/mod_mcctrl/control.c @@ -166,6 +166,11 @@ int mcexec_wait_syscall(aal_os_t os, struct syscall_wait_desc *__user req) } } *c->param.doorbell_va = 0; + printk("(%p) %ld SC %ld: %lx\n", + c->param.request_va, + c->param.request_va->valid, + c->param.request_va->number, + c->param.request_va->args[0]); if (__do_in_kernel_syscall(os, c, c->param.request_va)) { #endif if (copy_to_user(&req->sr, c->param.request_va,