aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spike_main/spike.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/spike_main/spike.cc b/spike_main/spike.cc
index 933f626..20afac9 100644
--- a/spike_main/spike.cc
+++ b/spike_main/spike.cc
@@ -411,8 +411,11 @@ int main(int argc, char** argv)
});
parser.option(0, "blocksz", 1, [&](const char* s){
blocksz = strtoull(s, 0, 0);
- if (((blocksz & (blocksz - 1))) != 0) {
- fprintf(stderr, "--blocksz should be power of 2\n");
+ const unsigned min_blocksz = 16;
+ const unsigned max_blocksz = PGSIZE;
+ if (blocksz < min_blocksz || blocksz > max_blocksz || ((blocksz & (blocksz - 1))) != 0) {
+ fprintf(stderr, "--blocksz must be a power of 2 between %u and %u\n",
+ min_blocksz, max_blocksz);
exit(-1);
}
});