mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 20:28:30 +00:00
Fix stack memory, undefined behavior, etc.
This commit is contained in:
parent
110559ce6a
commit
507d7a0b0b
11 changed files with 41 additions and 186 deletions
|
@ -67,16 +67,11 @@ _start:
|
|||
lea 16(%rsp,%rbx,8),%rdx // envp
|
||||
mov %rsp,__oldstack(%rip)
|
||||
|
||||
// setup a stack frame
|
||||
// align stack to GetStackSize() so GetStackAddr() is fast
|
||||
.weak ape_stack_memsz
|
||||
mov $ape_stack_memsz,%r9d
|
||||
mov $16,%r8d
|
||||
test %r9d,%r9d
|
||||
cmovnz %r9,%r8
|
||||
neg %r8
|
||||
and %r8,%rsp
|
||||
// setup backtraces
|
||||
xor %ebp,%ebp
|
||||
|
||||
// make process stack (8mb) follow thread stack (256kb) alignment
|
||||
and $-(256*1024),%rsp
|
||||
// bofram 9f
|
||||
|
||||
#if SupportsWindows()
|
||||
|
@ -126,6 +121,10 @@ _start:
|
|||
// this is the first argument to cosmo() below
|
||||
mov x0,sp
|
||||
|
||||
// make process stack (8mb) conform to thread stack (256kb) alignment
|
||||
mov x1,sp
|
||||
and sp,x1,-(256*1024)
|
||||
|
||||
// second arg shall be struct Syslib passed by ape-m1.c
|
||||
// used to talk to apple's authoritarian libraries
|
||||
// should be set to zero on other platforms
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue