mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-26 20:40:28 +00:00
Make improvements
- Polyfill readlink("foo/") dir check on Windows - Support asynchronous signal delivery on Windows - Restore Windows Console from execve() daisy chain - Work around bug in AARCH64 Optimized Routines memcmp() - Disable unbourne.com shell completion on Windows for now - Don't always set virtual terminal input state on console - Remove Musl Libc's unusual preservation of realpath("//") - Make realpath() strongly link malloc() to pass configure test - Delete cosh.com shell, now that unbourne.com works on Windows!
This commit is contained in:
parent
f9c9a323fe
commit
425c055116
40 changed files with 581 additions and 706 deletions
21
libc/nt/enum/context.h
Normal file
21
libc/nt/enum/context.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_CONTEXT_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_ENUM_CONTEXT_H_
|
||||
|
||||
#define kNtContextAmd64 0x00100000
|
||||
|
||||
#define kNtContextControl (kNtContextAmd64 | 0x00000001)
|
||||
#define kNtContextInteger (kNtContextAmd64 | 0x00000002)
|
||||
#define kNtContextSegments (kNtContextAmd64 | 0x00000004)
|
||||
#define kNtContextFloatingPoint (kNtContextAmd64 | 0x00000008)
|
||||
#define kNtContextDebugRegisters (kNtContextAmd64 | 0x00000010)
|
||||
|
||||
#define kNtContextFull \
|
||||
(kNtContextControl | kNtContextInteger | kNtContextFloatingPoint)
|
||||
|
||||
#define kNtContextAll \
|
||||
(kNtContextControl | kNtContextInteger | kNtContextSegments | \
|
||||
kNtContextFloatingPoint | kNtContextDebugRegisters)
|
||||
|
||||
#define kNtContextXstate (kNtContextAmd64 | 0x00000040)
|
||||
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_CONTEXT_H_ */
|
18
libc/nt/kernel32/GetThreadContext.S
Normal file
18
libc/nt/kernel32/GetThreadContext.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp kernel32,__imp_GetThreadContext,GetThreadContext
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
GetThreadContext:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_GetThreadContext(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn GetThreadContext,globl
|
||||
.previous
|
18
libc/nt/kernel32/InitializeContext.S
Normal file
18
libc/nt/kernel32/InitializeContext.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp kernel32,__imp_InitializeContext,InitializeContext
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
InitializeContext:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_InitializeContext(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn InitializeContext,globl
|
||||
.previous
|
20
libc/nt/kernel32/ResumeThread.S
Normal file
20
libc/nt/kernel32/ResumeThread.S
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp kernel32,__imp_ResumeThread,ResumeThread
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
ResumeThread:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_ResumeThread(%rip)
|
||||
leave
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
#endif
|
||||
ret
|
||||
.endfn ResumeThread,globl
|
||||
.previous
|
|
@ -11,9 +11,9 @@
|
|||
# Name Actual DLL Arity
|
||||
imp '' CloseHandle kernel32 1
|
||||
imp '' CreateDirectoryW kernel32 2
|
||||
imp '' CreateFileA kernel32 7
|
||||
imp '' CreateFileMappingNumaW kernel32 7
|
||||
imp '' CreateFileMappingW kernel32 6
|
||||
imp '' CreateFileA kernel32 7
|
||||
imp '' CreateFileW kernel32 7
|
||||
imp '' CreateNamedPipeW kernel32 8
|
||||
imp '' CreatePipe kernel32 4
|
||||
|
@ -162,6 +162,7 @@ imp 'GetSystemTimePreciseAsFileTime' GetSystemTimePreciseAsFileTime kernel3
|
|||
imp 'GetSystemTimes' GetSystemTimes kernel32 3
|
||||
imp 'GetTempPath' GetTempPathW kernel32 2
|
||||
imp 'GetTempPathA' GetTempPathA kernel32 2
|
||||
imp 'GetThreadContext' GetThreadContext kernel32 2
|
||||
imp 'GetThreadIOPendingFlag' GetThreadIOPendingFlag kernel32 2
|
||||
imp 'GetThreadId' GetThreadId kernel32 1
|
||||
imp 'GetThreadPriority' GetThreadPriority kernel32 1
|
||||
|
@ -182,6 +183,7 @@ imp 'HeapCreate' HeapCreate kernel32 3
|
|||
imp 'HeapDestroy' HeapDestroy kernel32 1
|
||||
imp 'HeapFree' HeapFree kernel32 3
|
||||
imp 'HeapReAlloc' HeapReAlloc kernel32 4
|
||||
imp 'InitializeContext' InitializeContext kernel32 4 # Windows 7+
|
||||
imp 'InitializeCriticalSection' InitializeCriticalSection kernel32 1
|
||||
imp 'InitializeCriticalSectionAndSpinCount' InitializeCriticalSectionAndSpinCount kernel32 2
|
||||
imp 'InitializeProcThreadAttributeList' InitializeProcThreadAttributeList kernel32 4
|
||||
|
@ -223,6 +225,7 @@ imp 'ReleaseSemaphore' ReleaseSemaphore kernel32 3
|
|||
imp 'RemoveVectoredContinueHandler' RemoveVectoredContinueHandler kernel32 1
|
||||
imp 'RemoveVectoredExceptionHandler' RemoveVectoredExceptionHandler kernel32 1
|
||||
imp 'ResetEvent' ResetEvent kernel32 1
|
||||
imp 'ResumeThread' ResumeThread kernel32 1
|
||||
imp 'SetConsoleActiveScreenBuffer' SetConsoleActiveScreenBuffer kernel32 1 # TODO(jart): 6.2 and higher
|
||||
imp 'SetConsoleCP' SetConsoleCP kernel32 1 # TODO(jart): 6.2 and higher
|
||||
imp 'SetConsoleCtrlHandler' SetConsoleCtrlHandler kernel32 2
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_THREADS_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_THREADS_H_
|
||||
#include "libc/nt/struct/context.h"
|
||||
#include "libc/nt/struct/overlapped.h"
|
||||
#include "libc/nt/struct/securityattributes.h"
|
||||
#include "libc/nt/thunk/msabi.h"
|
||||
|
@ -60,6 +61,10 @@ bool32 TlsFree(uint32_t);
|
|||
bool32 TlsSetValue(uint32_t, void *);
|
||||
void *TlsGetValue(uint32_t);
|
||||
|
||||
uint32_t SuspendThread(int64_t hThread);
|
||||
uint32_t ResumeThread(int64_t hThread);
|
||||
bool32 GetThreadContext(int64_t hThread, struct NtContext *in_out_lpContext);
|
||||
|
||||
#if ShouldUseMsabiAttribute()
|
||||
#include "libc/nt/thunk/thread.inc"
|
||||
#endif /* ShouldUseMsabiAttribute() */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue