diff options
author | Andrew Waterman <andrew@sifive.com> | 2021-03-17 00:30:12 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2021-03-25 22:21:06 -0700 |
commit | b9eba474fb52dbf205c7b466af458397a7487216 (patch) | |
tree | e203753f33c579d163b9c94bffa1d50c92c21b65 /pk/console.c | |
parent | 0b5ef9cf755811e6a8a2901585f3ecb5604e55f1 (diff) | |
download | riscv-pk-b9eba474fb52dbf205c7b466af458397a7487216.zip riscv-pk-b9eba474fb52dbf205c7b466af458397a7487216.tar.gz riscv-pk-b9eba474fb52dbf205c7b466af458397a7487216.tar.bz2 |
pk: support >2 GiB of user memory for RV64
Previously, the pk would always run from virtual address MEM_START.
Instead, remap it into the negative virtual addresses, allowing user
processes to expand beyond MEM_START.
Diffstat (limited to 'pk/console.c')
-rw-r--r-- | pk/console.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/pk/console.c b/pk/console.c index ec84981..3d3edae 100644 --- a/pk/console.c +++ b/pk/console.c @@ -1,6 +1,7 @@ // See LICENSE for license details. #include "pk.h" +#include "mmap.h" #include "file.h" #include "frontend.h" #include <stdint.h> @@ -23,21 +24,27 @@ void printk(const char* s, ...) va_end(vl); } -void dump_tf(trapframe_t* tf) +static const char* get_regname(int r) { - static const char* regnames[] = { - "z ", "ra", "sp", "gp", "tp", "t0", "t1", "t2", - "s0", "s1", "a0", "a1", "a2", "a3", "a4", "a5", - "a6", "a7", "s2", "s3", "s4", "s5", "s6", "s7", - "s8", "s9", "sA", "sB", "t3", "t4", "t5", "t6" + static const char regnames[] = { + "z \0" "ra\0" "sp\0" "gp\0" "tp\0" "t0\0" "t1\0" "t2\0" + "s0\0" "s1\0" "a0\0" "a1\0" "a2\0" "a3\0" "a4\0" "a5\0" + "a6\0" "a7\0" "s2\0" "s3\0" "s4\0" "s5\0" "s6\0" "s7\0" + "s8\0" "s9\0" "sA\0" "sB\0" "t3\0" "t4\0" "t5\0" "t6" }; + return ®names[r * 3]; +} + +void dump_tf(trapframe_t* tf) +{ + tf->gpr[0] = 0; for(int i = 0; i < 32; i+=4) { for(int j = 0; j < 4; j++) - printk("%s %lx%c",regnames[i+j],tf->gpr[i+j],j < 3 ? ' ' : '\n'); + printk("%s %lx%c", get_regname(i+j), tf->gpr[i+j], j < 3 ? ' ' : '\n'); } printk("pc %lx va %lx insn %x sr %lx\n", tf->epc, tf->badvaddr, (uint32_t)tf->insn, tf->status); |