mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 11:48:30 +00:00
Fix more things
- Update a couple unicode data files - Disable strace during logger calls - SQLite now uses pread() / pwrite() - pread() past EOF on NT now returns 0 - Make the NT mmap() and fork() code elegant - Give NT a big performance boost with memory - Add many more mmap() tests to prove it works
This commit is contained in:
parent
b90fa996b4
commit
98909b1391
36 changed files with 1034 additions and 318 deletions
|
@ -29,41 +29,50 @@
|
|||
// @noreturn
|
||||
_start:
|
||||
|
||||
// Get startup timestamp as early as possible.
|
||||
// Used by --strace flag and kprintf() %T.
|
||||
rdtsc
|
||||
ezlea kStartTsc,bx
|
||||
mov %eax,(%rbx)
|
||||
mov %edx,4(%rbx)
|
||||
|
||||
#if SupportsFreebsd()
|
||||
// detect free besiyata dishmaya
|
||||
test %rdi,%rdi
|
||||
cmovnz %rdi,%rsp
|
||||
jz 0f
|
||||
movb $FREEBSD,__hostos(%rip)
|
||||
#endif
|
||||
|
||||
0: mov (%rsp),%ebx # argc
|
||||
// get startup timestamp as early as possible
|
||||
// its used by --strace flag and kprintf() %T
|
||||
0: rdtsc
|
||||
ezlea kStartTsc,bx
|
||||
mov %eax,(%rbx)
|
||||
mov %edx,4(%rbx)
|
||||
|
||||
// translates arguments from old stack abi
|
||||
mov (%rsp),%ebx # argc
|
||||
lea 8(%rsp),%rsi # argv
|
||||
lea 16(%rsp,%rbx,8),%rdx # envp
|
||||
mov %rsp,__oldstack(%rip)
|
||||
and $-16,%rsp
|
||||
xor %ebp,%ebp
|
||||
// bofram 9f
|
||||
|
||||
// make win32 imps noop
|
||||
.weak ape_idata_iat
|
||||
.weak ape_idata_iatend
|
||||
ezlea missingno,ax # make win32 imps noop
|
||||
ezlea missingno,ax
|
||||
ezlea ape_idata_iat,di
|
||||
ezlea ape_idata_iatend,cx
|
||||
sub %rdi,%rcx
|
||||
shr $3,%ecx
|
||||
rep stosq
|
||||
xor %eax,%eax # find end of environ
|
||||
|
||||
// scan through environment varis
|
||||
// find start of auxiliary values
|
||||
xor %eax,%eax
|
||||
or $-1,%ecx
|
||||
mov %rdx,%rdi
|
||||
repnz scasq
|
||||
mov %rdi,%rcx # auxv
|
||||
|
||||
#if SupportsXnu()
|
||||
// should probably be removed in favor of newer apis
|
||||
testb IsXnu()
|
||||
jz 1f # polyfill xnu auxv
|
||||
push $0 # auxv[1][1]=0
|
||||
|
@ -74,9 +83,11 @@ _start:
|
|||
push $31 # auxv[0][0]=AT_EXECFN
|
||||
mov %rsp,%rcx # auxv
|
||||
#endif
|
||||
|
||||
// enter cosmopolitan runtime
|
||||
1: mov %ebx,%edi
|
||||
call cosmo
|
||||
9: ud2
|
||||
9: .unreachable
|
||||
.endfn _start,weak,hidden
|
||||
|
||||
#if SupportsXnu()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue