From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MRu7a-0003t7-2n for qemu-devel@nongnu.org; Fri, 17 Jul 2009 16:33:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MRu7V-0003pX-54 for qemu-devel@nongnu.org; Fri, 17 Jul 2009 16:33:33 -0400 Received: from [199.232.76.173] (port=50410 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MRu7U-0003pB-U4 for qemu-devel@nongnu.org; Fri, 17 Jul 2009 16:33:28 -0400 Received: from mx20.gnu.org ([199.232.41.8]:30509) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MRu7U-0001sy-K2 for qemu-devel@nongnu.org; Fri, 17 Jul 2009 16:33:28 -0400 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MRu7Q-0006IG-Au for qemu-devel@nongnu.org; Fri, 17 Jul 2009 16:33:24 -0400 From: Nathan Froyd Date: Fri, 17 Jul 2009 13:33:16 -0700 Message-Id: <1247862802-13033-1-git-send-email-froydnj@codesourcery.com> Subject: [Qemu-devel] [PATCH 0/6] target-mips: add MDI semihosting List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This patch series adds semihosting for bare-metal 32-bit MIPS targets that follows the MDI semihosting model used in MIPS's development product. The semihosting protocol works as follows: - All semihosted calls go through _mdi_syscall, which in the absence of simulator support, returns ENOSYS; - The address of _mdi_syscall is stored in a special section, .sdeosabi; - When an MDI semihosting-aware simulator is used, a breakpoint is placed at _mdi_syscall; - When this breakpoint is hit, the simulator performs the requested action and returns control to the program. Discovering the address of _mdi_syscall is straightforward when the program is passed in via -kernel. We extended the ELF loader interface slightly so that the caller could inspect the sections of the binary and act on the contents of the sections if they so chose. Things are slightly trickier when using QEMU as a GDB remote target, as the program will not be provided via -kernel, but via `load' from within GDB. This second method requires that we implement qSymbol support in the GDB stub so we can directly ask GDB where _mdi_syscall is. The patches have been built for {mips,mips64}-softmmu targets and tested with the libstdc++ testsuite (which exercises things like read(), write(), and lseek()). -Nathan