mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-12 14:09:12 +00:00
Introduce #include <cosmo.h>
to toolchain users
This change improves the way internal APIs are being hidden behind the `COSMO` define. The cosmo.h header will take care of defining that, so that a separate define statement isn't needed. This change also does a lot more to define which APIs are standard, and which belong to Cosmo.
This commit is contained in:
parent
9b55dbe417
commit
4a59210008
115 changed files with 699 additions and 422 deletions
|
@ -17,7 +17,6 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
.privileged
|
||||
|
||||
// Loads XMM registers from buffer.
|
||||
//
|
||||
|
|
|
@ -17,14 +17,16 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
.privileged
|
||||
|
||||
// Loads previously saved processor state.
|
||||
//
|
||||
// @param rdi points to the jmp_buf
|
||||
// @param rsi is returned by setlongerjmp() invocation
|
||||
// @noreturn
|
||||
.ftrace1
|
||||
longerjmp:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
mov $1,%eax
|
||||
mov %rsi,%rdx
|
||||
mov (%rdi),%rsp
|
||||
|
@ -35,4 +37,22 @@ longerjmp:
|
|||
mov 40(%rdi),%r14
|
||||
mov 48(%rdi),%r15
|
||||
jmp *56(%rdi)
|
||||
#elif defined(__aarch64__)
|
||||
ldp x19,x20,[x0,#0]
|
||||
ldp x21,x22,[x0,#16]
|
||||
ldp x23,x24,[x0,#32]
|
||||
ldp x25,x26,[x0,#48]
|
||||
ldp x27,x28,[x0,#64]
|
||||
ldp x29,x30,[x0,#80]
|
||||
ldr x2,[x0,#104]
|
||||
mov sp,x2
|
||||
ldp d8 ,d9,[x0,#112]
|
||||
ldp d10,d11,[x0,#128]
|
||||
ldp d12,d13,[x0,#144]
|
||||
ldp d14,d15,[x0,#160]
|
||||
mov x0,x1
|
||||
br x30
|
||||
#else
|
||||
#error "unsupported architecture"
|
||||
#endif
|
||||
.endfn longerjmp,globl
|
||||
|
|
|
@ -57,6 +57,8 @@ longjmp:
|
|||
cmp w1,0
|
||||
csinc w0,w1,wzr,ne
|
||||
br x30
|
||||
#else
|
||||
#error "unsupported architecture"
|
||||
#endif
|
||||
.endfn longjmp,globl
|
||||
.alias longjmp,_longjmp
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
.privileged
|
||||
|
||||
// Stores XMM registers to buffer.
|
||||
//
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
// @note code built w/ microsoft abi compiler can't call this
|
||||
// @see longjmp(), _gclongjmp()
|
||||
.ftrace1
|
||||
setjmp: .ftrace2
|
||||
setjmp:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
lea 8(%rsp),%rax
|
||||
mov %rax,(%rdi)
|
||||
|
@ -40,6 +41,7 @@ setjmp: .ftrace2
|
|||
mov (%rsp),%rax
|
||||
mov %rax,56(%rdi)
|
||||
xor %eax,%eax
|
||||
ret
|
||||
#elif defined(__aarch64__)
|
||||
stp x19,x20,[x0,#0]
|
||||
stp x21,x22,[x0,#16]
|
||||
|
@ -54,7 +56,9 @@ setjmp: .ftrace2
|
|||
stp d12,d13,[x0,#144]
|
||||
stp d14,d15,[x0,#160]
|
||||
mov x0,#0
|
||||
#endif
|
||||
ret
|
||||
#else
|
||||
#error "unsupported architecture"
|
||||
#endif
|
||||
.endfn setjmp,globl
|
||||
.alias setjmp,_setjmp
|
||||
|
|
|
@ -24,7 +24,10 @@
|
|||
// @return eax contains 0 when set, and 1 if jumped
|
||||
// @return rdx contains value passed to longerjmp()
|
||||
// @returnstwice
|
||||
.ftrace1
|
||||
setlongerjmp:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
lea 8(%rsp),%rax
|
||||
mov %rax,(%rdi)
|
||||
mov %rbx,8(%rdi)
|
||||
|
@ -38,4 +41,23 @@ setlongerjmp:
|
|||
xor %eax,%eax
|
||||
xor %edx,%edx
|
||||
ret
|
||||
#elif defined(__aarch64__)
|
||||
stp x19,x20,[x0,#0]
|
||||
stp x21,x22,[x0,#16]
|
||||
stp x23,x24,[x0,#32]
|
||||
stp x25,x26,[x0,#48]
|
||||
stp x27,x28,[x0,#64]
|
||||
stp x29,x30,[x0,#80]
|
||||
mov x2,sp
|
||||
str x2,[x0,#104]
|
||||
stp d8,d9,[x0,#112]
|
||||
stp d10,d11,[x0,#128]
|
||||
stp d12,d13,[x0,#144]
|
||||
stp d14,d15,[x0,#160]
|
||||
mov x0,#0
|
||||
mov x1,#0
|
||||
ret
|
||||
#else
|
||||
#error "unsupported architecture"
|
||||
#endif
|
||||
.endfn setlongerjmp,globl
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
#include "ape/relocations.h"
|
||||
#include "libc/zip.h"
|
||||
#include "libc/zip.internal.h"
|
||||
|
||||
// ZIP Central Directory.
|
||||
.section .zip.3,"",@progbits
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue