Make numerous improvements

- Python static hello world now 1.8mb
- Python static fully loaded now 10mb
- Python HTTPS client now uses MbedTLS
- Python REPL now completes import stmts
- Increase stack size for Python for now
- Begin synthesizing posixpath and ntpath
- Restore Python \N{UNICODE NAME} support
- Restore Python NFKD symbol normalization
- Add optimized code path for Intel SHA-NI
- Get more Python unit tests passing faster
- Get Python help() pagination working on NT
- Python hashlib now supports MbedTLS PBKDF2
- Make memcpy/memmove/memcmp/bcmp/etc. faster
- Add Mersenne Twister and Vigna to LIBC_RAND
- Provide privileged __printf() for error code
- Fix zipos opendir() so that it reports ENOTDIR
- Add basic chmod() implementation for Windows NT
- Add Cosmo's best functions to Python cosmo module
- Pin function trace indent depth to that of caller
- Show memory diagram on invalid access in MODE=dbg
- Differentiate stack overflow on crash in MODE=dbg
- Add stb_truetype and tools for analyzing font files
- Upgrade to UNICODE 13 and reduce its binary footprint
- COMPILE.COM now logs resource usage of build commands
- Start implementing basic poll() support on bare metal
- Set getauxval(AT_EXECFN) to GetModuleFileName() on NT
- Add descriptions to strerror() in non-TINY build modes
- Add COUNTBRANCH() macro to help with micro-optimizations
- Make error / backtrace / asan / memory code more unbreakable
- Add fast perfect C implementation of μ-Law and a-Law audio codecs
- Make strtol() functions consistent with other libc implementations
- Improve Linenoise implementation (see also github.com/jart/bestline)
- COMPILE.COM now suppresses stdout/stderr of successful build commands
This commit is contained in:
Justine Tunney 2021-09-27 22:58:51 -07:00
parent fa7b4f5bd1
commit 39bf41f4eb
806 changed files with 77494 additions and 63859 deletions

View file

@ -30,8 +30,6 @@ COSMOPOLITAN_C_START_
int64_t LoadLibrary(const char16_t *lpLibFileName);
int64_t LoadLibraryEx(const char16_t *lpLibFileName, int64_t hFile,
uint32_t dwFlags);
uint32_t GetModuleFileName(int64_t hModule, char16_t *lpFilename,
uint32_t nSize);
uint32_t GetModuleFileNameA(int64_t hModule, char *lpFilename, uint32_t nSize);
intptr_t GetModuleHandle(const char *opt_lpModuleName);
intptr_t GetModuleHandleW(const char16_t *opt_lpModuleName);

View file

@ -1,6 +1,7 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_IO_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_IO_H_
#define kNtIoReparseTagSymlink 0xa000000c
#define kNtIoReparseTagSymlink 0xa000000c
#define kNtIoReparseTagMountPoint 0xa0000003
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_IO_H_ */

View file

@ -217,6 +217,10 @@ bool32 GetOverlappedResultEx(int64_t hFile, struct NtOverlapped *lpOverlapped,
uint32_t *lpNumberOfBytesTransferred,
uint32_t dwMilliseconds, bool32 bAlertable);
bool32 GetVolumePathName(const char16_t *lpszFileName,
char16_t *lpszVolumePathName,
uint32_t cchBufferLength);
#if ShouldUseMsabiAttribute()
#include "libc/nt/thunk/files.inc"
#endif /* ShouldUseMsabiAttribute() */

View file

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

View file

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

View file

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

View file

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

View file

@ -2725,8 +2725,8 @@ imp 'GetUserOverrideWord' GetUserOverrideWord KernelBase 802
imp 'GetUserPreferredUILanguages' GetUserPreferredUILanguages kernel32 0 # KernelBase
imp 'GetVDMCurrentDirectories' GetVDMCurrentDirectories kernel32 798
imp 'GetVersion' GetVersion kernel32 0 # KernelBase
imp 'GetVersionExA' GetVersionExA kernel32 0 # KernelBase
imp 'GetVersionEx' GetVersionExW kernel32 0 # KernelBase
imp 'GetVersionExA' GetVersionExA kernel32 0 1 # KernelBase
imp 'GetVersionEx' GetVersionExW kernel32 0 1 # KernelBase
imp 'GetViewportExtEx' GetViewportExtEx gdi32 1728
imp 'GetViewportOrgEx' GetViewportOrgEx gdi32 1729
imp 'GetVolumeInformationA' GetVolumeInformationA kernel32 0 # KernelBase
@ -2734,8 +2734,8 @@ imp 'GetVolumeInformationByHandle' GetVolumeInformationByHandleW kernel32
imp 'GetVolumeInformation' GetVolumeInformationW kernel32 0 # KernelBase
imp 'GetVolumeNameForVolumeMountPointA' GetVolumeNameForVolumeMountPointA kernel32 805
imp 'GetVolumeNameForVolumeMountPoint' GetVolumeNameForVolumeMountPointW kernel32 0 # KernelBase
imp 'GetVolumePathNameA' GetVolumePathNameA kernel32 807
imp 'GetVolumePathName' GetVolumePathNameW kernel32 0 # KernelBase
imp 'GetVolumePathNameA' GetVolumePathNameA kernel32 807 3
imp 'GetVolumePathName' GetVolumePathNameW kernel32 0 3 # KernelBase
imp 'GetVolumePathNamesForVolumeNameA' GetVolumePathNamesForVolumeNameA kernel32 809
imp 'GetVolumePathNamesForVolumeName' GetVolumePathNamesForVolumeNameW kernel32 0 # KernelBase
imp 'GetWinMetaFileBits' GetWinMetaFileBits gdi32 1730

View file

@ -40,6 +40,8 @@ intptr_t GetStdHandle(int64_t nStdHandle) nosideeffect;
bool32 SetStdHandle(int64_t nStdHandle, int64_t hHandle);
bool32 SetDefaultDllDirectories(unsigned dirflags);
bool32 RtlGenRandom(void *RandomBuffer, uint32_t RandomBufferLength);
uint32_t GetModuleFileName(int64_t hModule, char16_t *lpFilename,
uint32_t nSize);
#if ShouldUseMsabiAttribute()
#include "libc/nt/thunk/runtime.inc"

View file

@ -0,0 +1,22 @@
#ifndef COSMOPOLITAN_LIBC_NT_STRUCT_OSVERSIONINFO_H_
#define COSMOPOLITAN_LIBC_NT_STRUCT_OSVERSIONINFO_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct NtOsVersionInfo {
uint32_t dwOSVersionInfoSize;
uint32_t dwMajorVersion;
uint32_t dwMinorVersion;
uint32_t dwBuildNumber;
uint32_t dwPlatformId;
char16_t szCSDVersion[128];
uint16_t wServicePackMajor;
uint16_t wServicePackMinor;
uint16_t wSuiteMask;
uint8_t wProductType;
uint8_t wReserved;
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_NT_STRUCT_OSVERSIONINFO_H_ */

View file

@ -28,3 +28,6 @@ extern typeof(SetDefaultDllDirectories) *const
#define GetCurrentProcess(...) __imp_GetCurrentProcess(__VA_ARGS__)
extern typeof(GetCurrentProcess) *const __imp_GetCurrentProcess __msabi;
#define GetModuleFileName(...) __imp_GetModuleFileNameW(__VA_ARGS__)
extern typeof(GetModuleFileName) *const __imp_GetModuleFileNameW __msabi;

11
libc/nt/version.h Normal file
View file

@ -0,0 +1,11 @@
#ifndef COSMOPOLITAN_LIBC_NT_VERSION_H_
#define COSMOPOLITAN_LIBC_NT_VERSION_H_
#include "libc/nt/struct/osversioninfo.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
bool32 GetVersionEx(struct NtOsVersionInfo *lpVersionInformation);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_NT_VERSION_H_ */