gcc's x86 "RET"-machine instruction optimization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello

Im trying to write a script which patches gcc's assembler output (-S
option) in that way, that those functions which are exported (.gobl
asm-directive) return with a near-jump instead of a
near-return-instruction. (Im writing a BIOS for a virtual machine...)

So i fist that it would be an easy task to replace all
"retl"-instructions by "lretw" ones in gcc's asm code. But then now im
facing a problem:

C code like that:
kbd.c:

bios_16_xxxx(struct regs *regs)
{
	if (AH == 0x00) {
		bios_16_00xx(regs);
	} else {
		....
	}
}

kbd.s

bios_16_xxxx:
.LCFI71:
	...
	jmp	bios_16_00xx
.L105:
	...
	lretw		(PATCHED RETURN)


....


bios_16_00xx:
.LFB59:
	...
	ret


GCC uses a jmp-instruction instead of a call one, so 'speeds up' execution by
saving the execution of bios_16_xxxx's return instruction (lretw one). This of course
ruins my efforts. Therfore i'd like to know how this optimization is called, and if
there is any gcc option to disable this particular optimization.

Big thanks in advance
josef

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux