From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=60959 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PbFCB-0005Ix-PK for qemu-devel@nongnu.org; Fri, 07 Jan 2011 11:29:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PbFC8-0004hZ-67 for qemu-devel@nongnu.org; Fri, 07 Jan 2011 11:29:40 -0500 Received: from afflict.kos.to ([92.243.29.197]:52963) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PbFC7-0004hO-TZ for qemu-devel@nongnu.org; Fri, 07 Jan 2011 11:29:40 -0500 Message-ID: <4D273F70.6050606@iki.fi> Date: Fri, 07 Jan 2011 18:29:36 +0200 From: riku voipio MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 0/2] ARM: fix commandline handling forsemihosted executables References: <1291647966-29220-1-git-send-email-peter.maydell@linaro.org> <4D273274.40206@iki.fi> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: "Schildbach, Wolfgang" , qemu-devel@nongnu.org, Nathan Froyd On 01/07/2011 05:56 PM, Peter Maydell wrote: > Or you can just test "by hand": Got it. For anyone wondering into this thread, if you use ubuntu/linaro toolchains to compile the example below, you need a -marm flag for the compiler or you'll get a weird error on swi... Looks good, I'll add these the next batch of patches. > #include > > struct datablock { > char *string; > int buflen; > }; > > char buf[20]; > > int main(int argc, char **argv) { > int r, i; > struct datablock datablock; > printf("semihosting-cmd test: argc %d\n", argc); > for (i = 0; i< argc; i++) { > printf("argv[%d]: %s\n", i, argv[i]); > } > datablock.string = buf; > datablock.buflen = sizeof(buf); > { > register int r0 asm ("r0") = 0x15; > register void * r1 asm ("r1") =&datablock; > register int result asm ("r0"); > __asm__ __volatile__ ( > "svc 0x123456" > : "=r" (result) > : "r" (r0), "r" (r1) > : "cc", "memory"); > r = result; > } > printf("semihosting returned status %d\n", r); > if (r == 0) { > printf("and string '%s'\n", datablock.string); > } > return 0; > } > > -- PMM