[coreboot] x86 : Puzzles about reset code

王翔 merle at tya.email
Wed Aug 16 05:03:13 CEST 2017


source code like this:
-----------------------------------------------------------------------------------------------------
	.section ".reset", "ax", %progbits
	.code16
.globl	_start
_start:
	.byte  0xe9
	.int   _start16bit - ( . + 2 )
	/* Note: The above jump is hand coded to work around bugs in binutils.
	 * 5 byte are used for a 3 byte instruction.  This works because x86
	 * is little endian and allows us to use supported 32bit relocations
	 * instead of the weird 16 bit relocations that binutils does not
	 * handle consistently between versions because they are used so rarely.
	 */
	.previous

-----------------------------------------------------------------------------------------------------




I tried to modify the code and passed test (use qemu test).
My code like this:
-----------------------------------------------------------------------------------------------------
	.section ".reset", "ax", %progbits
	.code16
.globl	_start
_start:
	jmp   _start16bit
	.previous

-----------------------------------------------------------------------------------------------------



What is the meaning of hand coding?  In 16-bit mode, the last two bytes are ignored.




------------------



王翔

安全研究员

广州市腾御安信息科技有限公司





广州市天河区珠江新城华穗路406号保利克洛维二期中景A座1020-1024
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot/attachments/20170816/940b2f34/attachment.html>


More information about the coreboot mailing list