qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 0/4] target-mips: add UHI semihosting support


From: Leon Alrae
Subject: [Qemu-devel] [PATCH 0/4] target-mips: add UHI semihosting support
Date: Fri, 27 Feb 2015 17:00:50 +0000

Hi,

This patch series introduces the Unified Hosting Interface [1] support to QEMU.
UHI is a common bare metal semi-hosting interface for the MIPS architecture
and in QEMU it comes down to reserving SDBBP 1 instruction which triggers
semi-hosting syscalls.

Since we are already in soft-freeze these patches are not intended for 2.3. I'm
submitting it now as I would like to get your feedback. I'm particularly
interested in your opinion about the new command line option for semihosting
input arguments.

When QEMU is executed with -semihosting option the SDBBP instruction with
code = 1 will not cause a debug exception, but instead it will call one of
the UHI operations which are handled in target-mips/mips-semi.c file. Input
arguments as well as return values are passed via GPRs as specified in the
manual.

UHI provides 3 operations allowing to construct argv and argc:
* Argc: returns number of arguments.
* Argnlen: returns the length of the n'th argument.
* Argn: copies the n'th argument to the provided buffer.
In order to keep it simple it would be ideal to be able to pass multiple input
arguments which can contain any character to the guest program without having
to care about separators and escape characters (they might be quite unintuitive
if we also consider Windows environment). Therefore rather than using existing
"-append" I would like to introduce "-semihosting-arg" option which can occur
multiple times in the command line.

For those who want to test the implementation -- here are the steps for
building simple hello world bare metal program and running it on Malta board.

Bare Metal Toolchain containing UHI support can be obtained from:
http://codescape-mips-sdk.imgtec.com/components/toolchain/2014.07-1/

* Source file:
  $ cat main.c
  #include <stdio.h>

  int main()
  {
      printf("Hello world!\n");
      return 0;
  }

* Build:
  $ mips-mti-elf-gcc -T mti32-uhi.ld -mips32r2 -EL main.c

* Run:
  $ qemu-system-mipsel -cpu 24Kf -M malta -semihosting -nographic -kernel a.out
  Hello world!

References:
[1] "MIPS Toolchain, MD01069 UHI Reference Manual", Version: 1.0.14

The manual is available here:
http://prplfoundation.org/wiki/MIPS_documentation

Regards,
Leon

Leon Alrae (2):
  target-mips: add Unified Hosting Interface (UHI) support
  target-mips: add "-semihosting-arg" option and implement UHI Arg* ops

Maciej W. Rozycki (1):
  include/softmmu-semi.h: Make semihosting support 64-bit clean

Matthew Fortune (1):
  hw/mips: Do not clear BEV for MIPS malta kernel load

 hw/mips/mips_malta.c        |  10 +-
 include/exec/softmmu-semi.h |  13 +-
 include/sysemu/sysemu.h     |   2 +
 qemu-options.hx             |  13 +-
 target-mips/Makefile.objs   |   2 +-
 target-mips/helper.h        |   2 +
 target-mips/mips-semi.c     | 340 ++++++++++++++++++++++++++++++++++++++++++++
 target-mips/translate.c     |  82 +++++++----
 vl.c                        |  28 ++++
 9 files changed, 456 insertions(+), 36 deletions(-)
 create mode 100644 target-mips/mips-semi.c

-- 
2.1.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]