mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 08:12:28 +00:00
Make improvements
This change progresses our AARCH64 support: - The AARCH64 build and tests are now passing - Add 128-bit floating-point support to printf() - Fix clone() so it initializes cosmo's x28 TLS register - Fix TLS memory layout issue with aarch64 _Alignas vars - Revamp microbenchmarking tools so they work on aarch64 - Make some subtle improvements to aarch64 crash reporting - Make kisdangerous() memory checks more accurate on aarch64 - Remove sys_open() since it's not available on Linux AARCH64 This change makes general improvements to Cosmo and Redbean: - Introduce GetHostIsa() function in Redbean - You can now feature check using pledge(0, 0) - You can now feature check using unveil("",0) - Refactor some more x86-specific asm comments - Refactor and write docs for some libm functions - Make the mmap() API behave more similar to Linux - Fix WIFSIGNALED() which wrongly returned true for zero - Rename some obscure cosmo keywords from noFOO to dontFOO
This commit is contained in:
parent
5655c9a4e7
commit
8f522cb702
116 changed files with 1194 additions and 1025 deletions
|
@ -96,30 +96,6 @@ TEST(write, rlimitFsizeExceeded_raisesEfbig) {
|
|||
EXITS(0);
|
||||
}
|
||||
|
||||
static long Write(long fd, const void *data, unsigned long size) {
|
||||
#ifdef __x86_64__
|
||||
long ax, di, si, dx;
|
||||
asm volatile("syscall"
|
||||
: "=a"(ax), "=D"(di), "=S"(si), "=d"(dx)
|
||||
: "0"(__NR_write), "1"(fd), "2"(data), "3"(size)
|
||||
: "rcx", "r8", "r9", "r10", "r11", "memory", "cc");
|
||||
return ax;
|
||||
#elif defined(__aarch64__)
|
||||
register long r0 asm("x0") = (long)fd;
|
||||
register long r1 asm("x1") = (long)data;
|
||||
register long r2 asm("x2") = (long)size;
|
||||
register long r8 asm("x8") = (long)__NR_write;
|
||||
register long res_x0 asm("x0");
|
||||
asm volatile("svc\t0"
|
||||
: "=r"(res_x0)
|
||||
: "r"(r0), "r"(r1), "r"(r2), "r"(r8)
|
||||
: "memory");
|
||||
return res_x0;
|
||||
#else
|
||||
#error "unsupported architecture"
|
||||
#endif
|
||||
}
|
||||
|
||||
BENCH(write, bench) {
|
||||
ASSERT_SYS(0, 3, open("/dev/null", O_WRONLY));
|
||||
EZBENCH2("write", donothing, write(3, "hello", 5));
|
||||
|
@ -127,7 +103,5 @@ BENCH(write, bench) {
|
|||
EZBENCH2("sys_write", donothing, sys_write(3, "hello", 5));
|
||||
EZBENCH2("sys_writev", donothing,
|
||||
sys_writev(3, &(struct iovec){"hello", 5}, 1));
|
||||
EZBENCH2("Write", donothing, Write(3, "hello", 5));
|
||||
EZBENCH2("Write", donothing, Write(3, "hello", 5));
|
||||
ASSERT_SYS(0, 0, close(3));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue