From 36aa7d4d14c1dbca2405e265b8bbf1260e9d825c Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 8 Mar 2012 14:03:56 -0500 Subject: runtime: inline calls to notok When a very low-level system call that should never fail does fail, we call notok, which crashes the program. Often, we are then left with only the program counter as information about the crash, and it is in notok. Instead, inline calls to notok (it is just one instruction on most systems) so that the program counter will tell us which system call is unhappy. R=golang-dev, gri, minux.ma, bradfitz CC=golang-dev https://golang.org/cl/5792048 --- src/pkg/runtime/sys_linux_arm.s | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/pkg/runtime/sys_linux_arm.s') diff --git a/src/pkg/runtime/sys_linux_arm.s b/src/pkg/runtime/sys_linux_arm.s index 439df3afa8..03e173d266 100644 --- a/src/pkg/runtime/sys_linux_arm.s +++ b/src/pkg/runtime/sys_linux_arm.s @@ -38,11 +38,6 @@ #define ARM_BASE (SYS_BASE + 0x0f0000) #define SYS_ARM_cacheflush (ARM_BASE + 2) -TEXT notok<>(SB),7,$0 - MOVW $0, R9 - MOVW R9, (R9) - B 0(PC) - TEXT runtime·open(SB),7,$0 MOVW 0(FP), R0 MOVW 4(FP), R1 @@ -126,7 +121,8 @@ TEXT runtime·munmap(SB),7,$0 SWI $0 MOVW $0xfffff001, R6 CMP R6, R0 - BL.HI notok<>(SB) + MOVW.HI $0, R9 // crash on syscall failure + MOVW.HI R9, (R9) RET TEXT runtime·madvise(SB),7,$0 @@ -137,7 +133,8 @@ TEXT runtime·madvise(SB),7,$0 SWI $0 MOVW $0xfffff001, R6 CMP R6, R0 - BL.HI notok<>(SB) + MOVW.HI $0, R9 // crash on syscall failure + MOVW.HI R9, (R9) RET TEXT runtime·setitimer(SB),7,$0 @@ -291,7 +288,8 @@ TEXT runtime·sigaltstack(SB),7,$0 SWI $0 MOVW $0xfffff001, R6 CMP R6, R0 - BL.HI notok<>(SB) + MOVW.HI $0, R9 // crash on syscall failure + MOVW.HI R9, (R9) RET TEXT runtime·sigtramp(SB),7,$24 -- cgit v1.3-5-g9baa