Port-xen archive

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

help with x86 assembly



Hi,
I need some help with x86 inline assembly (it's been a while since I wrote
some assembly code, and I've never written any inline assembly, nor
x86 assembly ...)

In xen/stand/xen12load/xenload.c we have:
static int
HYPERVISOR_console_write_pic(const char *str, int count) {
        int ret;

        __asm__ __volatile__ (
                "       movl    %2,%%ebx        ;"
                TRAP_INSTR
                : "=a" (ret) : "0" (__HYPERVISOR_console_write),
                "r" (str), "c" (count)
                : "ebx");

        return ret;
}

TRAP_INSTR is:
#define TRAP_INSTR      int $0x82

In xen2, this has been changed to a __HYPERVISOR_console_io hypercall, which
takes an extra arguent: we now have
HYPERVISOR_console_io(int cmd, int count, char *str)

I tried to remplace the above function with one from include/hypervisor.h:
static int
HYPERVISOR_console_write_pic(int cmd, int count, char *str)
{
        int ret;
        unsigned long ign1, ign2, ign3;
        __asm__ __volatile__ (
            TRAP_INSTR
            : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
            : "0" (__HYPERVISOR_console_io), "1" (cmd), "2" (count), "3" (str)
            : "memory" );

        return ret;
}

but at compile time I get:
xenload.c: In function `HYPERVISOR_console_write_pic':
xenload.c:86: error: can't find a register in class `BREG' while reloading `asm'

I don't know how to fix this. Could someone please help ?
I also looked at the linux sources, but this part of code is identical.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--



Home | Main Index | Thread Index | Old Index