aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2016-02-09 13:02:08 -0800
committerAndrew Waterman <waterman@cs.berkeley.edu>2016-02-19 13:01:11 -0800
commite984b263e07d2a2085e1856921253bc04c09d12c (patch)
tree12c17057d47e8511b39b90d9d86b57bb99ad4c7f
parenta844b59be2524de7590d71869441f5c5cc4f8d49 (diff)
downloadpk-e984b263e07d2a2085e1856921253bc04c09d12c.zip
pk-e984b263e07d2a2085e1856921253bc04c09d12c.tar.gz
pk-e984b263e07d2a2085e1856921253bc04c09d12c.tar.bz2
Cap main memory size at 2 GiB for RV32
This works around HTIF limitations and can later be removed.
-rw-r--r--pk/minit.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pk/minit.c b/pk/minit.c
index 80380f8..fcb2ca9 100644
--- a/pk/minit.c
+++ b/pk/minit.c
@@ -47,6 +47,9 @@ static void memory_init()
if (mem_size == 0)
panic("could not determine memory capacity");
+ if ((intptr_t)mem_size < 0)
+ mem_size = INTPTR_MIN;
+
if (num_harts == 0)
panic("could not determine number of harts");
}