mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-28 13:30:29 +00:00
Get address sanitizer mostly working
This commit is contained in:
parent
1f1f3cd477
commit
7327c345f9
149 changed files with 3777 additions and 3457 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,10 +1,9 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NEXGEN32E_GC_H_
|
||||
#define COSMOPOLITAN_LIBC_NEXGEN32E_GC_H_
|
||||
#include "libc/nexgen32e/stackframe.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct StackFrame;
|
||||
|
||||
struct Garbages {
|
||||
size_t i, n;
|
||||
struct Garbage {
|
||||
|
|
|
@ -25,9 +25,8 @@
|
|||
world's most popular function──one all programmers love.
|
||||
|
||||
This implementation is the fastest and nearly the tiniest too.
|
||||
It doesn't clobber general registers. It won't break down on old
|
||||
computers or misaligned data. It's so easy that even a child
|
||||
could use it──and they do.
|
||||
It doesn't break when copying backwards or on misaligned data.
|
||||
It's so easy that even a child could use it, and they do.
|
||||
*/
|
||||
#include "libc/nexgen32e/x86feature.h"
|
||||
#include "libc/macros.h"
|
||||
|
@ -53,11 +52,10 @@ memcpy: mov %rdi,%rax
|
|||
/ @param rdi is dest
|
||||
/ @param rsi is src
|
||||
/ @param rdx is number of bytes
|
||||
/ @clob flags,xmm3,xmm4
|
||||
/ @clob flags,rcx,xmm3,xmm4
|
||||
/ @mode long
|
||||
.align 16
|
||||
MemCpy: .leafprologue
|
||||
push %rcx
|
||||
mov $.Lmemcpytab.ro.size,%ecx
|
||||
cmp %rcx,%rdx
|
||||
cmovb %rdx,%rcx
|
||||
|
@ -95,8 +93,7 @@ MemCpy: .leafprologue
|
|||
mov %rcx,(%rdi)
|
||||
mov %rbx,-8(%rdi,%rdx)
|
||||
1: pop %rbx
|
||||
.L0: pop %rcx
|
||||
.leafepilogue
|
||||
.L0: .leafepilogue
|
||||
.L4: push %rbx
|
||||
mov (%rsi),%ecx
|
||||
mov -4(%rsi,%rdx),%ebx
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
/ @param rsi is src
|
||||
/ @param rdx is number of bytes
|
||||
/ @return original rdi copied to rax
|
||||
/ @clob flags,rcx
|
||||
/ @asyncsignalsafe
|
||||
memmove:
|
||||
mov %rdi,%rax
|
||||
|
@ -36,7 +37,6 @@ memmove:
|
|||
MemMove:
|
||||
.leafprologue
|
||||
.profilable
|
||||
push %rcx
|
||||
push %rdi
|
||||
push %rsi
|
||||
mov %rdx,%rcx
|
||||
|
@ -49,7 +49,6 @@ MemMove:
|
|||
cld
|
||||
pop %rsi
|
||||
pop %rdi
|
||||
pop %rcx
|
||||
.leafepilogue
|
||||
.endfn memmove,globl
|
||||
.source __FILE__
|
||||
|
|
|
@ -43,12 +43,11 @@ memset: mov %rdi,%rax
|
|||
/ @param rdi is dest
|
||||
/ @param esi is the byte to set
|
||||
/ @param edx is the number of bytes to set
|
||||
/ @clob flags,xmm3
|
||||
/ @clob flags,rcx,xmm3
|
||||
/ @mode long
|
||||
MemSet: .leafprologue
|
||||
.profilable
|
||||
push %rbx
|
||||
push %rcx
|
||||
movd %esi,%xmm3
|
||||
mov $.Lmemsettab.ro.size,%ecx
|
||||
cmp %rcx,%rdx
|
||||
|
@ -77,8 +76,7 @@ MemSet: .leafprologue
|
|||
ja 1b
|
||||
movdqu %xmm3,-16(%rdi,%rdx)
|
||||
pxor %xmm3,%xmm3
|
||||
.L0: pop %rcx
|
||||
pop %rbx
|
||||
.L0: pop %rbx
|
||||
.leafepilogue
|
||||
.L8: movzbq %sil,%rbx
|
||||
mov $0x0101010101010101,%rcx
|
||||
|
|
13
libc/nexgen32e/stackframe.h
Normal file
13
libc/nexgen32e/stackframe.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NEXGEN32E_STACKFRAME_H_
|
||||
#define COSMOPOLITAN_LIBC_NEXGEN32E_STACKFRAME_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct StackFrame {
|
||||
struct StackFrame *next;
|
||||
intptr_t addr;
|
||||
};
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NEXGEN32E_STACKFRAME_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue