the problem comes from "0" and "1". GCC expects you to provide arguments of an ASM command in the form "<hint>"(var), where <hint> tells it in what it should store the argument (like "a"(x) to force x to be stored in register eax, "m"(x) to force it to be a memory reference, "g"(x) to let the compiler decide).
So
asm("mov %0,%%edx"::"a"(x)) translates into "movl %eax,%edx" (and the compiler makes sure the value of X is in %eax before issuing this instruction),
asm("mov %0,%%edx"::"m"(x)) translates into "movl address_of_x,%edx" (note that i wrote "address_of_x", which is a memory reference, and not $address_of_x, which would be an immediate constant ;] )
asm("mov %0,%%edx"::"r"(x)) translates into "movl <register>,%edx" (and lets the compiler decide which register it will use)
asm("mov %0,%%edx"::"g"(x)) leaves the compiler completely free on what x will be, provided that it is moved into edx.
Note that as a general rule,
Code: Select all
asm("mov %0,%%edx; " OTHER_OPERATIONS:"g"(x));
can be rewritten as
Code: Select all
void kconsoleGoto(char _X, char _Y) {
asm("mov $0, %%bh \n\t
mov %0, %%dl \n\t
mov %1, %%dh \n\t int 0x10\n\t" : : "g" (_X), "g" (_Y));
}
should do the trick, but ask yourself this question:
Why do you want to issue a BIOS call -- which is for 16 bits realmode only -- in a 32 bits compiler ? Except if you programmed your compiler in a really really strange way, you should not do this at all and rather use direct port access.