[yellowstone] Use denali client to parse GPT

This commit is contained in:
Drew Galbraith 2023-06-19 22:58:00 -07:00
parent 45cf2115da
commit 36a83b142b
4 changed files with 56 additions and 83 deletions

View file

@ -20,34 +20,10 @@ uint64_t main(uint64_t port_cap) {
Channel local;
check(SpawnProcessFromElfRegion(vaddr, local));
DenaliRead read{
.device_id = 0,
.lba = 0,
.size = 1,
};
check(local.WriteStruct(&read));
DenaliReadResponse resp;
uint64_t mem_cap;
check(local.ReadStructAndCap(&resp, &mem_cap));
check(CheckMbrIsGpt(mem_cap));
DenaliClient client(local);
GptReader reader(client);
DenaliRead read_lba1{
.device_id = 0,
.lba = 1,
.size = 1,
};
check(local.WriteStruct(&read_lba1));
check(local.ReadStructAndCap(&resp, &mem_cap));
check(ReadPartitionHeader(mem_cap));
DenaliRead read_parts{
.device_id = 0,
.lba = 2,
.size = 10, // FIXME: Dont hardcode this.
};
check(local.WriteStruct(&read_parts));
check(local.ReadStructAndCap(&resp, &mem_cap));
check(ReadPartitionEntries(mem_cap));
check(reader.ParsePartitionTables());
dbgln("Yellowstone Finished Successfully.");
return 0;