This is the mail archive of the
mailing list for the GCC project.
Re: I think that may be a bug...
- From: Ian Lance Taylor <iant at google dot com>
- To: two2the8th_power_is256 at yahoo dot co dot jp
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 06 Jan 2012 06:25:50 -0800
- Subject: Re: I think that may be a bug...
- References: <email@example.com>
> 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));
> 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.)
> _jmp far [esp+4]
> 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?
This message should really be on the gcc-help mailing list, not the gcc
mailing list. The gcc mailing list is for the development of gcc
itself. Please take any followups to gcc-help. Thanks.
In any case, as far as I can tell, this is not a gcc question at all.
You seem to be asking about how the instruction
jmp far [%esp+4]
should be assembled. That is a question about the assembler, which is
not a part of gcc.
In any case, I agree that the GNU assembler appears to misassemble this
instruction in Intel syntax. I can get the right results in AT&T syntax
Please file a bug report for the GNU assembler at
http://sourceware.org/bugzilla/ . Thanks.