boot0 code mystery
Jeremy Chadwick
koitsu at FreeBSD.org
Mon Dec 17 07:11:22 PST 2007
On Mon, Dec 17, 2007 at 07:16:02PM +0530, M.Girish Rao wrote:
> Whats the memory location of start?
I'm going off of memory of my old x86 days, so be kind to me. :-) By
the look of it, it's BOOT_BOOT0_ORG, which is 0x600. I'm basing this on
the flags passed to cc (actually ld) during linktime.
> what's this for incb -0xe(%di) ?
No idea.
> where are we jumping to in jmp main-LOAD+ORIGIN?
main is below the jmp main-LOAD+ORIGIN jump:
91 incb -0xe(%di) # Sector number
92 jmp main-LOAD+ORIGIN # To relocated code
93
94 main:
95 #if defined(SIO) && COMSPEED != 0
LOAD is set to 0x7c00:
27 .set LOAD,0x7c00 # Load address
You should be able to get the offset of main by looking at boot0.o once
assembled. The start origin doesn't appear to be included (which is
why it's added manually).
eos# objdump -t boot0.o | grep 'main$'
00000022 l .text 00000000 main
Thus I'm left to believe main-LOAD+ORIGIN == 0x8a22. This can be
verified by doing:
eos# objdump -S -M addr16,data16 boot0.o | grep -m 1 'jmp'
1f: e9 00 8a jmp 8a22 <LOAD+0xe22>
> whats ORIGIN?
ORIGIN is an assembler variable set to 0x600:
25 .set ORIGIN,0x600 # Execution address
--
| Jeremy Chadwick jdc at parodius.com |
| Parodius Networking http://www.parodius.com/ |
| UNIX Systems Administrator Mountain View, CA, USA |
| Making life hard for others since 1977. PGP: 4BD6C0CB |
More information about the freebsd-hackers
mailing list