I just recently incorporated TSS task-switching into my current OS, but I've got a rather annoying problem.
I can jump through tasks easily enough, and I can write an _intel_ syntax pre-emptive multitasker... but I'm having trouble with the GCC syntax...
asm("ljmp %0, $0"
:
: "r" (task->selector)
);
Yields the following error message:
Error: suffix or operands invalid for `ljmp'
And yet I can hard-code asm("ljmp $0x28, $0") and it'll work.
I also tried something like this:
asm("pushw %0\n"
"pushl $0\n"
"ljmp (%%esp)\n"
:
: "r" (task->selector)
);
But to no avail.
This seems like such a simple thing to get caught up on... maybe I should actually get some sleep
Anyway, I'm basically just looking for a jumpToTSS(long selectorNum) style function.
Cheers,
Jeff
inline asm far jmp with input
RE:inline asm far jmp with input
I'm not an expert on the AT&T syntax, but IIRC, '%' is only used to prefix registers.
RE:inline asm far jmp with input
Yeah, but the %0 is, technically, a register. Which, exact register, is up to GCC, but it will end up being a register. I checked the syntax, and it's all right.
Oh well, no problem anyway, I just wrote the thing in nasm
; void jumpToTSS(short sel);
jumpToTSS:
push ebp
mov ebp, esp
jmp far [ss:ebp+4]
pop ebp
ret
I'm really not one of those people that hates AT&T syntax... I used to use it all the time, but man... Nasm always seems to work the way you want it to, eh?
Jeff
Oh well, no problem anyway, I just wrote the thing in nasm
; void jumpToTSS(short sel);
jumpToTSS:
push ebp
mov ebp, esp
jmp far [ss:ebp+4]
pop ebp
ret
I'm really not one of those people that hates AT&T syntax... I used to use it all the time, but man... Nasm always seems to work the way you want it to, eh?
Jeff