I'm trying to follow the lab1 of MIT 6.828 to get some understanding about x86 bootstrapping.
The 1st instruction on boot up is:
[f000:fff0] 0xffff0: ljmp $0x3630,$0xf000e05b
If I understand correctly, x86 compatible CPUs always start in real mode. I'm confused by the operands of this instruction. Is the first value $0x3630
used as cs
register in the long jump and the next part $0xf000e05b
used as the offset?
If this is the case then the target address should be 0x36300 + 0xf000e05b
but the next instruction is [f000:e05b] 0xfe05b: cmpw $0xffc8,%cs:(%esi)
which is at 0xfe05b
. How is this address 0xfe05b
calculated? Does the CPU make use of the upper 16-bits of the EIP register at all in real mode?
I tried to set the architecture to be i8086 and inspect the instructions and they still seemed to be interpreted as 32-bit instructions.
(gdb) set architecture i8086
The target architecture is assumed to be i8086
(gdb) x/5i 0xffff0
0xffff0: ljmp $0x3630,$0xf000e05b
0xffff7: das
0xffff8: xor (%ebx),%dh
0xffffa: das
0xffffb: cmp %edi,(%ecx)
(gdb)