mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-04 12:44:52 +00:00
Add VirtualAlloc2 WIN32 API
This commit is contained in:
parent
9ea64725b6
commit
06d916b449
3 changed files with 25 additions and 0 deletions
18
libc/nt/kernel32/VirtualAlloc2.S
Normal file
18
libc/nt/kernel32/VirtualAlloc2.S
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#include "libc/nt/codegen.h"
|
||||||
|
.imp kernel32,__imp_VirtualAlloc2,VirtualAlloc2
|
||||||
|
|
||||||
|
.text.windows
|
||||||
|
.ftrace1
|
||||||
|
VirtualAlloc2:
|
||||||
|
.ftrace2
|
||||||
|
#ifdef __x86_64__
|
||||||
|
push %rbp
|
||||||
|
mov %rsp,%rbp
|
||||||
|
mov __imp_VirtualAlloc2(%rip),%rax
|
||||||
|
jmp __sysv2nt8
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
mov x0,#0
|
||||||
|
ret
|
||||||
|
#endif
|
||||||
|
.endfn VirtualAlloc2,globl
|
||||||
|
.previous
|
|
@ -296,6 +296,7 @@ imp 'UnmapViewOfFile2' UnmapViewOfFile2 kernel32 2
|
||||||
imp 'UnmapViewOfFileEx' UnmapViewOfFileEx kernel32 3
|
imp 'UnmapViewOfFileEx' UnmapViewOfFileEx kernel32 3
|
||||||
imp 'UpdateProcThreadAttribute' UpdateProcThreadAttribute kernel32 7
|
imp 'UpdateProcThreadAttribute' UpdateProcThreadAttribute kernel32 7
|
||||||
imp 'VirtualAlloc' VirtualAlloc kernel32 4
|
imp 'VirtualAlloc' VirtualAlloc kernel32 4
|
||||||
|
imp 'VirtualAlloc2' VirtualAlloc2 kernel32 7
|
||||||
imp 'VirtualAllocEx' VirtualAllocEx kernel32 5
|
imp 'VirtualAllocEx' VirtualAllocEx kernel32 5
|
||||||
imp 'VirtualFree' VirtualFree kernel32 3
|
imp 'VirtualFree' VirtualFree kernel32 3
|
||||||
imp 'VirtualLock' VirtualLock kernel32 2
|
imp 'VirtualLock' VirtualLock kernel32 2
|
||||||
|
|
|
@ -96,6 +96,12 @@ void *MapViewOfFile3(
|
||||||
struct NtMemExtendedParameter *in_out_opt_ExtendedParameters,
|
struct NtMemExtendedParameter *in_out_opt_ExtendedParameters,
|
||||||
unsigned ParameterCount);
|
unsigned ParameterCount);
|
||||||
|
|
||||||
|
void *VirtualAlloc2(
|
||||||
|
intptr_t opt_Process, void *opt_BaseAddress, size_t Size,
|
||||||
|
unsigned AllocationType, unsigned PageProtection,
|
||||||
|
struct NtMemExtendedParameter *in_out_opt_ExtendedParameters,
|
||||||
|
unsigned ParameterCount);
|
||||||
|
|
||||||
#if ShouldUseMsabiAttribute()
|
#if ShouldUseMsabiAttribute()
|
||||||
#include "libc/nt/thunk/memory.inc"
|
#include "libc/nt/thunk/memory.inc"
|
||||||
#endif /* ShouldUseMsabiAttribute() */
|
#endif /* ShouldUseMsabiAttribute() */
|
||||||
|
|
Loading…
Add table
Reference in a new issue