Pavel Zholkover <[email protected]> once said:
> I'm not sure I understand the reason 9vx will fail to reserve 768mb
> with brk() while my Plan 9 install on kvm+qemu with 128mb or ram works
> fine, as long as it is not written to.
The reason is because 9vx gives user processes a virtual
address space of only 256mb. The brk works but the
first time we fault one of those pages past USTKTOP the
program suicides.
The first fault happens at src/pkg/runtime/mcache.c:21
in the runtime·MCache_Alloc function.
To show you what I mean, here's a formatted stack trace:
term% cat y.go
package main
func main() {
println("Hello, world.")
}
term% ./8.out
8.out 174: suicide: sys: trap: page fault pc=0x000021df
term% db 8.out 174
386 binary
page fault
/go/src/pkg/runtime/mcache.c:21 runtime.MCache_Alloc+39/ MOVL 0(AX),AX
$c
runtime.MCache_Alloc(sizeclass=0x1, c=0x30424000, size=0x8, zeroed=0x1)
/go/src/pkg/runtime/mcache.c:13 called from runtime.mallocgc+db
/go/src/pkg/runtime/malloc.goc:62
runtime.mallocgc(size=0x8, zeroed=0x1, flag=0x0, dogc=0x0)
/go/src/pkg/runtime/malloc.goc:40 called from runtime.malloc+41
/go/src/pkg/runtime/malloc.goc:115
runtime.malloc(size=0x1)
/go/src/pkg/runtime/malloc.goc:113 called from runtime.mallocinit+e9
/go/src/pkg/runtime/malloc.goc:319
runtime.mallocinit()
/go/src/pkg/runtime/malloc.goc:237 called from runtime.schedinit+39
/go/src/pkg/runtime/proc.c:122
runtime.schedinit()
/go/src/pkg/runtime/proc.c:113 called from _rt0_386+b3
/go/src/pkg/runtime/386/asm.s:78
_rt0_386()
/go/src/pkg/runtime/386/asm.s:12 called from 1
Cheers,
Anthony