This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: I think that may be a bug...


two2the8th_power_is256@yahoo.co.jp writes:

> 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?

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
by using
	ljmp	*4(%esp)

Please file a bug report for the GNU assembler at
http://sourceware.org/bugzilla/ .  Thanks.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]