diff options
author | Andrew Waterman <waterman@s144.Millennium.Berkeley.EDU> | 2011-04-15 15:52:00 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@s144.Millennium.Berkeley.EDU> | 2011-04-15 15:52:00 -0700 |
commit | 0d603acb91f455adb879ea45fdb84313067f4293 (patch) | |
tree | c74a7524a52e898237446e0c2da55ac9be06f51c /pk/pk.c | |
parent | ba0cf0546686acac7e891d9740009bcc4ada73ee (diff) | |
download | pk-0d603acb91f455adb879ea45fdb84313067f4293.zip pk-0d603acb91f455adb879ea45fdb84313067f4293.tar.gz pk-0d603acb91f455adb879ea45fdb84313067f4293.tar.bz2 |
[pk] load pk at addr 0; user stack top = MEMSIZE
Diffstat (limited to 'pk/pk.c')
-rw-r--r-- | pk/pk.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -147,23 +147,22 @@ struct args static struct args* mainvars_init() { - void* loc = (void*)USER_MEM_SIZE-USER_MAINVARS_SIZE; + long loc = (mfpcr(PCR_MEMSIZE) << MEMSIZE_SHIFT) - USER_MAINVARS_SIZE; - sysret_t r = frontend_syscall(SYS_getmainvars, - USER_MEM_SIZE-USER_MAINVARS_SIZE, USER_MAINVARS_SIZE, 0, 0); + sysret_t r = frontend_syscall(SYS_getmainvars, loc, USER_MAINVARS_SIZE, 0, 0); kassert(r.result == 0); return (struct args*)loc; } -static void jump_usrstart(const char* fn) +static void jump_usrstart(const char* fn, long sp) { trapframe_t tf; int user64; long start = load_elf(fn, &user64); asm volatile("cflush; fence"); - init_tf(&tf, start, USER_MEM_SIZE-USER_MAINVARS_SIZE, user64); + init_tf(&tf, start, sp, user64); pop_tf(&tf); } @@ -173,5 +172,5 @@ void boot() file_init(); struct args* args = mainvars_init(); - jump_usrstart((void*)(long)args->argv[0]); + jump_usrstart((char*)(long)args->argv[0], (long)args); } |