tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: patch: MFSv3 support (libsa) for boot2 (i386)
On Thu, Jan 12, 2012 at 09:25:04PM +0400, Evgeniy Ivanov wrote:
>
> Magic too :-) I fall into trouble with it. In generated listing (mbr.S):
>
> 518 00f1 E9FE7B jmp BOOTADDR
>
> In obj file:
> f1: e9 fe 7b 5a 8a jmp 8a5a7cf4 <bss_end+0x8a5a76e4>
>
> In mbr (i.e. after linking):
>
> 00000f0 5a e9 0c f3 5a 8a 74 01
> ^^^^ Address has changed.
>
> I'm porting mbr to MINIX and address isn't changed there. What does
> happen in NetBSD on linking stage?
The code is linked to an address other than 0x7c00, the first thing
it does is copy itself to that address.
Are you sure you are disassembling it correctly ?
It looks like you haven't told objdump? it is 16bit code.
That jmp instruction needs to goto address 7c00, the opcode contains
the pc-next relative value, the 7bfe value is just a parameter to
the relocation.
In the final image you have f30c+3+f1-7c00 is 0x7800 which is ok
if the code is expected to relocate itself to 0x7800.
You can get a correct disassembly with:
objdump -bbinary -D -mi8086 --adjust-vma=0x7800 mbr
The actual value for LOADADDR can be seen at the top of the output.
Note that the bootselect code uses a big chunk (probably 0x400 bytes)
of 'bss', so 0x7800 is a bad choice of relocation address!
David
--
David Laight: david%l8s.co.uk@localhost
Home |
Main Index |
Thread Index |
Old Index