mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-05 10:48:29 +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
|
@ -20,7 +20,6 @@
|
|||
#define OPENBSD 16
|
||||
#define FREEBSD 32
|
||||
#define NETBSD 64
|
||||
#define UEFI 128
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define NoDebug() 1
|
||||
|
@ -73,7 +72,6 @@
|
|||
#define SupportsLinux() ((SUPPORT_VECTOR & LINUX) == LINUX)
|
||||
#define SupportsMetal() ((SUPPORT_VECTOR & METAL) == METAL)
|
||||
#define SupportsWindows() ((SUPPORT_VECTOR & WINDOWS) == WINDOWS)
|
||||
#define SupportsUefi() ((SUPPORT_VECTOR & UEFI) == UEFI)
|
||||
#define SupportsXnu() ((SUPPORT_VECTOR & XNU) == XNU)
|
||||
#define SupportsFreebsd() ((SUPPORT_VECTOR & FREEBSD) == FREEBSD)
|
||||
#define SupportsOpenbsd() ((SUPPORT_VECTOR & OPENBSD) == OPENBSD)
|
||||
|
@ -86,7 +84,6 @@
|
|||
#define IsLinux() (SupportsLinux() && (__hostos & LINUX))
|
||||
#define IsMetal() (SupportsMetal() && (__hostos & METAL))
|
||||
#define IsWindows() (SupportsWindows() && (__hostos & WINDOWS))
|
||||
#define IsUefi() (SupportsUefi() && (__hostos & UEFI))
|
||||
#define IsXnu() (SupportsXnu() && (__hostos & XNU))
|
||||
#define IsFreebsd() (SupportsFreebsd() && (__hostos & FREEBSD))
|
||||
#define IsOpenbsd() (SupportsOpenbsd() && (__hostos & OPENBSD))
|
||||
|
@ -97,7 +94,6 @@
|
|||
#define IsLinux() $LINUX,__hostos(%rip)
|
||||
#define IsMetal() $METAL,__hostos(%rip)
|
||||
#define IsWindows() $WINDOWS,__hostos(%rip)
|
||||
#define IsUefi() $UEFI,__hostos(%rip)
|
||||
#define IsBsd() $XNU|FREEBSD|OPENBSD|NETBSD,__hostos(%rip)
|
||||
#define IsXnu() $XNU,__hostos(%rip)
|
||||
#define IsFreebsd() $FREEBSD,__hostos(%rip)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue