[Mammoth] Move all callers of FromCapability to OwnedMemoryObject.

This commit is contained in:
Drew Galbraith 2023-11-19 20:33:15 -08:00
parent 337126cabb
commit 8e827a5dfb
24 changed files with 175 additions and 87 deletions

View file

@ -64,8 +64,8 @@ glcr::ErrorCode GptReader::ParsePartitionTables() {
req.set_size(2);
ReadResponse resp;
RET_ERR(denali_->Read(req, resp));
MappedMemoryRegion lba_1_and_2 =
MappedMemoryRegion::FromCapability(resp.memory());
OwnedMemoryRegion lba_1_and_2 =
OwnedMemoryRegion::FromCapability(resp.memory());
uint16_t* mbr_sig = reinterpret_cast<uint16_t*>(lba_1_and_2.vaddr() + 0x1FE);
if (*mbr_sig != 0xAA55) {
dbgln("Invalid MBR Sig: {x}", *mbr_sig);
@ -106,8 +106,8 @@ glcr::ErrorCode GptReader::ParsePartitionTables() {
req.set_lba(header->lba_partition_entries);
req.set_size(num_blocks);
RET_ERR(denali_->Read(req, resp));
MappedMemoryRegion part_table =
MappedMemoryRegion::FromCapability(resp.memory());
OwnedMemoryRegion part_table =
OwnedMemoryRegion::FromCapability(resp.memory());
for (uint64_t i = 0; i < num_partitions; i++) {
PartitionEntry* entry = reinterpret_cast<PartitionEntry*>(
part_table.vaddr() + (i * entry_size));

View file

@ -43,8 +43,8 @@ uint64_t main(uint64_t port_cap) {
OpenFileResponse response;
check(vfs_client->OpenFile(request, response));
MappedMemoryRegion filemem =
MappedMemoryRegion::FromCapability(response.memory());
OwnedMemoryRegion filemem =
OwnedMemoryRegion::FromCapability(response.memory());
glcr::String file(reinterpret_cast<const char*>(filemem.vaddr()),
response.size());

View file

@ -60,8 +60,8 @@ glcr::ErrorCode YellowstoneServer::HandleGetAhciInfo(const Empty&,
glcr::ErrorCode YellowstoneServer::HandleGetFramebufferInfo(
const Empty&, FramebufferInfo& info) {
// FIXME: Don't do this for each request.
MappedMemoryRegion region =
MappedMemoryRegion::FromCapability(gBootFramebufferVmmoCap);
OwnedMemoryRegion region =
OwnedMemoryRegion::FromCapability(gBootFramebufferVmmoCap);
ZFramebufferInfo* fb = reinterpret_cast<ZFramebufferInfo*>(region.vaddr());
info.set_address_phys(fb->address_phys);