I am making a OS for a PC/AT compatible machine with gcc on ubuntu.
The code , whose extension is .c , to task switch in the handler for PIT(timer) 
interrupt is...
int tr=(a selector(segment number));
farjmp(0,tr);

the function prototype is
farjmp(int eip,int cs);

farjmp() is defined in another source file whose extension is .S.
the definition is... ('_' means tab.)
farjmp:
_jmp far [esp+4]
_ret

The compile option for both is 'gcc -pipe -ffreestanding -fno-common 
-fno-builtin -fomit-frame-pointer -c -masm=intel'

But,That wouldn't work well.
I compared machine code of the result of above with that made by nasm.
the results are...
gcc said  FF A4 24 0A FF 00 00
nasm said FF 6C 24 04

The machine code made by nasm worked as I want.

Is that bug ,or my mistake?

Reply via email to