[haiku-development] Re: MBR code in r33263

  • From: André Braga <meianoite@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 29 Apr 2010 14:15:37 -0300

On 27 April 2010 03:42, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> wrote:
> Hi there,
>
> Michael has introduced André Braga's new FreeBSD derived MBR boot code.
> Unfortunately, there is only the machine code - can we have the
> assembler sources in our repository as well in order to be able to make
> changes to it? (or at least be able to read it)

FWIW, the sources were attached to ticket #4028
[http://dev.haiku-os.org/ticket/4028] and as of r36535 (latest that I
checked) there is a bug in
src/add-ons/kernel/partitioning_systems/intel/PartitionMapWriter.cpp.
The hex code is missing 8 bytes, or a quadword that indicates the
number of sectors that the GPT code loads (on haiku_gpt_mbr.S, line
145), and those are never written back anywhere else on the code.

By the way, src/bin/writembr/mbr.S can be completely replaced by
haiku_gpt_mbr.S, as the latter is a superset of the former (making
anyboot images even more anybooting than before!). There's a typo in a
comment present in haiku_gpt_mbr.S that got fixed in mbr.S, though.
There was a typo in the code on mbr.S that wasn't present on
haiku_gpt_mbr.S, as that was already fixed on FreeBSD's sources.

haiku_gpt_mbr.S is composed of FreeBSD's src/sys/boot/i386/mbr/mbr.s
(same as src/bin/writembr/mbr.S) and src/sys/boot/i386/pmbr/pmbr.s,
with some code shuffled around to account for the fact that it gets
relocated and the reset (setup) code has to be run before *and* after
reloc in case it falls back to loading from the active partition.


P.s.: Attached to this message is a version that has fixed comments
and better formatting of the code and comments (4 spaces per tab); no
functional changes. I'm updating the ticket as well.

Other related posts: