Commit 4047f300 authored by Joel Sing's avatar Joel Sing

runtime: implement SysUnused for netbsd

R=golang-dev, bradfitz, minux.ma, dave
CC=golang-dev
https://golang.org/cl/6842081
parent c6afb781
...@@ -37,6 +37,8 @@ const ( ...@@ -37,6 +37,8 @@ const (
MAP_PRIVATE = C.MAP_PRIVATE MAP_PRIVATE = C.MAP_PRIVATE
MAP_FIXED = C.MAP_FIXED MAP_FIXED = C.MAP_FIXED
MADV_FREE = C.MADV_FREE
SA_SIGINFO = C.SA_SIGINFO SA_SIGINFO = C.SA_SIGINFO
SA_RESTART = C.SA_RESTART SA_RESTART = C.SA_RESTART
SA_ONSTACK = C.SA_ONSTACK SA_ONSTACK = C.SA_ONSTACK
......
...@@ -12,6 +12,8 @@ enum { ...@@ -12,6 +12,8 @@ enum {
MAP_PRIVATE = 0x2, MAP_PRIVATE = 0x2,
MAP_FIXED = 0x10, MAP_FIXED = 0x10,
MADV_FREE = 0x6,
SA_SIGINFO = 0x40, SA_SIGINFO = 0x40,
SA_RESTART = 0x2, SA_RESTART = 0x2,
SA_ONSTACK = 0x1, SA_ONSTACK = 0x1,
......
...@@ -12,6 +12,8 @@ enum { ...@@ -12,6 +12,8 @@ enum {
MAP_PRIVATE = 0x2, MAP_PRIVATE = 0x2,
MAP_FIXED = 0x10, MAP_FIXED = 0x10,
MADV_FREE = 0x6,
SA_SIGINFO = 0x40, SA_SIGINFO = 0x40,
SA_RESTART = 0x2, SA_RESTART = 0x2,
SA_ONSTACK = 0x1, SA_ONSTACK = 0x1,
......
...@@ -28,9 +28,7 @@ runtime·SysAlloc(uintptr n) ...@@ -28,9 +28,7 @@ runtime·SysAlloc(uintptr n)
void void
runtime·SysUnused(void *v, uintptr n) runtime·SysUnused(void *v, uintptr n)
{ {
USED(v); runtime·madvise(v, n, MADV_FREE);
USED(n);
// TODO(rsc): call madvise MADV_DONTNEED
} }
void void
......
...@@ -83,6 +83,13 @@ TEXT runtime·munmap(SB),7,$-4 ...@@ -83,6 +83,13 @@ TEXT runtime·munmap(SB),7,$-4
MOVL $0xf1, 0xf1 // crash MOVL $0xf1, 0xf1 // crash
RET 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 TEXT runtime·setitimer(SB),7,$-4
MOVL $425, AX // sys_setitimer MOVL $425, AX // sys_setitimer
INT $0x80 INT $0x80
...@@ -180,7 +187,7 @@ TEXT runtime·sigtramp(SB),7,$44 ...@@ -180,7 +187,7 @@ TEXT runtime·sigtramp(SB),7,$44
CMPL BX, $0 CMPL BX, $0
JNE 5(PC) JNE 5(PC)
MOVL signo+0(FP), BX MOVL signo+0(FP), BX
MOVL BX, 0(SP) MOVL BX, 0(SP)
CALL runtime·badsignal(SB) CALL runtime·badsignal(SB)
RET RET
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
// int32 lwp_create(void *context, uintptr flags, void *lwpid) // int32 lwp_create(void *context, uintptr flags, void *lwpid)
TEXT runtime·lwp_create(SB),7,$0 TEXT runtime·lwp_create(SB),7,$0
MOVQ context+0(FP), DI MOVQ context+0(FP), DI
MOVQ flags+8(FP), SI MOVQ flags+8(FP), SI
MOVQ lwpid+16(FP), DX MOVQ lwpid+16(FP), DX
...@@ -248,6 +247,17 @@ TEXT runtime·munmap(SB),7,$0 ...@@ -248,6 +247,17 @@ TEXT runtime·munmap(SB),7,$0
MOVL $0xf1, 0xf1 // crash MOVL $0xf1, 0xf1 // crash
RET 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 TEXT runtime·sigaltstack(SB),7,$-8
MOVQ new+8(SP), DI // arg 1 - nss MOVQ new+8(SP), DI // arg 1 - nss
MOVQ old+16(SP), SI // arg 2 - oss MOVQ old+16(SP), SI // arg 2 - oss
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment