Get Redbean fork() working on the New Technology

Now that we have understandable system call tracing on Windows, this
change rewrites many of the polyfill internals for that platform, to
help things get closer to tip top shape. Support for complex forking
scenarios had been in a regressed state for quite some time. Now, it
works! Subsequent changes should be able to address the performance.
This commit is contained in:
Justine Tunney 2022-03-20 08:01:14 -07:00
parent efedef6e65
commit 0cb6b6ff4b
84 changed files with 1340 additions and 338 deletions

View file

@ -2,11 +2,11 @@
.imp kernel32,__imp_CreateFileMappingNumaW,CreateFileMappingNumaW,0
.text.windows
CreateFileMappingNuma:
__CreateFileMappingNuma:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_CreateFileMappingNumaW(%rip),%rax
jmp __sysv2nt8
.endfn CreateFileMappingNuma,globl
.endfn __CreateFileMappingNuma,globl
.previous

View file

@ -2,11 +2,11 @@
.imp kernel32,__imp_CreateFileW,CreateFileW,0
.text.windows
CreateFile:
__CreateFile:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_CreateFileW(%rip),%rax
jmp __sysv2nt8
.endfn CreateFile,globl
.endfn __CreateFile,globl
.previous

View file

@ -1,2 +1,14 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_GetProcessHeap,GetProcessHeap,0
.text.windows
GetProcessHeap:
push %rbp
mov %rsp,%rbp
.profilable
sub $32,%rsp
call *__imp_GetProcessHeap(%rip)
leave
ret
.endfn GetProcessHeap,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_GetProcessHeaps,GetProcessHeaps,0
.text.windows
GetProcessHeaps:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_GetProcessHeaps(%rip),%rax
jmp __sysv2nt
.endfn GetProcessHeaps,globl
.previous

View file

@ -0,0 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_HeapAlloc,HeapAlloc,0
.text.windows
HeapAlloc:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_HeapAlloc(%rip),%rax
jmp __sysv2nt
.endfn HeapAlloc,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_HeapCompact,HeapCompact,0
.text.windows
HeapCompact:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_HeapCompact(%rip),%rax
jmp __sysv2nt
.endfn HeapCompact,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_HeapCreate,HeapCreate,0
.text.windows
HeapCreate:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_HeapCreate(%rip),%rax
jmp __sysv2nt
.endfn HeapCreate,globl
.previous

View file

@ -1,2 +1,15 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_HeapDestroy,HeapDestroy,0
.text.windows
HeapDestroy:
push %rbp
mov %rsp,%rbp
.profilable
mov %rdi,%rcx
sub $32,%rsp
call *__imp_HeapDestroy(%rip)
leave
ret
.endfn HeapDestroy,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_HeapFree,HeapFree,847
.text.windows
HeapFree:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_HeapFree(%rip),%rax
jmp __sysv2nt
.endfn HeapFree,globl
.previous

View file

@ -0,0 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_HeapReAlloc,HeapReAlloc,0
.text.windows
HeapReAlloc:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_HeapReAlloc(%rip),%rax
jmp __sysv2nt
.endfn HeapReAlloc,globl
.previous

View file

@ -2,11 +2,11 @@
.imp kernel32,__imp_MapViewOfFileExNuma,MapViewOfFileExNuma,0
.text.windows
MapViewOfFileExNuma:
__MapViewOfFileExNuma:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_MapViewOfFileExNuma(%rip),%rax
jmp __sysv2nt8
.endfn MapViewOfFileExNuma,globl
.endfn __MapViewOfFileExNuma,globl
.previous

View file

@ -2,11 +2,11 @@
.imp kernel32,__imp_VirtualProtect,VirtualProtect,0
.text.windows
VirtualProtect:
__VirtualProtect:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_VirtualProtect(%rip),%rax
jmp __sysv2nt
.endfn VirtualProtect,globl
.endfn __VirtualProtect,globl
.previous