Modified const and extern to always use blocks

This commit is contained in:
2025-04-05 19:34:50 +02:00
parent ba34637dc1
commit 543558a02b
16 changed files with 164 additions and 90 deletions

View File

@ -1,7 +1,3 @@
kernel32 extern {
VirtualAlloc(address int, size uint, flags uint32, protection uint32) -> *any
}
alloc(length int) -> []byte {
x := kernel32.VirtualAlloc(0, length+8, mem.commit|mem.reserve, page.readwrite)
@ -11,4 +7,10 @@ alloc(length int) -> []byte {
store(x, 8, length)
return x + 8
}
extern {
kernel32 {
VirtualAlloc(address int, size uint, flags uint32, protection uint32) -> *any
}
}

View File

@ -1,9 +1,11 @@
prot const {
read 0x1
write 0x2
}
const {
prot {
read 0x1
write 0x2
}
map const {
private 0x02
anonymous 0x20
map {
private 0x02
anonymous 0x20
}
}

View File

@ -1,9 +1,11 @@
prot const {
read 0x1
write 0x2
}
const {
prot {
read 0x1
write 0x2
}
map const {
private 0x02
anonymous 0x1000
map {
private 0x02
anonymous 0x1000
}
}

View File

@ -1,9 +1,11 @@
page const {
readwrite 0x0004
}
const {
page {
readwrite 0x0004
}
mem const {
commit 0x1000
reserve 0x2000
decommit 0x4000
mem {
commit 0x1000
reserve 0x2000
decommit 0x4000
}
}

View File

@ -1,7 +1,9 @@
kernel32 extern {
VirtualFree(address *any, size uint, type uint32) -> bool
}
free(address []any) {
kernel32.VirtualFree(address-8, len(address)+8, mem.decommit)
}
extern {
kernel32 {
VirtualFree(address *any, size uint, type uint32) -> bool
}
}