[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 0/4] MIPS: MDI semihosting support
From: |
Maciej W. Rozycki |
Subject: |
[Qemu-devel] [PATCH 0/4] MIPS: MDI semihosting support |
Date: |
Thu, 11 Dec 2014 15:49:38 +0000 |
User-agent: |
Alpine 1.10 (DEB 962 2008-03-14) |
Hi,
This small patch series adds semihosting support for the MIPS target.
The API has been originally set with the SDE toolchain from Algorithmics,
and has been used with bare-metal software meant to be debugged with JTAG
hardware and simulators using the MDI API [1][2]. It also uses the name
of `_mdi_syscall' for its entry point. Therefore it has been commonly
referred to as "MDI semihosting".
Despite that the semihosting API has nothing specific to MDI in it and
can be implemented in any bare-metal debugging environment such as QEMU.
I decided to keep the name throughout this submission to preserve the
tradition and for people who know what this is all about to recognise it
immediately.
The MDI semihosting API has to the best of my knowledge never been
formally documented. Calls are requested by the program run on the target
by calling the magic `_mdi_syscall' entry point, as defined by the symbol
table and also stored in a magic `.sdeosabi' section. Reaching that point
is supposed to be intercepted with a breakpoint and processor registers
interpreted as follows:
- $v0 -- request number,
- $a0-$a2 -- arguments,
- $ra -- return address.
Upon completion results are set as follows:
- $v0 -- request result, negative if unsuccessful,
- $v1 -- error number,
- $pc -- set to input $ra,
except for the `exit' request that does not return and the `gettime'
request that uses $v0-$v1 to return a pair of results. Execution is then
resumed.
This code has been originally submitted, as recorded here:
http://lists.nongnu.org/archive/html/qemu-devel/2009-07/msg01487.html
by Nathan Froyd, who has since left the company. This version extends the
original implementation by adding 64-bit support.
It has been tested by running the GDB test suite against it, with QEMU in
the system emulation mode specified as the remote target to talk to for
individual test cases (`target remote | qemu-system ...'). The toolchain
has been configured for the mips-sde-elf target (bare metal, with newlib
as the C library and our CS3 low-level runtime) and the following
multilibs were tested:
-EB
-EB -mabi=64
to cover both 32-bit and 64-bit support. Results were as follows,
respectively:
Result Count
ERROR 15
FAIL 4
PASS 16646
XPASS 40
XFAIL 152
KFAIL 52
UNTESTED 79
UNRESOLVED 15
UNSUPPORTED 219
Total 17222
and:
Result Count
ERROR 28
FAIL 1
PASS 16469
XPASS 23
XFAIL 118
KFAIL 52
UNTESTED 78
UNRESOLVED 28
UNSUPPORTED 220
Total 17017
References:
[1] "The Meta Debug Interface (MDI)", Mentor Graphics Corporation,
Revision 1.2, Monday, December 20, 2010
[2] "Microprocessor Debug Interface (MDI) Specification", MIPS
Technologies, Inc., Document Number: MD00412, Revision 02.41,
September 22, 2009
Maciej
- [Qemu-devel] [PATCH 0/4] MIPS: MDI semihosting support,
Maciej W. Rozycki <=