...
Run Format

Source file src/runtime/os_solaris.go

Documentation: runtime

     1  // Copyright 2014 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package runtime
     6  
     7  import "unsafe"
     8  
     9  type mts struct {
    10  	tv_sec  int64
    11  	tv_nsec int64
    12  }
    13  
    14  type mscratch struct {
    15  	v [6]uintptr
    16  }
    17  
    18  type mOS struct {
    19  	waitsema uintptr // semaphore for parking on locks
    20  	perrno   *int32  // pointer to tls errno
    21  	// these are here because they are too large to be on the stack
    22  	// of low-level NOSPLIT functions.
    23  	//LibCall       libcall;
    24  	ts      mts
    25  	scratch mscratch
    26  }
    27  
    28  type libcFunc uintptr
    29  
    30  var asmsysvicall6 libcFunc
    31  
    32  //go:nosplit
    33  func sysvicall0(fn *libcFunc) uintptr {
    34  	var libcall libcall
    35  	libcall.fn = uintptr(unsafe.Pointer(fn))
    36  	libcall.n = 0
    37  	libcall.args = uintptr(unsafe.Pointer(fn)) // it's unused but must be non-nil, otherwise crashes
    38  	asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
    39  	return libcall.r1
    40  }
    41  
    42  //go:nosplit
    43  func sysvicall1(fn *libcFunc, a1 uintptr) uintptr {
    44  	var libcall libcall
    45  	libcall.fn = uintptr(unsafe.Pointer(fn))
    46  	libcall.n = 1
    47  	// TODO(rsc): Why is noescape necessary here and below?
    48  	libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
    49  	asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
    50  	return libcall.r1
    51  }
    52  
    53  //go:nosplit
    54  func sysvicall2(fn *libcFunc, a1, a2 uintptr) uintptr {
    55  	var libcall libcall
    56  	libcall.fn = uintptr(unsafe.Pointer(fn))
    57  	libcall.n = 2
    58  	libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
    59  	asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
    60  	return libcall.r1
    61  }
    62  
    63  //go:nosplit
    64  func sysvicall3(fn *libcFunc, a1, a2, a3 uintptr) uintptr {
    65  	var libcall libcall
    66  	libcall.fn = uintptr(unsafe.Pointer(fn))
    67  	libcall.n = 3
    68  	libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
    69  	asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
    70  	return libcall.r1
    71  }
    72  
    73  //go:nosplit
    74  func sysvicall4(fn *libcFunc, a1, a2, a3, a4 uintptr) uintptr {
    75  	var libcall libcall
    76  	libcall.fn = uintptr(unsafe.Pointer(fn))
    77  	libcall.n = 4
    78  	libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
    79  	asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
    80  	return libcall.r1
    81  }
    82  
    83  //go:nosplit
    84  func sysvicall5(fn *libcFunc, a1, a2, a3, a4, a5 uintptr) uintptr {
    85  	var libcall libcall
    86  	libcall.fn = uintptr(unsafe.Pointer(fn))
    87  	libcall.n = 5
    88  	libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
    89  	asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
    90  	return libcall.r1
    91  }
    92  
    93  //go:nosplit
    94  func sysvicall6(fn *libcFunc, a1, a2, a3, a4, a5, a6 uintptr) uintptr {
    95  	var libcall libcall
    96  	libcall.fn = uintptr(unsafe.Pointer(fn))
    97  	libcall.n = 6
    98  	libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
    99  	asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&libcall))
   100  	return libcall.r1
   101  }
   102  

View as plain text