mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-03 17:58:30 +00:00
Support malloc() on bare metal
Your Actually Portable Executables now contains a simple virtual memory that works similarly to the Linux Kernel in the sense that it maps your physical memory to negative addresses. This is needed to support mmap() and malloc(). This functionality has zero code size impact. For example the MODE=tiny LIFE.COM executable is still only 12KB in size. The APE bootloader code has also been simplified to improve readibility and further elevate the elegance by which we're able to support so many platforms thereby enhancing verifiability so that we may engender trust in this bootloading process.
This commit is contained in:
parent
ac3b1dfb21
commit
edd9297eba
89 changed files with 900 additions and 1417 deletions
|
@ -258,6 +258,9 @@ typedef EFI_STATUS(EFIAPI *EFI_GET_MEMORY_MAP)(
|
|||
typedef EFI_STATUS(EFIAPI *EFI_ALLOCATE_POOL)(EFI_MEMORY_TYPE PoolType,
|
||||
uintptr_t Size, void *out_Buffer);
|
||||
typedef EFI_STATUS(EFIAPI *EFI_FREE_POOL)(void *Buffer);
|
||||
typedef void(EFIAPI *EFI_SET_MEM)(void *Buffer, uintptr_t Size, uint8_t Value);
|
||||
typedef void(EFIAPI *EFI_COPY_MEM)(void *Destination, void *Source,
|
||||
uintptr_t Length);
|
||||
|
||||
typedef EFI_STATUS(EFIAPI *EFI_CHECK_EVENT)(EFI_EVENT Event);
|
||||
typedef EFI_STATUS(EFIAPI *EFI_CLOSE_EVENT)(EFI_EVENT Event);
|
||||
|
@ -346,6 +349,8 @@ typedef EFI_STATUS(EFIAPI *EFI_IMAGE_LOAD)(bool BootPolicy,
|
|||
uintptr_t SourceSize,
|
||||
EFI_HANDLE *out_ImageHandle);
|
||||
typedef EFI_STATUS(EFIAPI *EFI_IMAGE_UNLOAD)(EFI_HANDLE ImageHandle);
|
||||
typedef EFI_STATUS(EFIAPI *EFI_EXIT_BOOT_SERVICES)(EFI_HANDLE ImageHandle,
|
||||
uintptr_t MapKey);
|
||||
|
||||
typedef struct {
|
||||
EFI_TABLE_HEADER Hdr;
|
||||
|
@ -393,7 +398,7 @@ typedef struct {
|
|||
void *StartImage;
|
||||
EFI_EXIT Exit;
|
||||
EFI_IMAGE_UNLOAD UnloadImage;
|
||||
void *ExitBootServices;
|
||||
EFI_EXIT_BOOT_SERVICES ExitBootServices;
|
||||
EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
|
||||
EFI_STALL Stall;
|
||||
EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
|
||||
|
@ -408,8 +413,8 @@ typedef struct {
|
|||
void *InstallMultipleProtocolInterfaces;
|
||||
void *UninstallMultipleProtocolInterfaces;
|
||||
void *CalculateCrc32;
|
||||
void *CopyMem;
|
||||
void *SetMem;
|
||||
EFI_COPY_MEM CopyMem;
|
||||
EFI_SET_MEM SetMem;
|
||||
EFI_CREATE_EVENT_EX CreateEventEx;
|
||||
} EFI_BOOT_SERVICES;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue