From 5e3f9115d395e23764c449195fb7c8ba86cacad7 Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Fri, 25 Sep 2015 09:02:35 -0700 Subject: [PATCH] make sure HTIF mem_mb doesn't exceed MMIOBase --- csrc/htif_emulator.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/csrc/htif_emulator.h b/csrc/htif_emulator.h index 9cd216c7..de9b416f 100644 --- a/csrc/htif_emulator.h +++ b/csrc/htif_emulator.h @@ -25,7 +25,10 @@ class htif_emulator_t : public htif_pthread_t htif_pthread_t::start(); } - uint32_t mem_mb() { return _memsz_mb; } + uint32_t mem_mb() { + uint32_t scr_mb = htif_pthread_t::mem_mb(); + return (_memsz_mb < scr_mb) ? _memsz_mb : scr_mb; + } private: uint32_t _memsz_mb;