qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 0/2] ARM: fix commandline handling forsemihosted


From: riku voipio
Subject: Re: [Qemu-devel] [PATCH 0/2] ARM: fix commandline handling forsemihosted executables
Date: Fri, 07 Jan 2011 18:29:36 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6

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<stdio.h>

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




reply via email to

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