Skip to content

Commit dda4b17

Browse files
committed
runtime: remove nosplit directives from several Windows syscall helpers
Some of the Windows syscall helpers don't need to be nosplit. Removing this directive will allow to add instrumentation to these functions without having to worry about the stack size. Change-Id: I3885621f23733af48563803c704563474010b8d3 Reviewed-on: https://go-review.googlesource.com/c/go/+/572415 Reviewed-by: Than McIntosh <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent af0ebdd commit dda4b17

File tree

2 files changed

+3
-24
lines changed

2 files changed

+3
-24
lines changed

src/runtime/os_windows.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -304,21 +304,6 @@ func monitorSuspendResume() {
304304
uintptr(unsafe.Pointer(&params)), uintptr(unsafe.Pointer(&handle)))
305305
}
306306

307-
//go:nosplit
308-
func getLoadLibrary() uintptr {
309-
return uintptr(unsafe.Pointer(_LoadLibraryW))
310-
}
311-
312-
//go:nosplit
313-
func getLoadLibraryEx() uintptr {
314-
return uintptr(unsafe.Pointer(_LoadLibraryExW))
315-
}
316-
317-
//go:nosplit
318-
func getGetProcAddress() uintptr {
319-
return uintptr(unsafe.Pointer(_GetProcAddress))
320-
}
321-
322307
func getproccount() int32 {
323308
var mask, sysmask uintptr
324309
ret := stdcall3(_GetProcessAffinityMask, currentProcess, uintptr(unsafe.Pointer(&mask)), uintptr(unsafe.Pointer(&sysmask)))

src/runtime/syscall_windows.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,8 @@ func callbackWrap(a *callbackArgs) {
414414
const _LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800
415415

416416
//go:linkname syscall_loadsystemlibrary syscall.loadsystemlibrary
417-
//go:nosplit
418417
func syscall_loadsystemlibrary(filename *uint16) (handle, err uintptr) {
419-
fn := getLoadLibraryEx()
420-
handle, _, err = syscall_SyscallN(fn, uintptr(unsafe.Pointer(filename)), 0, _LOAD_LIBRARY_SEARCH_SYSTEM32)
418+
handle, _, err = syscall_SyscallN(uintptr(unsafe.Pointer(_LoadLibraryExW)), uintptr(unsafe.Pointer(filename)), 0, _LOAD_LIBRARY_SEARCH_SYSTEM32)
421419
KeepAlive(filename)
422420
if handle != 0 {
423421
err = 0
@@ -426,10 +424,8 @@ func syscall_loadsystemlibrary(filename *uint16) (handle, err uintptr) {
426424
}
427425

428426
//go:linkname syscall_loadlibrary syscall.loadlibrary
429-
//go:nosplit
430427
func syscall_loadlibrary(filename *uint16) (handle, err uintptr) {
431-
fn := getLoadLibrary()
432-
handle, _, err = syscall_SyscallN(fn, uintptr(unsafe.Pointer(filename)))
428+
handle, _, err = syscall_SyscallN(uintptr(unsafe.Pointer(_LoadLibraryW)), uintptr(unsafe.Pointer(filename)))
433429
KeepAlive(filename)
434430
if handle != 0 {
435431
err = 0
@@ -438,10 +434,8 @@ func syscall_loadlibrary(filename *uint16) (handle, err uintptr) {
438434
}
439435

440436
//go:linkname syscall_getprocaddress syscall.getprocaddress
441-
//go:nosplit
442437
func syscall_getprocaddress(handle uintptr, procname *byte) (outhandle, err uintptr) {
443-
fn := getGetProcAddress()
444-
outhandle, _, err = syscall_SyscallN(fn, handle, uintptr(unsafe.Pointer(procname)))
438+
outhandle, _, err = syscall_SyscallN(uintptr(unsafe.Pointer(_GetProcAddress)), handle, uintptr(unsafe.Pointer(procname)))
445439
KeepAlive(procname)
446440
if outhandle != 0 {
447441
err = 0

0 commit comments

Comments
 (0)