Root/
Source at commit 1275 created 12 years 11 months ago. By meklort, Remove unused file. Fixup makefiles some more - boot2 compiles again. | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 2011 Evan Lojewski. All rights reserved.␊ |
3 | *␊ |
4 | */␊ |
5 | ␊ |
6 | #include <IOKit/IOTypes.h>␊ |
7 | #include <BiosDisk.hpp>␊ |
8 | #include <GUIDPartition.hpp>␊ |
9 | #include <FDiskPartition.hpp>␊ |
10 | ␊ |
11 | #define MAXDEV 32␊ |
12 | #define BIOSBUFFER 512 * 8 /* 4Kb */␊ |
13 | extern "C"␊ |
14 | {␊ |
15 | #include "libsaio.h"␊ |
16 | void Disk_start();␊ |
17 | }␊ |
18 | ␊ |
19 | ␊ |
20 | Disk*␉␉disks[MAXDEV];␊ |
21 | UInt8 numBiosDisks = 0;␊ |
22 | UInt8* diskBuffer = NULL;␊ |
23 | ␊ |
24 | void DetermineDisks();␊ |
25 | ␊ |
26 | void Disk_start()␊ |
27 | {␊ |
28 | //diskBuffer = (UInt8*)malloc(BIOSBUFFER);␊ |
29 | /*UInt8* mbr = (UInt8*)malloc(512);␊ |
30 | ␊ |
31 | disk->Read(0, 1, mbr);␊ |
32 | printf("mbr[0] = 0x%X\n", mbr[0]);␊ |
33 | ␊ |
34 | printf("mbr[510] = 0x%X\n", mbr[510]);␊ |
35 | printf("mbr[511] = 0x%X\n", mbr[511]);␊ |
36 | ␊ |
37 | ␊ |
38 | GUIDPartition* partition = new GUIDPartition(disk, 0);␊ |
39 | if(partition->probe())␊ |
40 | {␊ |
41 | partition->Read(0, 1, mbr);␊ |
42 | printf("GUID[0]/[0] = 0x%X\n", mbr[0]);␊ |
43 | ␊ |
44 | }␊ |
45 | } ␊ |
46 | */␊ |
47 | DetermineDisks();␊ |
48 | ␊ |
49 | printf("This is a simple BootDisk_start test.\n");␊ |
50 | ␊ |
51 | ␊ |
52 | ␊ |
53 | halt();␊ |
54 | }␊ |
55 | ␊ |
56 | void DetermineDisks()␊ |
57 | {␊ |
58 | /*char diskName[] = "bios:/hd%s/";␊ |
59 | ␊ |
60 | for(int i = 0; i < MAXBIOSDEV; i++)␊ |
61 | {␊ |
62 | sprintf(diskName, "bios:/hd%d/", i);␊ |
63 | BiosDisk* disk = new BiosDisk(diskName);␊ |
64 | if(disk->probe())␊ |
65 | {␊ |
66 | printf("Disk %s exists\n", diskName);␊ |
67 | disks[numBiosDisks++] = disk;␊ |
68 | ␊ |
69 | ␊ |
70 | // Check if the disk is GUID␊ |
71 | GUIDPartition* partition = new GUIDPartition(disk, 0);␊ |
72 | UInt8 partitions = partition->getNumPartitions();␊ |
73 | printf("GUID Disk w/ %d disks\n", partitions);␊ |
74 | ␊ |
75 | for(UInt8 partno = 0; partno < partitions; partno++)␊ |
76 | {␊ |
77 | GUIDPartition* partition = new GUIDPartition(disk, partno);␊ |
78 | if(partition->probe())␊ |
79 | {␊ |
80 | printf("Partition %d valid\n", partno);␊ |
81 | }␊ |
82 | }␊ |
83 | ␊ |
84 | ␊ |
85 | // If not, check if the disk is MBR␊ |
86 | FDiskPartition* mbrdisk = new FDiskPartition(disk, 0);␊ |
87 | partitions = mbrdisk->getNumPartitions();␊ |
88 | printf("MBR Disk w/ %d disks\n", partitions);␊ |
89 | ␊ |
90 | ␊ |
91 | }␊ |
92 | else␊ |
93 | {␊ |
94 | delete disk;␊ |
95 | }␊ |
96 | ␊ |
97 | }␊ |
98 | ␉ */␊ |
99 | }␊ |
100 |