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
This commit is contained in:
@@ -7,12 +7,15 @@
|
|||||||
#include "bios.h"
|
#include "bios.h"
|
||||||
|
|
||||||
#include <boot/platform.h>
|
#include <boot/platform.h>
|
||||||
|
#include <boot/partitions.h>
|
||||||
#include <boot/stdio.h>
|
#include <boot/stdio.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
// exported from shell.S
|
||||||
extern uint8 gBootDriveID;
|
extern uint8 gBootDriveID;
|
||||||
|
extern uint32 gBootPartitionOffset;
|
||||||
|
|
||||||
// int 0x13 definitions
|
// int 0x13 definitions
|
||||||
#define BIOS_GET_DRIVE_PARAMETERS 0x0800
|
#define BIOS_GET_DRIVE_PARAMETERS 0x0800
|
||||||
@@ -316,12 +319,18 @@ status_t
|
|||||||
platform_get_boot_partition(struct stage2_args *args, NodeList *list,
|
platform_get_boot_partition(struct stage2_args *args, NodeList *list,
|
||||||
boot::Partition **_partition)
|
boot::Partition **_partition)
|
||||||
{
|
{
|
||||||
|
printf("boot partition offset: %lu\n", gBootPartitionOffset);
|
||||||
|
|
||||||
NodeIterator iterator = list->Iterator();
|
NodeIterator iterator = list->Iterator();
|
||||||
boot::Partition *partition = NULL;
|
boot::Partition *partition = NULL;
|
||||||
while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
|
while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
|
||||||
// ToDo: just take the first partition for now
|
// search for the partition that contains the partition
|
||||||
*_partition = partition;
|
// offset as reported by the BFS boot block
|
||||||
return B_OK;
|
if (gBootPartitionOffset >= partition->offset
|
||||||
|
&& gBootPartitionOffset < partition->offset + partition->size) {
|
||||||
|
*_partition = partition;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
|||||||
Reference in New Issue
Block a user