Page 1 of 1

What does this line in grub legacy do?

Posted: Sun Jun 08, 2014 6:42 pm
by arunsk
Hi,

I am reading the legacy grub source code and I found the below line :

https://github.com/aszeszo/pv-grub/blob ... age1.S#L65

What does this piece of code do ? Is this part of 'as' syntax ? I couldn't google it for the string pattern.

Thanks,
Arun

Re: What does this line in grub legacy do?

Posted: Mon Jun 09, 2014 3:37 am
by jnc100
The 'jmp after_BPB' instruction could be encoded as either a 8-bit or 16-bit relative jump (opcodes 0xeb and 0xe9 respectively) and the assembler is actually free to choose whichever it likes. Generally, most compilers will choose the smallest possible, but there is never any guarantee of this. What the line you've highlighted does is ensure that the BPB starts at the appropriate address, regardless of which jmp opcode is chosen.

Regards,
John.