mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-12 09:17:53 +00:00
Avoid mapping above 4gb on Windows 7 x64 (#19)
Windows 7 support is now confirmed to be working. However it comes at the cost of needing to workaround this tragically oppressive behavior which is imposed for reasons unknown. Fixes #19
This commit is contained in:
parent
f0600a898c
commit
2ad0d05d31
4 changed files with 25 additions and 6 deletions
|
@ -730,7 +730,7 @@ ape.macho:
|
||||||
/ ││││││││││┌5:HIGH_ENTROPY_VA
|
/ ││││││││││┌5:HIGH_ENTROPY_VA
|
||||||
/ │││││││││││rrrrr
|
/ │││││││││││rrrrr
|
||||||
.LDLLSTD = 0b0000000100100000
|
.LDLLSTD = 0b0000000100100000
|
||||||
.LDLLPIE = 0b0000000001000000
|
.LDLLPIE = 0b0000000001100000
|
||||||
.LDLLEXE = .LDLLSTD
|
.LDLLEXE = .LDLLSTD
|
||||||
|
|
||||||
/ ┌31:Writeable ┌─────────────────────────┐
|
/ ┌31:Writeable ┌─────────────────────────┐
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
│ cosmopolitan § new technology » memory ─╬─│┼
|
│ cosmopolitan § new technology » memory ─╬─│┼
|
||||||
╚────────────────────────────────────────────────────────────────────────────│*/
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||||
|
|
||||||
#define kNtNumaNoPreferredNode 0xffffffff
|
#define kNtNumaNoPreferredNode 0xffffffffu
|
||||||
|
|
||||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
|
@ -1,13 +1,26 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_RUNTIME_MEMTRACK_H_
|
#ifndef COSMOPOLITAN_LIBC_RUNTIME_MEMTRACK_H_
|
||||||
#define COSMOPOLITAN_LIBC_RUNTIME_MEMTRACK_H_
|
#define COSMOPOLITAN_LIBC_RUNTIME_MEMTRACK_H_
|
||||||
|
#include "libc/dce.h"
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
|
#include "libc/nt/enum/version.h"
|
||||||
|
#include "libc/nt/struct/teb.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
#define kAutomapStart 0x0000100080000000 // asan can't spread its poison here
|
#define _kAutomapStart 0x0000100080000000 // asan can't spread its poison here
|
||||||
#define kAutomapSize 0x00000fff80000000
|
#define _kAutomapSize 0x00000fff80000000
|
||||||
#define kFixedmapStart 0x0000200000000000
|
#define _kFixedmapStart 0x0000200000000000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: Why can't we allocate addresses above 4GB on Windows 7 x64?
|
||||||
|
* https://github.com/jart/cosmopolitan/issues/19
|
||||||
|
*/
|
||||||
|
#define MEMTRACK_ADDRESS(NORMAL, WIN7) \
|
||||||
|
(!(IsWindows() && NtGetVersion() < kNtVersionWindows10) ? NORMAL : WIN7)
|
||||||
|
#define kAutomapStart MEMTRACK_ADDRESS(_kAutomapStart, 0x10000000)
|
||||||
|
#define kAutomapSize MEMTRACK_ADDRESS(_kAutomapSize, 0x40000000)
|
||||||
|
#define kFixedmapStart MEMTRACK_ADDRESS(_kFixedmapStart, 0x40000000)
|
||||||
|
|
||||||
struct MemoryIntervals {
|
struct MemoryIntervals {
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -43,6 +43,12 @@
|
||||||
#include "libc/sysv/consts/map.h"
|
#include "libc/sysv/consts/map.h"
|
||||||
#include "libc/sysv/consts/prot.h"
|
#include "libc/sysv/consts/prot.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: Why can't we allocate addresses above 4GB on Windows 7 x64?
|
||||||
|
* https://github.com/jart/cosmopolitan/issues/19
|
||||||
|
*/
|
||||||
|
#define ADDRESS 0x77700000 /*0000*/
|
||||||
|
|
||||||
struct WinArgs {
|
struct WinArgs {
|
||||||
char *argv[512];
|
char *argv[512];
|
||||||
char *envp[512];
|
char *envp[512];
|
||||||
|
@ -128,7 +134,7 @@ static textwindows wontreturn void WinMainNew(void) {
|
||||||
NormalizeCmdExe();
|
NormalizeCmdExe();
|
||||||
*(/*unconst*/ int *)&__hostos = WINDOWS;
|
*(/*unconst*/ int *)&__hostos = WINDOWS;
|
||||||
size = ROUNDUP(STACKSIZE + sizeof(struct WinArgs), FRAMESIZE);
|
size = ROUNDUP(STACKSIZE + sizeof(struct WinArgs), FRAMESIZE);
|
||||||
data = (intptr_t)AllocateMemory((char *)0x777000000000, size, &_mmi.p[0].h);
|
data = (intptr_t)AllocateMemory((char *)ADDRESS, size, &_mmi.p[0].h);
|
||||||
_mmi.p[0].x = data >> 16;
|
_mmi.p[0].x = data >> 16;
|
||||||
_mmi.p[0].y = (data >> 16) + ((size >> 16) - 1);
|
_mmi.p[0].y = (data >> 16) + ((size >> 16) - 1);
|
||||||
_mmi.p[0].prot = PROT_READ | PROT_WRITE;
|
_mmi.p[0].prot = PROT_READ | PROT_WRITE;
|
||||||
|
|
Loading…
Reference in a new issue