]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove nosplit directives from several Windows syscall helpers
authorqmuntal <quimmuntal@gmail.com>
Mon, 18 Mar 2024 14:38:20 +0000 (15:38 +0100)
committerQuim Muntal <quimmuntal@gmail.com>
Mon, 18 Mar 2024 17:06:46 +0000 (17:06 +0000)
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 <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/runtime/os_windows.go
src/runtime/syscall_windows.go

index ce3f224039fbc3be8895eb8ae74723158c4978b0..b5258bb57d1c5d707de3636db57d2091954984a7 100644 (file)
@@ -304,21 +304,6 @@ func monitorSuspendResume() {
                uintptr(unsafe.Pointer(&params)), uintptr(unsafe.Pointer(&handle)))
 }
 
-//go:nosplit
-func getLoadLibrary() uintptr {
-       return uintptr(unsafe.Pointer(_LoadLibraryW))
-}
-
-//go:nosplit
-func getLoadLibraryEx() uintptr {
-       return uintptr(unsafe.Pointer(_LoadLibraryExW))
-}
-
-//go:nosplit
-func getGetProcAddress() uintptr {
-       return uintptr(unsafe.Pointer(_GetProcAddress))
-}
-
 func getproccount() int32 {
        var mask, sysmask uintptr
        ret := stdcall3(_GetProcessAffinityMask, currentProcess, uintptr(unsafe.Pointer(&mask)), uintptr(unsafe.Pointer(&sysmask)))
index 7abaea11c8adf553dd7c5b6eb96aaaeddd5915fd..0b085835634284cdd2dc00e53fa8decc3016cdbc 100644 (file)
@@ -414,10 +414,8 @@ func callbackWrap(a *callbackArgs) {
 const _LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800
 
 //go:linkname syscall_loadsystemlibrary syscall.loadsystemlibrary
-//go:nosplit
 func syscall_loadsystemlibrary(filename *uint16) (handle, err uintptr) {
-       fn := getLoadLibraryEx()
-       handle, _, err = syscall_SyscallN(fn, uintptr(unsafe.Pointer(filename)), 0, _LOAD_LIBRARY_SEARCH_SYSTEM32)
+       handle, _, err = syscall_SyscallN(uintptr(unsafe.Pointer(_LoadLibraryExW)), uintptr(unsafe.Pointer(filename)), 0, _LOAD_LIBRARY_SEARCH_SYSTEM32)
        KeepAlive(filename)
        if handle != 0 {
                err = 0
@@ -426,10 +424,8 @@ func syscall_loadsystemlibrary(filename *uint16) (handle, err uintptr) {
 }
 
 //go:linkname syscall_loadlibrary syscall.loadlibrary
-//go:nosplit
 func syscall_loadlibrary(filename *uint16) (handle, err uintptr) {
-       fn := getLoadLibrary()
-       handle, _, err = syscall_SyscallN(fn, uintptr(unsafe.Pointer(filename)))
+       handle, _, err = syscall_SyscallN(uintptr(unsafe.Pointer(_LoadLibraryW)), uintptr(unsafe.Pointer(filename)))
        KeepAlive(filename)
        if handle != 0 {
                err = 0
@@ -438,10 +434,8 @@ func syscall_loadlibrary(filename *uint16) (handle, err uintptr) {
 }
 
 //go:linkname syscall_getprocaddress syscall.getprocaddress
-//go:nosplit
 func syscall_getprocaddress(handle uintptr, procname *byte) (outhandle, err uintptr) {
-       fn := getGetProcAddress()
-       outhandle, _, err = syscall_SyscallN(fn, handle, uintptr(unsafe.Pointer(procname)))
+       outhandle, _, err = syscall_SyscallN(uintptr(unsafe.Pointer(_GetProcAddress)), handle, uintptr(unsafe.Pointer(procname)))
        KeepAlive(procname)
        if outhandle != 0 {
                err = 0