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:
Justine Tunney 2023-06-09 18:02:06 -07:00
parent 9b55dbe417
commit 4a59210008
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
115 changed files with 699 additions and 422 deletions

View file

@ -1465,7 +1465,7 @@ static textstartup void __asan_shadow_mapping(struct MemoryIntervals *m,
static textstartup void __asan_shadow_existing_mappings(void) {
__asan_shadow_mapping(&_mmi, 0);
__asan_map_shadow(GetStackAddr(), GetStackSize());
__asan_poison((void *)GetStackAddr(), GUARDSIZE, kAsanStackOverflow);
__asan_poison((void *)GetStackAddr(), APE_GUARDSIZE, kAsanStackOverflow);
}
forceinline ssize_t __write_str(const char *s) {
@ -1492,7 +1492,7 @@ void __asan_init(int argc, char **argv, char **envp, intptr_t *auxv) {
__asan_shadow_existing_mappings();
__asan_map_shadow((uintptr_t)__executable_start, _end - __executable_start);
__asan_map_shadow(0, 4096);
__asan_poison(0, GUARDSIZE, kAsanNullPage);
__asan_poison(0, APE_GUARDSIZE, kAsanNullPage);
if (!IsWindows()) {
sys_mprotect((void *)0x7fff8000, 0x10000, PROT_READ);
}

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/struct/seccomp.h"
#include "libc/calls/struct/seccomp.internal.h"
#include "libc/intrin/describeflags.internal.h"
const char *DescribeSeccompOperation(int x) {

View file

@ -184,7 +184,7 @@ privileged bool kisdangerous(const void *p) {
if (IsStackFrame(frame)) return false;
if (kismapped(frame)) return false;
}
if (GetStackAddr() + GUARDSIZE <= (uintptr_t)p &&
if (GetStackAddr() + APE_GUARDSIZE <= (uintptr_t)p &&
(uintptr_t)p < GetStackAddr() + GetStackSize()) {
return false;
}