diff options
author | Andrew Waterman <waterman@s144.Millennium.Berkeley.EDU> | 2011-11-11 03:40:24 -0800 |
---|---|---|
committer | Andrew Waterman <waterman@s144.Millennium.Berkeley.EDU> | 2011-11-11 03:40:24 -0800 |
commit | 8717517e048ff866167d6eee6c6d97225f0cd169 (patch) | |
tree | ab36a881f5f6700fb5d30e3abc5580be0c088002 /pk/pk.c | |
parent | 2f5776b244a4a2a8297fee9e0160c835430e1f06 (diff) | |
download | pk-8717517e048ff866167d6eee6c6d97225f0cd169.zip pk-8717517e048ff866167d6eee6c6d97225f0cd169.tar.gz pk-8717517e048ff866167d6eee6c6d97225f0cd169.tar.bz2 |
Synced up PK with supervisor changes/asm syntax
You must upgrade to the latest compiler and ISA
simulator to build and run this version of the PK.
Diffstat (limited to 'pk/pk.c')
-rw-r--r-- | pk/pk.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -164,14 +164,20 @@ static void jump_usrstart(const char* fn, long sp) pop_tf(&tf); } +uint32_t mem_mb; + void boot() { bss_init(); file_init(); - long stack_top = (mfpcr(PCR_MEMSIZE) << MEMSIZE_SHIFT); - if(stack_top >= 0x80000000) - stack_top = 0x80000000; + // word 0 of memory contains # of MB of memory + mem_mb = *(uint32_t*)0; + + unsigned long stack_top = 0x80000000; + if (mem_mb < stack_top / (1024 * 1024)) + stack_top = mem_mb * (1024 * 1024); + stack_top -= USER_MAINVARS_SIZE; struct args* args = mainvars_init(stack_top); |