mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 22:02:27 +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
|
@ -34,6 +34,7 @@
|
|||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/memtrack.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/stack.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
|
@ -150,17 +151,18 @@ TEST(mmap, testMapFixed_destroysEverythingInItsPath) {
|
|||
TEST(mmap, customStackMemory_isAuthorized) {
|
||||
char *stack;
|
||||
uintptr_t w, r;
|
||||
ASSERT_NE(MAP_FAILED, (stack = mmap(NULL, STACKSIZE, PROT_READ | PROT_WRITE,
|
||||
MAP_ANONYMOUS | MAP_STACK, -1, 0)));
|
||||
ASSERT_NE(MAP_FAILED,
|
||||
(stack = mmap(NULL, GetStackSize(), PROT_READ | PROT_WRITE,
|
||||
MAP_ANONYMOUS | MAP_STACK, -1, 0)));
|
||||
asm("mov\t%%rsp,%0\n\t"
|
||||
"mov\t%2,%%rsp\n\t"
|
||||
"push\t%3\n\t"
|
||||
"pop\t%1\n\t"
|
||||
"mov\t%0,%%rsp"
|
||||
: "=&r"(w), "=&r"(r)
|
||||
: "rm"(stack + STACKSIZE - 8), "i"(123));
|
||||
: "rm"(stack + GetStackSize() - 8), "i"(123));
|
||||
ASSERT_EQ(123, r);
|
||||
EXPECT_SYS(0, 0, munmap(stack, STACKSIZE));
|
||||
EXPECT_SYS(0, 0, munmap(stack, GetStackSize()));
|
||||
}
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue