[metal] Clean up code for getting pointer to struct mman (#828)

Co-authored-by: tkchia <tkchia-cosmo@gmx.com>
This commit is contained in:
tkchia 2023-06-12 01:32:39 +08:00 committed by GitHub
parent 5a6a4819d4
commit e47c0cc929
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 6 deletions

View file

@ -176,7 +176,7 @@ __msabi noasan EFI_STATUS EfiMain(EFI_HANDLE ImageHandle,
SystemTable->BootServices->AllocatePages(
AllocateAddress, EfiRuntimeServicesData,
((_end - __executable_start) + 4095) / 4096, &Address);
mm = (struct mman *)0x0500;
mm = __get_mm_phy();
SystemTable->BootServices->SetMem(mm, sizeof(*mm), 0);
SystemTable->BootServices->SetMem(
(void *)0x79000, 0x7e000 - 0x79000 + sizeof(struct EfiArgs), 0);

View file

@ -225,5 +225,8 @@ forceinline void outb(unsigned short port, unsigned char byte) {
(uint64_t *)(BANE + cr3); \
})
#define __get_mm() ((struct mman *)(BANE + 0x0500))
#define __get_mm_phy() ((struct mman *)0x0500)
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_RUNTIME_PC_H_ */