diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-13 18:53:01 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-13 18:53:01 +0100 |
commit | f17eedb8856ae568ebb9b45b367ef6edf1bb7318 (patch) | |
tree | e2303eaa45da6d87de6beadd23d606fad97893ff /qtmips_machine | |
parent | 93c5ade08250e419b7dbc3177db6fba93163fd34 (diff) | |
download | qtmips-f17eedb8856ae568ebb9b45b367ef6edf1bb7318.tar.gz qtmips-f17eedb8856ae568ebb9b45b367ef6edf1bb7318.tar.bz2 qtmips-f17eedb8856ae568ebb9b45b367ef6edf1bb7318.zip |
Initialize SP to safe RAM area.
Address under 0xc0000000 corresponds to typical Linux stack
on 32-bit systems. If SP is initialized to 0x00000000 then
it can overwrite programs tarting at RAM begin and overflow
to top of physical address-space which is reserved for uncached
peripherals.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_machine')
-rw-r--r-- | qtmips_machine/registers.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/qtmips_machine/registers.cpp b/qtmips_machine/registers.cpp index b51be85..fa9731a 100644 --- a/qtmips_machine/registers.cpp +++ b/qtmips_machine/registers.cpp @@ -42,6 +42,7 @@ using namespace machine; ////////////////////////////////////////////////////////////////////////////// /// Program counter initial value #define PC_INIT 0x80020000 +#define SP_INIT 0xbfffff00 ////////////////////////////////////////////////////////////////////////////// Registers::Registers() : QObject() { @@ -136,6 +137,7 @@ void Registers::reset() { pc_abs_jmp(PC_INIT); // Initialize to beginning program section for (int i = 1; i < 32; i++) write_gp(i, 0); + write_gp(29, SP_INIT); // initialize to safe RAM area - corresponds to Linux write_hi_lo(false, 0); write_hi_lo(true, 0); } |