diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/elymasAsmLib.ey | 18 | ||||
| -rw-r--r-- | compiler/elymasGlobalSys.ey | 5 | ||||
| -rw-r--r-- | compiler/elymasGlobalSysAsm.ey | 10 | ||||
| -rw-r--r-- | compiler/standardClient.ey | 51 |
4 files changed, 67 insertions, 17 deletions
diff --git a/compiler/elymasAsmLib.ey b/compiler/elymasAsmLib.ey index 71a4cab..b830a48 100644 --- a/compiler/elymasAsmLib.ey +++ b/compiler/elymasAsmLib.ey @@ -12,12 +12,24 @@ 2 ==MAP_PRIVATE 16 ==MAP_FIXED - 32 ==MAP_ANONYMOUS + + [ + { sys .?linux } { 32 } + { sys .?freebsd } { 4096 } + ] conds ==MAP_ANONYMOUS > ==MMAP < - 1 ==write - 9 ==mmap + [ + { sys .?linux } { + 1 ==write + 9 ==mmap + }' + { sys .?freebsd } { + 4 ==write + 477 ==mmap + }' + ] conds > ==SYSCALL 0 ==constantAllocBegin diff --git a/compiler/elymasGlobalSys.ey b/compiler/elymasGlobalSys.ey index e00009c..0ba45d8 100644 --- a/compiler/elymasGlobalSys.ey +++ b/compiler/elymasGlobalSys.ey @@ -138,6 +138,11 @@ "elymasGlobalSysDyn.ey" include "elymasGlobalSysTyped.ey" include + [ + { sys .?linux } { "linux" } + { sys .?freebsd } { "freebsd" } + ] conds enterSubScope leaveSubScope + leaveSubScope > -- diff --git a/compiler/elymasGlobalSysAsm.ey b/compiler/elymasGlobalSysAsm.ey index 14052f5..9fe2f2d 100644 --- a/compiler/elymasGlobalSysAsm.ey +++ b/compiler/elymasGlobalSysAsm.ey @@ -491,7 +491,15 @@ 8 /rax :addqImm8Reg } rep - /r8 /rsp :xchgqRegReg # swap to elymas stack to ensure correct GC behavior for what follows + [ + { sys .?linux } { + /r8 /rsp :xchgqRegReg # swap to elymas stack to ensure correct GC behavior for what follows + } + { sys .?freebsd } { + /r8 /rsp :movqRegReg # swap to elymas stack to ensure correct GC behavior for what follows + /rdi /r8 :movqRegReg # FreeBSD passes argc stack location in rdi + } + ] conds # empty encoding buffer to ensure the GC does not follow residue from freeze into unallocated memory :quoteEncodingBufferObjects /rdi :movqImmReg diff --git a/compiler/standardClient.ey b/compiler/standardClient.ey index 367d978..8d73236 100644 --- a/compiler/standardClient.ey +++ b/compiler/standardClient.ey @@ -389,25 +389,47 @@ 2 _ ==:RDWR bor bor ==:RWMASK - 64 ==:OCREAT - 512 ==:OTRUNC - 1024 ==:OAPPEND - 1 ==:PROTREAD 2 ==:PROTWRITE 4 ==:PROTEXEC 2 ==:MAPPRIVATE - 32 ==:MAPANONYMOUS - 0 ==:READ - 1 ==:WRITE - 2 ==:OPEN - 3 ==:CLOSE + [ + { sys .?linux } { 32 } + { sys .?freebsd } { 4096 } + ] conds ==:MAPANONYMOUS - 9 ==:MMAP - 11 ==:MUNMAP - 60 ==:EXIT + [ + { sys .?linux } { + 64 ==:OCREAT + 512 ==:OTRUNC + 1024 ==:OAPPEND + + 0 ==:READ + 1 ==:WRITE + 2 ==:OPEN + 3 ==:CLOSE + + 9 ==:MMAP + 11 ==:MUNMAP + 60 ==:EXIT + }' + { sys .?freebsd } { + 512 ==:OCREAT + 1024 ==:OTRUNC + 8 ==:OAPPEND + + 3 ==:READ + 4 ==:WRITE + 5 ==:OPEN + 6 ==:CLOSE + + 477 ==:MMAP + 73 ==:MUNMAP + 1 ==:EXIT + }' + ] conds { ==code code 0 0 0 0 0 EXIT sys .asm .syscall @@ -964,7 +986,10 @@ %02 # elfclass64 %01 # elf version %01 # little endian encoding - %00 %00 # Sys-V ABI + [ + { sys .?linux } { %00 %00 } # Sys-V ABI + { sys .?freebsd } { %09 %00 } # FreeBSD ABI + ] conds %00 %00 %00 %00 %00 %00 %00 # padding # Elf64_Half e_type; /* Object file type */ %02 %00 # executable file |
