mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-24 11:30:29 +00:00
Make improvements
- Fix unused local variable errors - Remove yoinks from sigaction() header - Add nox87 and aarch64 to github actions - Fix cosmocc -fportcosmo in linking mode - It's now possible to build `make m=llvm o/llvm/libc`
This commit is contained in:
parent
3dc86ce154
commit
f7ae50462a
118 changed files with 342 additions and 392 deletions
33
libc/intrin/getcpuidbrand.S
Normal file
33
libc/intrin/getcpuidbrand.S
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*-*- 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 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. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
GetCpuidBrand:
|
||||
mov %esi,%eax
|
||||
xor %ecx,%ecx
|
||||
push %rbx
|
||||
cpuid
|
||||
mov %ebx,0(%rdi)
|
||||
mov %ecx,4(%rdi)
|
||||
mov %edx,8(%rdi)
|
||||
movb $0,12(%rdi)
|
||||
pop %rbx
|
||||
movb $0,12(%rdi)
|
||||
ret
|
||||
.endfn GetCpuidBrand,globl
|
|
@ -160,7 +160,7 @@ void *memset(void *p, int c, size_t n) {
|
|||
return b;
|
||||
#ifdef __x86__
|
||||
} else if (IsTiny()) {
|
||||
asm("rep stosb" : "+D"(b), "+c"(n), "=m"(*(char(*)[n])b) : "0"(p), "a"(c));
|
||||
asm("rep stosb" : "+D"(b), "+c"(n), "=m"(*(char(*)[n])b) : "a"(c));
|
||||
return p;
|
||||
} else if (X86_HAVE(AVX)) {
|
||||
return memset_avx(b, c, n);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*-*- 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 │
|
||||
│ 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 │
|
||||
|
@ -16,22 +16,11 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/runtime/internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#ifdef __x86_64__
|
||||
|
||||
void GetCpuidBrand(char s[13], uint32_t leaf) {
|
||||
int ax, cx;
|
||||
asm("push\t%%rbx\r\n"
|
||||
"cpuid\r\n"
|
||||
"mov\t%%ebx,0+%2\r\n"
|
||||
"mov\t%%ecx,4+%2\r\n"
|
||||
"mov\t%%edx,8+%2\r\n"
|
||||
"movb\t$0,12+%2\r\n"
|
||||
"pop\t%%rbx"
|
||||
: "=a"(ax), "=c"(cx), "=o"(*(char(*)[13])s)
|
||||
: "0"(leaf), "1"(0)
|
||||
: "rdx");
|
||||
s[12] = 0;
|
||||
__attribute__((__weak__)) void __stack_chk_fail(void) {
|
||||
kprintf("%s: stack smashed\n", program_invocation_name);
|
||||
__builtin_trap();
|
||||
}
|
||||
|
||||
#endif /* __x86_64__ */
|
23
libc/intrin/stackchkfaillocal.c
Normal file
23
libc/intrin/stackchkfaillocal.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*-*- 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 │
|
||||
│ │
|
||||
│ 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/runtime/internal.h"
|
||||
|
||||
__attribute__((__weak__)) void __stack_chk_fail_local(void) {
|
||||
__stack_chk_fail();
|
||||
}
|
14
libc/intrin/udivti3.c
Normal file
14
libc/intrin/udivti3.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#if 0
|
||||
/*─────────────────────────────────────────────────────────────────╗
|
||||
│ To the extent possible under law, Justine Tunney has waived │
|
||||
│ all copyright and related or neighboring rights to division, │
|
||||
│ as it is written in the following disclaimers: │
|
||||
│ • http://unlicense.org/ │
|
||||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||
╚─────────────────────────────────────────────────────────────────*/
|
||||
#endif
|
||||
#include "third_party/compiler_rt/int_lib.h"
|
||||
|
||||
COMPILER_RT_ABI tu_int __udivti3(tu_int a, tu_int b) {
|
||||
return __udivmodti4(a, b, NULL);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue