aboutsummaryrefslogtreecommitdiff
path: root/hw/mips/mips_malta.c
diff options
context:
space:
mode:
authorStefan Markovic <smarkovic@wavecomp.com>2018-08-10 19:21:07 +0200
committerAleksandar Markovic <amarkovic@wavecomp.com>2018-08-24 17:51:59 +0200
commitbf4667d05a1386df2dffcbf1eb652f79d25b4cb2 (patch)
treef05bfdc9ccc2d1abdea4383a563a56fae54e6bad /hw/mips/mips_malta.c
parent28861af8e94ada07b073d8775e11cc44cae5f4e5 (diff)
downloadqemu-bf4667d05a1386df2dffcbf1eb652f79d25b4cb2.zip
qemu-bf4667d05a1386df2dffcbf1eb652f79d25b4cb2.tar.gz
qemu-bf4667d05a1386df2dffcbf1eb652f79d25b4cb2.tar.bz2
mips_malta: Fix semihosting argument passing for nanoMIPS bare metal
Fix passing argument for nanoMIPS bare metal related to the semihosting regime. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Yongbok Kim <yongbok.kim@mips.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
Diffstat (limited to 'hw/mips/mips_malta.c')
-rw-r--r--hw/mips/mips_malta.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index f261dd6..40041d5 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -630,8 +630,14 @@ static void write_bootloader_nanomips(uint8_t *base, int64_t run_addr,
/* nop */
/* to_here: */
- stw_p(p++, 0x0080); stw_p(p++, 0x0002);
+ if (semihosting_get_argc()) {
+ /* Preserve a0 content as arguments have been passed */
+ stw_p(p++, 0x8000); stw_p(p++, 0xc000);
+ /* nop */
+ } else {
+ stw_p(p++, 0x0080); stw_p(p++, 0x0002);
/* li a0,2 */
+ }
stw_p(p++, 0xe3a0 | NM_HI1(ENVP_ADDR - 64));