mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Get LIBC_TESTLIB building on AARCH64
This commit is contained in:
parent
95fab334e4
commit
5e2f7f7ced
46 changed files with 975 additions and 1174 deletions
|
@ -49,8 +49,8 @@
|
|||
#include "third_party/dlmalloc/dlmalloc.h"
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
STATIC_YOINK("_init_asan");
|
||||
#endif
|
||||
|
||||
#if IsModeDbg()
|
||||
// MODE=dbg
|
||||
|
@ -159,6 +159,11 @@ static struct AsanMorgue {
|
|||
_Atomic(void *) p[ASAN_MORGUE_ITEMS];
|
||||
} __asan_morgue;
|
||||
|
||||
int __asan_option_detect_stack_use_after_return = 0;
|
||||
|
||||
void __asan_version_mismatch_check_v8(void) {
|
||||
}
|
||||
|
||||
static bool __asan_once(void) {
|
||||
bool want = false;
|
||||
static atomic_int once;
|
||||
|
@ -1463,8 +1468,7 @@ static textstartup void __asan_shadow_existing_mappings(void) {
|
|||
__asan_poison((void *)GetStackAddr(), GUARDSIZE, kAsanStackOverflow);
|
||||
}
|
||||
|
||||
__attribute__((__constructor__)) void __asan_init(int argc, char **argv,
|
||||
char **envp, intptr_t *auxv) {
|
||||
void __asan_init(int argc, char **argv, char **envp, intptr_t *auxv) {
|
||||
static bool once;
|
||||
if (!_cmpxchg(&once, false, true)) return;
|
||||
if (IsWindows() && NtGetVersion() < kNtVersionWindows10) {
|
||||
|
@ -1499,5 +1503,3 @@ __attribute__((__constructor__)) void __asan_init(int argc, char **argv,
|
|||
STRACE("/_/ \\_\\____/_/ \\_\\_| \\_|");
|
||||
STRACE("cosmopolitan memory safety module initialized");
|
||||
}
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
|
|
@ -18,9 +18,14 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
// Delegates to free().
|
||||
//
|
||||
// @note reduces make dependency toil caused by macros
|
||||
testlib_free:
|
||||
jmp free
|
||||
.endfn testlib_free,globl
|
||||
.init.start 303,_init_asan
|
||||
push %rdi
|
||||
push %rsi
|
||||
mov %r12,%rdi
|
||||
mov %r13,%rsi
|
||||
mov %r14,%rdx
|
||||
mov %r15,%rcx
|
||||
call __asan_init
|
||||
pop %rsi
|
||||
pop %rdi
|
||||
.init.end 303,_init_asan
|
173
libc/intrin/asanthunk.c
Normal file
173
libc/intrin/asanthunk.c
Normal file
|
@ -0,0 +1,173 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2023 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
|
||||
void __asan_report_load(void *, int);
|
||||
void __asan_report_store(void *, int);
|
||||
void *__asan_stack_malloc(size_t, int);
|
||||
void __asan_stack_free(char *, size_t, int);
|
||||
|
||||
void __asan_report_load1(void *p) {
|
||||
__asan_report_load(p, 1);
|
||||
}
|
||||
void __asan_report_load2(void *p) {
|
||||
__asan_report_load(p, 2);
|
||||
}
|
||||
void __asan_report_load4(void *p) {
|
||||
__asan_report_load(p, 4);
|
||||
}
|
||||
void __asan_report_load8(void *p) {
|
||||
__asan_report_load(p, 8);
|
||||
}
|
||||
void __asan_report_load16(void *p) {
|
||||
__asan_report_load(p, 16);
|
||||
}
|
||||
void __asan_report_load32(void *p) {
|
||||
__asan_report_load(p, 32);
|
||||
}
|
||||
void __asan_report_load_n(void *p, int n) {
|
||||
__asan_report_load(p, n);
|
||||
}
|
||||
|
||||
void __asan_report_store1(void *p) {
|
||||
__asan_report_store(p, 1);
|
||||
}
|
||||
void __asan_report_store2(void *p) {
|
||||
__asan_report_store(p, 2);
|
||||
}
|
||||
void __asan_report_store4(void *p) {
|
||||
__asan_report_store(p, 4);
|
||||
}
|
||||
void __asan_report_store8(void *p) {
|
||||
__asan_report_store(p, 8);
|
||||
}
|
||||
void __asan_report_store16(void *p) {
|
||||
__asan_report_store(p, 16);
|
||||
}
|
||||
void __asan_report_store32(void *p) {
|
||||
__asan_report_store(p, 32);
|
||||
}
|
||||
void __asan_report_store_n(void *p, int n) {
|
||||
__asan_report_store(p, n);
|
||||
}
|
||||
|
||||
void *__asan_stack_malloc_0(size_t n) {
|
||||
return __asan_stack_malloc(n, 0);
|
||||
}
|
||||
void *__asan_stack_malloc_1(size_t n) {
|
||||
return __asan_stack_malloc(n, 1);
|
||||
}
|
||||
void *__asan_stack_malloc_2(size_t n) {
|
||||
return __asan_stack_malloc(n, 2);
|
||||
}
|
||||
void *__asan_stack_malloc_3(size_t n) {
|
||||
return __asan_stack_malloc(n, 3);
|
||||
}
|
||||
void *__asan_stack_malloc_4(size_t n) {
|
||||
return __asan_stack_malloc(n, 4);
|
||||
}
|
||||
void *__asan_stack_malloc_5(size_t n) {
|
||||
return __asan_stack_malloc(n, 5);
|
||||
}
|
||||
void *__asan_stack_malloc_6(size_t n) {
|
||||
return __asan_stack_malloc(n, 6);
|
||||
}
|
||||
void *__asan_stack_malloc_7(size_t n) {
|
||||
return __asan_stack_malloc(n, 7);
|
||||
}
|
||||
void *__asan_stack_malloc_8(size_t n) {
|
||||
return __asan_stack_malloc(n, 8);
|
||||
}
|
||||
void *__asan_stack_malloc_9(size_t n) {
|
||||
return __asan_stack_malloc(n, 9);
|
||||
}
|
||||
void *__asan_stack_malloc_10(size_t n) {
|
||||
return __asan_stack_malloc(n, 10);
|
||||
}
|
||||
|
||||
void __asan_stack_free_0(char *p, size_t n) {
|
||||
__asan_stack_free(p, n, 0);
|
||||
}
|
||||
void __asan_stack_free_1(char *p, size_t n) {
|
||||
__asan_stack_free(p, n, 1);
|
||||
}
|
||||
void __asan_stack_free_2(char *p, size_t n) {
|
||||
__asan_stack_free(p, n, 2);
|
||||
}
|
||||
void __asan_stack_free_3(char *p, size_t n) {
|
||||
__asan_stack_free(p, n, 3);
|
||||
}
|
||||
void __asan_stack_free_4(char *p, size_t n) {
|
||||
__asan_stack_free(p, n, 4);
|
||||
}
|
||||
void __asan_stack_free_5(char *p, size_t n) {
|
||||
__asan_stack_free(p, n, 5);
|
||||
}
|
||||
void __asan_stack_free_6(char *p, size_t n) {
|
||||
__asan_stack_free(p, n, 6);
|
||||
}
|
||||
void __asan_stack_free_7(char *p, size_t n) {
|
||||
__asan_stack_free(p, n, 7);
|
||||
}
|
||||
void __asan_stack_free_8(char *p, size_t n) {
|
||||
__asan_stack_free(p, n, 8);
|
||||
}
|
||||
void __asan_stack_free_9(char *p, size_t n) {
|
||||
__asan_stack_free(p, n, 9);
|
||||
}
|
||||
void __asan_stack_free_10(char *p, size_t n) {
|
||||
__asan_stack_free(p, n, 10);
|
||||
}
|
||||
|
||||
void __asan_load1() {
|
||||
__builtin_trap();
|
||||
}
|
||||
void __asan_load2() {
|
||||
__builtin_trap();
|
||||
}
|
||||
void __asan_load4() {
|
||||
__builtin_trap();
|
||||
}
|
||||
void __asan_load8() {
|
||||
__builtin_trap();
|
||||
}
|
||||
void __asan_load16() {
|
||||
__builtin_trap();
|
||||
}
|
||||
void __asan_load32() {
|
||||
__builtin_trap();
|
||||
}
|
||||
|
||||
void __asan_store1() {
|
||||
__builtin_trap();
|
||||
}
|
||||
void __asan_store2() {
|
||||
__builtin_trap();
|
||||
}
|
||||
void __asan_store4() {
|
||||
__builtin_trap();
|
||||
}
|
||||
void __asan_store8() {
|
||||
__builtin_trap();
|
||||
}
|
||||
void __asan_store16() {
|
||||
__builtin_trap();
|
||||
}
|
||||
void __asan_store32() {
|
||||
__builtin_trap();
|
||||
}
|
|
@ -1,269 +0,0 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
.rodata.cst4
|
||||
__asan_option_detect_stack_use_after_return:
|
||||
.long 0
|
||||
.endobj __asan_option_detect_stack_use_after_return,globl
|
||||
.previous
|
||||
|
||||
__asan_report_load1:
|
||||
push $1
|
||||
jmp 1f
|
||||
.endfn __asan_report_load1,globl
|
||||
__asan_report_load2:
|
||||
push $2
|
||||
jmp 1f
|
||||
.endfn __asan_report_load2,globl
|
||||
__asan_report_load4:
|
||||
push $4
|
||||
jmp 1f
|
||||
.endfn __asan_report_load4,globl
|
||||
__asan_report_load8:
|
||||
push $8
|
||||
jmp 1f
|
||||
.endfn __asan_report_load8,globl
|
||||
__asan_report_load16:
|
||||
push $16
|
||||
jmp 1f
|
||||
.endfn __asan_report_load16,globl
|
||||
__asan_report_load32:
|
||||
push $32
|
||||
1: pop %rsi
|
||||
0: jmp __asan_report_load
|
||||
.endfn __asan_report_load32,globl
|
||||
__asan_report_load_n:
|
||||
jmp 0b
|
||||
.endfn __asan_report_load_n,globl
|
||||
|
||||
__asan_report_store1:
|
||||
push $1
|
||||
jmp 1f
|
||||
.endfn __asan_report_store1,globl
|
||||
__asan_report_store2:
|
||||
push $2
|
||||
jmp 1f
|
||||
.endfn __asan_report_store2,globl
|
||||
__asan_report_store4:
|
||||
push $4
|
||||
jmp 1f
|
||||
.endfn __asan_report_store4,globl
|
||||
__asan_report_store8:
|
||||
push $8
|
||||
jmp 1f
|
||||
.endfn __asan_report_store8,globl
|
||||
__asan_report_store16:
|
||||
push $16
|
||||
jmp 1f
|
||||
.endfn __asan_report_store16,globl
|
||||
__asan_report_store32:
|
||||
push $32
|
||||
1: pop %rsi
|
||||
0: jmp __asan_report_store
|
||||
.endfn __asan_report_store32,globl
|
||||
__asan_report_store_n:
|
||||
jmp 0b
|
||||
.endfn __asan_report_store_n,globl
|
||||
|
||||
__asan_stack_free_0:
|
||||
push $0
|
||||
jmp 1f
|
||||
.endfn __asan_stack_free_0,globl
|
||||
__asan_stack_free_1:
|
||||
push $1
|
||||
jmp 1f
|
||||
.endfn __asan_stack_free_1,globl
|
||||
__asan_stack_free_2:
|
||||
push $2
|
||||
jmp 1f
|
||||
.endfn __asan_stack_free_2,globl
|
||||
__asan_stack_free_3:
|
||||
push $3
|
||||
jmp 1f
|
||||
.endfn __asan_stack_free_3,globl
|
||||
__asan_stack_free_4:
|
||||
push $4
|
||||
jmp 1f
|
||||
.endfn __asan_stack_free_4,globl
|
||||
__asan_stack_free_5:
|
||||
push $5
|
||||
.endfn __asan_stack_free_5,globl
|
||||
__asan_stack_free_hop:
|
||||
1: pop %rdx
|
||||
jmp __asan_stack_free
|
||||
.endfn __asan_report_store_n,globl
|
||||
__asan_stack_free_6:
|
||||
push $6
|
||||
jmp 1b
|
||||
.endfn __asan_stack_free_6,globl
|
||||
__asan_stack_free_7:
|
||||
push $7
|
||||
jmp 1b
|
||||
.endfn __asan_stack_free_7,globl
|
||||
__asan_stack_free_8:
|
||||
push $8
|
||||
jmp 1b
|
||||
.endfn __asan_stack_free_8,globl
|
||||
__asan_stack_free_9:
|
||||
push $9
|
||||
jmp 1b
|
||||
.endfn __asan_stack_free_9,globl
|
||||
__asan_stack_free_10:
|
||||
push $10
|
||||
jmp 1b
|
||||
.endfn __asan_stack_free_10,globl
|
||||
|
||||
__asan_stack_malloc_0:
|
||||
push $0
|
||||
jmp 1f
|
||||
.endfn __asan_stack_malloc_0,globl
|
||||
__asan_stack_malloc_1:
|
||||
push $1
|
||||
jmp 1f
|
||||
.endfn __asan_stack_malloc_1,globl
|
||||
__asan_stack_malloc_2:
|
||||
push $2
|
||||
jmp 1f
|
||||
.endfn __asan_stack_malloc_2,globl
|
||||
__asan_stack_malloc_3:
|
||||
push $3
|
||||
jmp 1f
|
||||
.endfn __asan_stack_malloc_3,globl
|
||||
__asan_stack_malloc_4:
|
||||
push $4
|
||||
jmp 1f
|
||||
.endfn __asan_stack_malloc_4,globl
|
||||
__asan_stack_malloc_5:
|
||||
push $5
|
||||
jmp 1f
|
||||
.endfn __asan_stack_malloc_5,globl
|
||||
__asan_stack_malloc_hop:
|
||||
1: pop %rsi
|
||||
jmp __asan_stack_malloc
|
||||
.endfn __asan_report_store_n,globl
|
||||
__asan_stack_malloc_6:
|
||||
push $6
|
||||
jmp 1b
|
||||
.endfn __asan_stack_malloc_6,globl
|
||||
__asan_stack_malloc_7:
|
||||
push $7
|
||||
jmp 1b
|
||||
.endfn __asan_stack_malloc_7,globl
|
||||
__asan_stack_malloc_8:
|
||||
push $8
|
||||
jmp 1b
|
||||
.endfn __asan_stack_malloc_8,globl
|
||||
__asan_stack_malloc_9:
|
||||
push $9
|
||||
jmp 1b
|
||||
.endfn __asan_stack_malloc_9,globl
|
||||
__asan_stack_malloc_10:
|
||||
push $10
|
||||
jmp 1b
|
||||
.endfn __asan_stack_malloc_10,globl
|
||||
|
||||
__asan_version_mismatch_check_v8:
|
||||
ret
|
||||
.endfn __asan_version_mismatch_check_v8,globl
|
||||
|
||||
// Initializes Address Sanitizer runtime earlier if linked.
|
||||
.init.start 303,_init_asan
|
||||
push %rdi
|
||||
push %rsi
|
||||
mov %r12,%rdi
|
||||
mov %r13,%rsi
|
||||
mov %r14,%rdx
|
||||
mov %r15,%rcx
|
||||
call __asan_init
|
||||
pop %rsi
|
||||
pop %rdi
|
||||
.init.end 303,_init_asan
|
||||
|
||||
__asan_load1:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ud2
|
||||
.endfn __asan_load1,globl
|
||||
|
||||
__asan_load2:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ud2
|
||||
.endfn __asan_load2,globl
|
||||
|
||||
__asan_load4:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ud2
|
||||
.endfn __asan_load4,globl
|
||||
|
||||
__asan_load8:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ud2
|
||||
.endfn __asan_load8,globl
|
||||
|
||||
__asan_load16:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ud2
|
||||
.endfn __asan_load16,globl
|
||||
|
||||
__asan_load32:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ud2
|
||||
.endfn __asan_load32,globl
|
||||
|
||||
__asan_store1:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ud2
|
||||
.endfn __asan_store1,globl
|
||||
|
||||
__asan_store2:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ud2
|
||||
.endfn __asan_store2,globl
|
||||
|
||||
__asan_store4:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ud2
|
||||
.endfn __asan_store4,globl
|
||||
|
||||
__asan_store8:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ud2
|
||||
.endfn __asan_store8,globl
|
||||
|
||||
__asan_store16:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ud2
|
||||
.endfn __asan_store16,globl
|
||||
|
||||
__asan_store32:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ud2
|
||||
.endfn __asan_store32,globl
|
|
@ -1,7 +1,7 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ Copyright 2023 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
|
@ -17,15 +17,5 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
.bss
|
||||
.balign 4
|
||||
__log_level:
|
||||
.long 0
|
||||
.endobj __log_level,globl
|
||||
.previous
|
||||
|
||||
.init.start 200,_init_log_level
|
||||
movb $kLogInfo,__log_level(%rip)
|
||||
.init.end 200,_init_log_level
|
||||
unsigned __log_level = kLogInfo;
|
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/macros.internal.h"
|
||||
|
@ -81,6 +82,10 @@ textstartup void cosmo(long *sp) {
|
|||
argc = __strace_init(argc, argv, envp, auxv);
|
||||
#endif
|
||||
|
||||
#if IsAsan()
|
||||
__asan_init(argc, argv, envp, auxv);
|
||||
#endif
|
||||
|
||||
// set helpful globals
|
||||
__argc = argc;
|
||||
__argv = argv;
|
||||
|
|
|
@ -35,6 +35,7 @@ void __enable_threads(void) _Hide;
|
|||
void *__cxa_finalize(void *) _Hide;
|
||||
void __stack_chk_fail(void) wontreturn relegated;
|
||||
void __stack_chk_fail_local(void) wontreturn relegated _Hide;
|
||||
void __asan_init(int, char **, char **, intptr_t *) _Hide;
|
||||
void _jmpstack(void *, void *, ...) _Hide wontreturn;
|
||||
long _setstack(void *, void *, ...) _Hide;
|
||||
int GetDosArgv(const char16_t *, char *, size_t, char **, size_t);
|
||||
|
|
|
@ -71,6 +71,7 @@ o/$(MODE)/libc/runtime/ftracer.o: private \
|
|||
-ffreestanding \
|
||||
-fno-sanitize=all
|
||||
|
||||
o/$(MODE)/libc/runtime/cosmo2.o \
|
||||
o/$(MODE)/libc/runtime/fork-nt.o \
|
||||
o/$(MODE)/libc/runtime/printmemoryintervals.o \
|
||||
o/$(MODE)/libc/runtime/arememoryintervalsok.o \
|
||||
|
|
|
@ -45,6 +45,9 @@ $(LIBC_STR_A).pkg: \
|
|||
$(LIBC_STR_A_OBJS) \
|
||||
$(foreach x,$(LIBC_STR_A_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
o/$(MODE)/libc/str/wow.o: private \
|
||||
CC = gcc
|
||||
|
||||
o/$(MODE)/libc/str/wmemset.o \
|
||||
o/$(MODE)/libc/str/memset16.o \
|
||||
o/$(MODE)/libc/str/dosdatetimetounix.o: private \
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "libc/macros.internal.h"
|
||||
|
||||
__polluteregisters:
|
||||
#ifdef __x86_64__
|
||||
.leafprologue
|
||||
xor %eax,%eax
|
||||
xor %ecx,%ecx
|
||||
|
@ -48,6 +49,9 @@ __polluteregisters:
|
|||
xorps %xmm6,%xmm6
|
||||
xorps %xmm7,%xmm7
|
||||
.leafepilogue
|
||||
#else
|
||||
ret
|
||||
#endif
|
||||
.endfn __polluteregisters,globl
|
||||
|
||||
.end
|
||||
|
|
|
@ -32,10 +32,10 @@
|
|||
const char *testlib_showerror_errno;
|
||||
const char *testlib_showerror_file;
|
||||
const char *testlib_showerror_func;
|
||||
const char *testlib_showerror_isfatal;
|
||||
const char *testlib_showerror_macro;
|
||||
const char *testlib_showerror_symbol;
|
||||
|
||||
// TODO(jart): Pay off tech debt re duplication
|
||||
void testlib_showerror(const char *file, int line, const char *func,
|
||||
const char *method, const char *symbol, const char *code,
|
||||
char *v1, char *v2) {
|
||||
|
@ -56,12 +56,14 @@ void testlib_showerror(const char *file, int line, const char *func,
|
|||
free(v2);
|
||||
}
|
||||
|
||||
/* TODO(jart): Pay off tech debt re duplication */
|
||||
void testlib_showerror_(int line, const char *wantcode, const char *gotcode,
|
||||
char *FREED_want, char *FREED_got, const char *fmt,
|
||||
...) {
|
||||
static void testlib_showerror_(int line, //
|
||||
const char *wantcode, //
|
||||
const char *gotcode, //
|
||||
char *FREED_want, //
|
||||
char *FREED_got, //
|
||||
const char *fmt, //
|
||||
va_list va) {
|
||||
int e;
|
||||
va_list va;
|
||||
char hostname[128];
|
||||
e = errno;
|
||||
if (gethostname(hostname, sizeof(hostname))) {
|
||||
|
@ -81,9 +83,7 @@ void testlib_showerror_(int line, const char *wantcode, const char *gotcode,
|
|||
}
|
||||
if (!isempty(fmt)) {
|
||||
kprintf("\t");
|
||||
va_start(va, fmt);
|
||||
kvprintf(fmt, va);
|
||||
va_end(va);
|
||||
kprintf("\n");
|
||||
}
|
||||
kprintf("\t%s%s%s\n"
|
||||
|
@ -93,7 +93,128 @@ void testlib_showerror_(int line, const char *wantcode, const char *gotcode,
|
|||
free(FREED_want);
|
||||
free(FREED_got);
|
||||
++g_testlib_failed;
|
||||
if (testlib_showerror_isfatal) {
|
||||
testlib_abort();
|
||||
}
|
||||
}
|
||||
|
||||
void testlib_showerror_assert_eq(int line, //
|
||||
const char *wantcode, //
|
||||
const char *gotcode, //
|
||||
char *FREED_want, //
|
||||
char *FREED_got, //
|
||||
const char *fmt, //
|
||||
...) {
|
||||
va_list va;
|
||||
testlib_showerror_macro = "ASSERT_EQ";
|
||||
testlib_showerror_symbol = "=";
|
||||
va_start(va, fmt);
|
||||
testlib_showerror_(line, wantcode, gotcode, FREED_want, FREED_got, fmt, va);
|
||||
va_end(va);
|
||||
testlib_abort();
|
||||
}
|
||||
|
||||
void testlib_showerror_expect_eq(int line, //
|
||||
const char *wantcode, //
|
||||
const char *gotcode, //
|
||||
char *FREED_want, //
|
||||
char *FREED_got, //
|
||||
const char *fmt, //
|
||||
...) {
|
||||
va_list va;
|
||||
testlib_showerror_macro = "EXPECT_EQ";
|
||||
testlib_showerror_symbol = "=";
|
||||
va_start(va, fmt);
|
||||
testlib_showerror_(line, wantcode, gotcode, FREED_want, FREED_got, fmt, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
void testlib_showerror_assert_ne(int line, //
|
||||
const char *wantcode, //
|
||||
const char *gotcode, //
|
||||
char *FREED_want, //
|
||||
char *FREED_got, //
|
||||
const char *fmt, //
|
||||
...) {
|
||||
va_list va;
|
||||
testlib_showerror_macro = "ASSERT_NE";
|
||||
testlib_showerror_symbol = "≠";
|
||||
va_start(va, fmt);
|
||||
testlib_showerror_(line, wantcode, gotcode, FREED_want, FREED_got, fmt, va);
|
||||
va_end(va);
|
||||
testlib_abort();
|
||||
}
|
||||
|
||||
void testlib_showerror_expect_ne(int line, //
|
||||
const char *wantcode, //
|
||||
const char *gotcode, //
|
||||
char *FREED_want, //
|
||||
char *FREED_got, //
|
||||
const char *fmt, //
|
||||
...) {
|
||||
va_list va;
|
||||
testlib_showerror_macro = "EXPECT_NE";
|
||||
testlib_showerror_symbol = "≠";
|
||||
va_start(va, fmt);
|
||||
testlib_showerror_(line, wantcode, gotcode, FREED_want, FREED_got, fmt, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
void testlib_showerror_assert_true(int line, //
|
||||
const char *wantcode, //
|
||||
const char *gotcode, //
|
||||
char *FREED_want, //
|
||||
char *FREED_got, //
|
||||
const char *fmt, //
|
||||
...) {
|
||||
va_list va;
|
||||
testlib_showerror_macro = "ASSERT_TRUE";
|
||||
testlib_showerror_symbol = "";
|
||||
va_start(va, fmt);
|
||||
testlib_showerror_(line, wantcode, gotcode, FREED_want, FREED_got, fmt, va);
|
||||
va_end(va);
|
||||
testlib_abort();
|
||||
}
|
||||
|
||||
void testlib_showerror_expect_true(int line, //
|
||||
const char *wantcode, //
|
||||
const char *gotcode, //
|
||||
char *FREED_want, //
|
||||
char *FREED_got, //
|
||||
const char *fmt, //
|
||||
...) {
|
||||
va_list va;
|
||||
testlib_showerror_macro = "EXPECT_TRUE";
|
||||
testlib_showerror_symbol = "";
|
||||
va_start(va, fmt);
|
||||
testlib_showerror_(line, wantcode, gotcode, FREED_want, FREED_got, fmt, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
void testlib_showerror_assert_false(int line, //
|
||||
const char *wantcode, //
|
||||
const char *gotcode, //
|
||||
char *FREED_want, //
|
||||
char *FREED_got, //
|
||||
const char *fmt, //
|
||||
...) {
|
||||
va_list va;
|
||||
testlib_showerror_macro = "ASSERT_FALSE";
|
||||
testlib_showerror_symbol = "!";
|
||||
va_start(va, fmt);
|
||||
testlib_showerror_(line, wantcode, gotcode, FREED_want, FREED_got, fmt, va);
|
||||
va_end(va);
|
||||
testlib_abort();
|
||||
}
|
||||
|
||||
void testlib_showerror_expect_false(int line, //
|
||||
const char *wantcode, //
|
||||
const char *gotcode, //
|
||||
char *FREED_want, //
|
||||
char *FREED_got, //
|
||||
const char *fmt, //
|
||||
...) {
|
||||
va_list va;
|
||||
testlib_showerror_macro = "EXPECT_FALSE";
|
||||
testlib_showerror_symbol = "!";
|
||||
va_start(va, fmt);
|
||||
testlib_showerror_(line, wantcode, gotcode, FREED_want, FREED_got, fmt, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
|
|
@ -39,16 +39,6 @@ LIBC_TESTLIB_A_SRCS_S = \
|
|||
libc/testlib/polluteregisters.S \
|
||||
libc/testlib/testcase.S \
|
||||
libc/testlib/thrashcodecache.S \
|
||||
libc/testlib/thunks/assert_eq.S \
|
||||
libc/testlib/thunks/assert_false.S \
|
||||
libc/testlib/thunks/assert_ne.S \
|
||||
libc/testlib/thunks/assert_true.S \
|
||||
libc/testlib/thunks/expect_eq.S \
|
||||
libc/testlib/thunks/expect_false.S \
|
||||
libc/testlib/thunks/expect_ne.S \
|
||||
libc/testlib/thunks/expect_true.S \
|
||||
libc/testlib/thunks/free.S \
|
||||
libc/testlib/thunks/jump.S \
|
||||
libc/testlib/viewables.S
|
||||
|
||||
LIBC_TESTLIB_A_SRCS_C = \
|
||||
|
@ -87,6 +77,7 @@ LIBC_TESTLIB_A_SRCS_C = \
|
|||
libc/testlib/strequals.c \
|
||||
libc/testlib/strerror.c \
|
||||
libc/testlib/testrunner.c \
|
||||
libc/testlib/thunks.c \
|
||||
libc/testlib/waitforexit.c \
|
||||
libc/testlib/waitforterm.c \
|
||||
libc/testlib/yield.c
|
||||
|
@ -118,6 +109,7 @@ LIBC_TESTLIB_A_DIRECTDEPS = \
|
|||
LIBC_TINYMATH \
|
||||
LIBC_X \
|
||||
LIBC_ZIPOS \
|
||||
THIRD_PARTY_COMPILER_RT \
|
||||
THIRD_PARTY_DLMALLOC \
|
||||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_XED
|
||||
|
@ -139,6 +131,28 @@ o/$(MODE)/libc/testlib/viewables.o: libc/testlib/viewables.txt
|
|||
o/$(MODE)/libc/testlib/hyperion.o: libc/testlib/hyperion.txt
|
||||
o/$(MODE)/libc/testlib/moby.o: libc/testlib/moby.txt
|
||||
|
||||
# these assembly files are safe to build on aarch64
|
||||
o/$(MODE)/libc/testlib/bench.o: libc/testlib/bench.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/testlib/blocktronics.o: libc/testlib/blocktronics.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/testlib/combo.o: libc/testlib/combo.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/testlib/fixture.o: libc/testlib/fixture.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/testlib/hyperion.o: libc/testlib/hyperion.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/testlib/moby.o: libc/testlib/moby.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/testlib/polluteregisters.o: libc/testlib/polluteregisters.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/testlib/testcase.o: libc/testlib/testcase.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/testlib/thrashcodecache.o: libc/testlib/thrashcodecache.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/testlib/viewables.o: libc/testlib/viewables.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
|
||||
#───────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
LIBC_TESTLIB_ARTIFACTS += LIBC_TESTLIB_RUNNER_A
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
// Empties L1 instruction cache.
|
||||
thrashcodecache:
|
||||
#ifdef __x86_64__
|
||||
.leafprologue
|
||||
push %rbx
|
||||
xor %eax,%eax
|
||||
|
@ -42,4 +43,7 @@ thrashcodecache:
|
|||
cpuid
|
||||
pop %rbx
|
||||
.leafepilogue
|
||||
#else
|
||||
ret
|
||||
#endif
|
||||
.endfn thrashcodecache,globl
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ Copyright 2023 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
|
@ -16,13 +16,9 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
.text.unlikely
|
||||
testlib_showerror_assert_eq:
|
||||
push $TRUE
|
||||
pushstr "ASSERT_EQ"
|
||||
pushstr "="
|
||||
jmp testlib_showerror_jump
|
||||
.endfn testlib_showerror_assert_eq,globl,hidden
|
||||
.previous
|
||||
void testlib_free(void *p) {
|
||||
free(p);
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
.text.unlikely
|
||||
testlib_showerror_assert_false:
|
||||
push $TRUE
|
||||
pushstr "ASSERT_FALSE"
|
||||
pushstr "!"
|
||||
jmp testlib_showerror_jump
|
||||
.endfn testlib_showerror_assert_false,globl,hidden
|
||||
.previous
|
|
@ -1,28 +0,0 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
.text.unlikely
|
||||
testlib_showerror_assert_ne:
|
||||
push $TRUE
|
||||
pushstr "ASSERT_NE"
|
||||
pushstr "≠"
|
||||
jmp testlib_showerror_jump
|
||||
.endfn testlib_showerror_assert_ne,globl,hidden
|
||||
.previous
|
|
@ -1,28 +0,0 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
.text.unlikely
|
||||
testlib_showerror_assert_true:
|
||||
push $TRUE
|
||||
pushstr "ASSERT_TRUE"
|
||||
pushstr ""
|
||||
jmp testlib_showerror_jump
|
||||
.endfn testlib_showerror_assert_true,globl,hidden
|
||||
.previous
|
|
@ -1,28 +0,0 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
.text.unlikely
|
||||
testlib_showerror_expect_eq:
|
||||
push $FALSE
|
||||
pushstr "EXPECT_EQ"
|
||||
pushstr "="
|
||||
jmp testlib_showerror_jump
|
||||
.endfn testlib_showerror_expect_eq,globl,hidden
|
||||
.previous
|
|
@ -1,28 +0,0 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
.text.unlikely
|
||||
testlib_showerror_expect_false:
|
||||
push $FALSE
|
||||
pushstr "EXPECT_FALSE"
|
||||
pushstr "!"
|
||||
jmp testlib_showerror_jump
|
||||
.endfn testlib_showerror_expect_false,globl,hidden
|
||||
.previous
|
|
@ -1,28 +0,0 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
.text.unlikely
|
||||
testlib_showerror_expect_ne:
|
||||
push $FALSE
|
||||
pushstr "EXPECT_NE"
|
||||
pushstr "≠"
|
||||
jmp testlib_showerror_jump
|
||||
.endfn testlib_showerror_expect_ne,globl,hidden
|
||||
.previous
|
|
@ -1,28 +0,0 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
.text.unlikely
|
||||
testlib_showerror_expect_true:
|
||||
push $FALSE
|
||||
pushstr "EXPECT_TRUE"
|
||||
pushstr ""
|
||||
jmp testlib_showerror_jump
|
||||
.endfn testlib_showerror_expect_true,globl,hidden
|
||||
.previous
|
|
@ -1,28 +0,0 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
.text.unlikely
|
||||
testlib_showerror_jump:
|
||||
popstr testlib_showerror_symbol(%rip)
|
||||
popstr testlib_showerror_macro(%rip)
|
||||
pop testlib_showerror_isfatal(%rip)
|
||||
jmp testlib_showerror_
|
||||
.endfn testlib_showerror_jump,globl,hidden
|
||||
.previous
|
|
@ -54,6 +54,16 @@ float roundf(float x)
|
|||
asm("frinta\t%s0,%s1" : "=w"(x) : "w"(x));
|
||||
return x;
|
||||
|
||||
#elif defined(__powerpc64__) && defined(_ARCH_PWR5X)
|
||||
|
||||
asm("frin\t%0,%1" : "=f"(x) : "f"(x));
|
||||
return x;
|
||||
|
||||
#elif defined(__s390x__) && (defined(__HTM__) || __ARCH__ >= 9)
|
||||
|
||||
asm("fiebra\t%0,1,%1,4" : "=f"(x) : "f"(x));
|
||||
return x;
|
||||
|
||||
#else
|
||||
|
||||
union {float f; uint32_t i;} u = {x};
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include "libc/calls/struct/iovec.internal.h"
|
||||
#include "libc/vga/vga.internal.h"
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
ssize_t sys_readv_vga(struct Fd *fd, const struct iovec *iov, int iovlen) {
|
||||
/*
|
||||
* NOTE: this routine is always non-blocking.
|
||||
|
@ -52,3 +54,5 @@ ssize_t sys_readv_vga(struct Fd *fd, const struct iovec *iov, int iovlen) {
|
|||
if (!redd) return res;
|
||||
return redd;
|
||||
}
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include "libc/str/str.h"
|
||||
#include "libc/vga/vga.internal.h"
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
/*
|
||||
* @fileoverview Instantiation of routines for emergency or system console
|
||||
* output in graphical video modes.
|
||||
|
@ -95,3 +97,5 @@ privileged void _klog_vga(const char *b, size_t n) {
|
|||
klog_y = _TtyGetY(&tty);
|
||||
klog_x = _TtyGetX(&tty);
|
||||
}
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include "libc/str/str.h"
|
||||
#include "libc/vga/vga.internal.h"
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
struct Tty _vga_tty;
|
||||
|
||||
void _vga_reinit(struct Tty *tty, unsigned short starty, unsigned short startx,
|
||||
|
@ -70,3 +72,5 @@ textstartup void _vga_init(void) {
|
|||
_vga_reinit(&_vga_tty, starty, startx, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include "libc/dce.h"
|
||||
#include "libc/vga/vga.internal.h"
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
ssize_t sys_writev_vga(struct Fd *fd, const struct iovec *iov, int iovlen) {
|
||||
size_t i, wrote = 0;
|
||||
ssize_t res = 0;
|
||||
|
@ -44,3 +46,5 @@ ssize_t sys_writev_vga(struct Fd *fd, const struct iovec *iov, int iovlen) {
|
|||
if (!wrote) return res;
|
||||
return wrote;
|
||||
}
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue