From 0f87a64b545858ae0de71bb4693d969a67cef721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 20 Apr 2004 01:26:56 +0000 Subject: [PATCH] Add support for the boot partition offset as provided by the BFS boot block. Now, platform_get_boot_partition() will work correctly. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7253 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/boot/platform/bios_ia32/devices.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/kernel/boot/platform/bios_ia32/devices.cpp b/src/kernel/boot/platform/bios_ia32/devices.cpp index d8afd3e011..1005f801cd 100644 --- a/src/kernel/boot/platform/bios_ia32/devices.cpp +++ b/src/kernel/boot/platform/bios_ia32/devices.cpp @@ -7,12 +7,15 @@ #include "bios.h" #include +#include #include #include +// exported from shell.S extern uint8 gBootDriveID; +extern uint32 gBootPartitionOffset; // int 0x13 definitions #define BIOS_GET_DRIVE_PARAMETERS 0x0800 @@ -316,12 +319,18 @@ status_t platform_get_boot_partition(struct stage2_args *args, NodeList *list, boot::Partition **_partition) { + printf("boot partition offset: %lu\n", gBootPartitionOffset); + NodeIterator iterator = list->Iterator(); boot::Partition *partition = NULL; while ((partition = (boot::Partition *)iterator.Next()) != NULL) { - // ToDo: just take the first partition for now - *_partition = partition; - return B_OK; + // search for the partition that contains the partition + // offset as reported by the BFS boot block + if (gBootPartitionOffset >= partition->offset + && gBootPartitionOffset < partition->offset + partition->size) { + *_partition = partition; + return B_OK; + } } return B_ENTRY_NOT_FOUND;