1
0
mirror of https://github.com/golang/go synced 2024-11-23 04:10:04 -07:00

runtime: implement SysUnused for netbsd

R=golang-dev, bradfitz, minux.ma, dave
CC=golang-dev
https://golang.org/cl/6842081
This commit is contained in:
Joel Sing 2012-11-26 22:34:01 +11:00
parent c6afb781e2
commit 4047f300c9
6 changed files with 26 additions and 5 deletions

View File

@ -37,6 +37,8 @@ const (
MAP_PRIVATE = C.MAP_PRIVATE
MAP_FIXED = C.MAP_FIXED
MADV_FREE = C.MADV_FREE
SA_SIGINFO = C.SA_SIGINFO
SA_RESTART = C.SA_RESTART
SA_ONSTACK = C.SA_ONSTACK

View File

@ -12,6 +12,8 @@ enum {
MAP_PRIVATE = 0x2,
MAP_FIXED = 0x10,
MADV_FREE = 0x6,
SA_SIGINFO = 0x40,
SA_RESTART = 0x2,
SA_ONSTACK = 0x1,

View File

@ -12,6 +12,8 @@ enum {
MAP_PRIVATE = 0x2,
MAP_FIXED = 0x10,
MADV_FREE = 0x6,
SA_SIGINFO = 0x40,
SA_RESTART = 0x2,
SA_ONSTACK = 0x1,

View File

@ -28,9 +28,7 @@ runtime·SysAlloc(uintptr n)
void
runtime·SysUnused(void *v, uintptr n)
{
USED(v);
USED(n);
// TODO(rsc): call madvise MADV_DONTNEED
runtime·madvise(v, n, MADV_FREE);
}
void

View File

@ -83,6 +83,13 @@ TEXT runtime·munmap(SB),7,$-4
MOVL $0xf1, 0xf1 // crash
RET
TEXT runtime·madvise(SB),7,$-4
MOVL $75, AX // sys_madvise
INT $0x80
JAE 2(PC)
MOVL $0xf1, 0xf1 // crash
RET
TEXT runtime·setitimer(SB),7,$-4
MOVL $425, AX // sys_setitimer
INT $0x80

View File

@ -10,7 +10,6 @@
// int32 lwp_create(void *context, uintptr flags, void *lwpid)
TEXT runtime·lwp_create(SB),7,$0
MOVQ context+0(FP), DI
MOVQ flags+8(FP), SI
MOVQ lwpid+16(FP), DX
@ -248,6 +247,17 @@ TEXT runtime·munmap(SB),7,$0
MOVL $0xf1, 0xf1 // crash
RET
TEXT runtime·madvise(SB),7,$0
MOVQ addr+0(FP), DI // arg 1 - addr
MOVQ len+8(FP), SI // arg 2 - len
MOVQ behav+16(FP), DX // arg 3 - behav
MOVQ $75, AX // sys_madvise
SYSCALL
JCC 2(PC)
MOVL $0xf1, 0xf1 // crash
RET
TEXT runtime·sigaltstack(SB),7,$-8
MOVQ new+8(SP), DI // arg 1 - nss
MOVQ old+16(SP), SI // arg 2 - oss