[all] Add stub for new Endpoint kernel object

This commit is contained in:
Drew Galbraith 2023-06-21 21:26:24 -07:00
parent 1f7a15eed4
commit 69501bfe01
15 changed files with 144 additions and 38 deletions

View file

@ -49,8 +49,9 @@ struct PartitionEntry {
GptReader::GptReader(const DenaliClient& client) : denali_(client) {}
z_err_t GptReader::ParsePartitionTables() {
MappedMemoryRegion lba_1_and_2 = denali_.ReadSectors(0, 0, 2);
glcr::ErrorCode GptReader::ParsePartitionTables() {
ASSIGN_OR_RETURN(MappedMemoryRegion lba_1_and_2,
denali_.ReadSectors(0, 0, 2));
uint16_t* mbr_sig = reinterpret_cast<uint16_t*>(lba_1_and_2.vaddr() + 0x1FE);
if (*mbr_sig != 0xAA55) {
return glcr::FAILED_PRECONDITION;
@ -83,8 +84,9 @@ z_err_t GptReader::ParsePartitionTables() {
dbgln("partition_entry_size: %x", entry_size);
dbgln("Num blocks: %x", num_blocks);
MappedMemoryRegion part_table =
denali_.ReadSectors(0, header->lba_partition_entries, num_blocks);
ASSIGN_OR_RETURN(
MappedMemoryRegion part_table,
denali_.ReadSectors(0, header->lba_partition_entries, num_blocks));
dbgln("Entries");
for (uint64_t i = 0; i < num_partitions; i++) {
PartitionEntry* entry = reinterpret_cast<PartitionEntry*>(

View file

@ -8,7 +8,7 @@ class GptReader {
public:
GptReader(const DenaliClient&);
z_err_t ParsePartitionTables();
glcr::ErrorCode ParsePartitionTables();
private:
DenaliClient denali_;

View file

@ -1,6 +1,6 @@
#include <denali/denali.h>
#include <mammoth/channel.h>
#include <mammoth/debug.h>
#include <mammoth/endpoint_client.h>
#include <mammoth/init.h>
#include <mammoth/process.h>
#include <zcall.h>
@ -17,13 +17,13 @@ uint64_t main(uint64_t port_cap) {
uint64_t vaddr;
check(ZAddressSpaceMap(gSelfVmasCap, 0, gBootDenaliVmmoCap, &vaddr));
auto local_or = SpawnProcessFromElfRegion(vaddr);
if (!local_or) {
check(local_or.error());
auto endpoint_or = SpawnProcessFromElfRegion(vaddr);
if (!endpoint_or) {
check(endpoint_or.error());
}
Channel local = local_or.value();
EndpointClient endpoint = endpoint_or.value();
DenaliClient client(local);
DenaliClient client(endpoint);
GptReader reader(client);
check(reader.ParsePartitionTables());