mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Removed the use of temp allocator in backtrace printing.
Added string::bformat.
This commit is contained in:
committed by
Christoffer Lerno
parent
6c7dc2a28e
commit
e755c36ea2
41
lib/std/os/win32/memoryapi.c3
Normal file
41
lib/std/os/win32/memoryapi.c3
Normal file
@@ -0,0 +1,41 @@
|
||||
module std::os::win32 @if(env::WIN32);
|
||||
|
||||
enum Win32_AllocationType : const Win32_DWORD
|
||||
{
|
||||
MEM_COMMIT = 0x00001000,
|
||||
MEM_RESERVE = 0x00002000,
|
||||
MEM_RESET = 0x00080000,
|
||||
MEM_RESET_UNDO = 0x01000000,
|
||||
MEM_LARGE_PAGES = 0x20000000,
|
||||
MEM_PHYSICAL = 0x00400000,
|
||||
MEM_TOP_DOWN = 0x00100000,
|
||||
MEM_WRITE_WATCH = 0x00200000
|
||||
}
|
||||
|
||||
enum Win32_Protect : const Win32_DWORD
|
||||
{
|
||||
PAGE_EXECUTE = 0x10,
|
||||
PAGE_EXECUTE_READ = 0x20,
|
||||
PAGE_EXECUTE_READWRITE = 0x40,
|
||||
PAGE_EXECUTE_WRITECOPY = 0x80,
|
||||
PAGE_NOACCESS = 0x01,
|
||||
PAGE_READONLY = 0x02,
|
||||
PAGE_READWRITE = 0x04,
|
||||
PAGE_WRITECOPY = 0x08,
|
||||
PAGE_TARGETS_INVALID = 0x40000000,
|
||||
PAGE_TARGETS_NO_UPDATE = 0x40000000,
|
||||
PAGE_GUARD = 0x100,
|
||||
PAGE_NOCACHE = 0x200,
|
||||
PAGE_WRITECOMBINE = 0x400,
|
||||
}
|
||||
|
||||
enum Win32_FreeType : const Win32_DWORD
|
||||
{
|
||||
MEM_DECOMMIT = 0x00004000,
|
||||
MEM_RELEASE = 0x00008000,
|
||||
MEM_COALESCE_PLACEHOLDERS = 0x00000001,
|
||||
MEM_PRESERVE_PLACEHOLDER = 0x00000002,
|
||||
}
|
||||
extern fn Win32_LPVOID virtualAlloc(Win32_LPVOID lpAddres, Win32_SIZE_T dwSize, Win32_AllocationType flAllocationType, Win32_DWORD flProtect) @extern("VirtualAlloc");
|
||||
extern fn Win32_PVOID virtualAlloc2(Win32_HANDLE process, Win32_PVOID baseAddress, Win32_SIZE_T size, Win32_AllocationType allocationType, Win32_ULONG pageProtection, Win32_MEM_EXTENDED_PARAMETER* extendedParameters, Win32_ULONG parameterCount) @extern("VirtualAlloc2");
|
||||
extern fn Win32_BOOL virtualFree(Win32_LPVOID lpAddress, Win32_SIZE_T dwSize, Win32_FreeType dwFreeType) @extern("VirtualFree");
|
||||
37
lib/std/os/win32/winnt.c3
Normal file
37
lib/std/os/win32/winnt.c3
Normal file
@@ -0,0 +1,37 @@
|
||||
module std::os::win32 @if(env::WIN32);
|
||||
|
||||
enum Win32_MEM_EXTENDED_PARAMETER_TYPE : CInt
|
||||
{
|
||||
INVALID_TYPE,
|
||||
ADDRESS_REQUIREMENTS,
|
||||
NUMA_NODE,
|
||||
PARTITION_HANDLE,
|
||||
USER_PHYSICAL_HANDLE,
|
||||
ATTRIBUTE_FLAGS,
|
||||
IMAGE_MACHINE,
|
||||
MAX
|
||||
}
|
||||
alias Win32_PMEM_EXTENDED_PARAMETER_TYPE = Win32_MEM_EXTENDED_PARAMETER_TYPE;
|
||||
|
||||
enum Win32_MEM_EXTENDED_PARAMETER_ATTRIBUTE : const Win32_DWORD64
|
||||
{
|
||||
NONPAGED = 0x02, // The allocation is non-pageable.
|
||||
NONPAGED_LARGE = 0x08, // The allocation is mapped using large pages.
|
||||
NONPAGED_HUGE = 0x10, // The allocation is mapped using huge pages.
|
||||
EC_CODE = 0x40, // The allocation will contain emulation-compatible (EC) code.
|
||||
}
|
||||
|
||||
struct Win32_MEM_EXTENDED_PARAMETER
|
||||
{
|
||||
Win32_MEM_EXTENDED_PARAMETER_TYPE type;
|
||||
union
|
||||
{
|
||||
Win32_MEM_EXTENDED_PARAMETER_ATTRIBUTE attribute; // If type is ATTRIBUTE_FLAGS
|
||||
Win32_DWORD64 nodeNumber; // If type is NUMA_NODE
|
||||
Win32_PVOID pointer; // If type is ADDRESS_REQUIREMENTS
|
||||
Win32_SIZE_T size;
|
||||
Win32_HANDLE handle;
|
||||
Win32_DWORD uLong;
|
||||
}
|
||||
}
|
||||
alias Win32_PMEM_EXTENDED_PARAMETER = Win32_MEM_EXTENDED_PARAMETER*;
|
||||
Reference in New Issue
Block a user