cosmopolitan/libc/runtime/mman.internal.h
Justine Tunney edd9297eba 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.
2021-02-24 00:53:24 -08:00

24 lines
965 B
C

#ifndef COSMOPOLITAN_LIBC_RUNTIME_MMAN_H_
#define COSMOPOLITAN_LIBC_RUNTIME_MMAN_H_
#include "libc/runtime/e820.internal.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct mman {
int64_t pdp; /* 0x0500 */
int32_t pdpi; /* 0x0508 */
int32_t e820n; /* 0x050a */
struct SmapEntry e820[256]; /* 0x0510 */
char pc_drive_base_table[11]; /* 0x1510 */
unsigned char pc_drive_type; /* 0x151b */
unsigned char pc_drive_last_sector; /* 0x151c */
unsigned short pc_drive_last_cylinder; /* 0x151d */
unsigned char pc_drives_attached; /* 0x151f */
unsigned char pc_drive_last_head; /* 0x1520 */
unsigned char pc_drive; /* 0x1521 */
char bad_idt[6]; /* 0x1522 */
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_RUNTIME_MMAN_H_ */