github.com/nicocha30/gvisor-ligolo@v0.0.0-20230726075806-989fa2c0a413/pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go (about)

     1  // Automatically generated marshal implementation. See tools/go_marshal.
     2  
     3  package linux
     4  
     5  import (
     6  	"github.com/nicocha30/gvisor-ligolo/pkg/gohacks"
     7  	"github.com/nicocha30/gvisor-ligolo/pkg/hostarch"
     8  	"github.com/nicocha30/gvisor-ligolo/pkg/marshal"
     9      "io"
    10      "reflect"
    11      "runtime"
    12      "unsafe"
    13  )
    14  
    15  // Marshallable types used by this file.
    16  var _ marshal.Marshallable = (*MessageHeader64)(nil)
    17  var _ marshal.Marshallable = (*SchedParam)(nil)
    18  var _ marshal.Marshallable = (*multipleMessageHeader64)(nil)
    19  var _ marshal.Marshallable = (*rlimit64)(nil)
    20  var _ marshal.Marshallable = (*sigSetWithSize)(nil)
    21  var _ marshal.Marshallable = (*userSockFprog)(nil)
    22  
    23  // SizeBytes implements marshal.Marshallable.SizeBytes.
    24  func (s *sigSetWithSize) SizeBytes() int {
    25      return 16
    26  }
    27  
    28  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
    29  func (s *sigSetWithSize) MarshalBytes(dst []byte) []byte {
    30      hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.sigsetAddr))
    31      dst = dst[8:]
    32      hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.sizeofSigset))
    33      dst = dst[8:]
    34      return dst
    35  }
    36  
    37  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
    38  func (s *sigSetWithSize) UnmarshalBytes(src []byte) []byte {
    39      s.sigsetAddr = uint64(hostarch.ByteOrder.Uint64(src[:8]))
    40      src = src[8:]
    41      s.sizeofSigset = uint64(hostarch.ByteOrder.Uint64(src[:8]))
    42      src = src[8:]
    43      return src
    44  }
    45  
    46  // Packed implements marshal.Marshallable.Packed.
    47  //go:nosplit
    48  func (s *sigSetWithSize) Packed() bool {
    49      return true
    50  }
    51  
    52  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
    53  func (s *sigSetWithSize) MarshalUnsafe(dst []byte) []byte {
    54      size := s.SizeBytes()
    55      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
    56      return dst[size:]
    57  }
    58  
    59  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
    60  func (s *sigSetWithSize) UnmarshalUnsafe(src []byte) []byte {
    61      size := s.SizeBytes()
    62      gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
    63      return src[size:]
    64  }
    65  
    66  // CopyOutN implements marshal.Marshallable.CopyOutN.
    67  func (s *sigSetWithSize) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
    68      // Construct a slice backed by dst's underlying memory.
    69      var buf []byte
    70      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
    71      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s)))
    72      hdr.Len = s.SizeBytes()
    73      hdr.Cap = s.SizeBytes()
    74  
    75      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
    76      // Since we bypassed the compiler's escape analysis, indicate that s
    77      // must live until the use above.
    78      runtime.KeepAlive(s) // escapes: replaced by intrinsic.
    79      return length, err
    80  }
    81  
    82  // CopyOut implements marshal.Marshallable.CopyOut.
    83  func (s *sigSetWithSize) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
    84      return s.CopyOutN(cc, addr, s.SizeBytes())
    85  }
    86  
    87  // CopyIn implements marshal.Marshallable.CopyIn.
    88  func (s *sigSetWithSize) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
    89      // Construct a slice backed by dst's underlying memory.
    90      var buf []byte
    91      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
    92      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s)))
    93      hdr.Len = s.SizeBytes()
    94      hdr.Cap = s.SizeBytes()
    95  
    96      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
    97      // Since we bypassed the compiler's escape analysis, indicate that s
    98      // must live until the use above.
    99      runtime.KeepAlive(s) // escapes: replaced by intrinsic.
   100      return length, err
   101  }
   102  
   103  // WriteTo implements io.WriterTo.WriteTo.
   104  func (s *sigSetWithSize) WriteTo(writer io.Writer) (int64, error) {
   105      // Construct a slice backed by dst's underlying memory.
   106      var buf []byte
   107      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   108      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s)))
   109      hdr.Len = s.SizeBytes()
   110      hdr.Cap = s.SizeBytes()
   111  
   112      length, err := writer.Write(buf)
   113      // Since we bypassed the compiler's escape analysis, indicate that s
   114      // must live until the use above.
   115      runtime.KeepAlive(s) // escapes: replaced by intrinsic.
   116      return int64(length), err
   117  }
   118  
   119  // SizeBytes implements marshal.Marshallable.SizeBytes.
   120  func (r *rlimit64) SizeBytes() int {
   121      return 16
   122  }
   123  
   124  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   125  func (r *rlimit64) MarshalBytes(dst []byte) []byte {
   126      hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Cur))
   127      dst = dst[8:]
   128      hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Max))
   129      dst = dst[8:]
   130      return dst
   131  }
   132  
   133  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   134  func (r *rlimit64) UnmarshalBytes(src []byte) []byte {
   135      r.Cur = uint64(hostarch.ByteOrder.Uint64(src[:8]))
   136      src = src[8:]
   137      r.Max = uint64(hostarch.ByteOrder.Uint64(src[:8]))
   138      src = src[8:]
   139      return src
   140  }
   141  
   142  // Packed implements marshal.Marshallable.Packed.
   143  //go:nosplit
   144  func (r *rlimit64) Packed() bool {
   145      return true
   146  }
   147  
   148  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
   149  func (r *rlimit64) MarshalUnsafe(dst []byte) []byte {
   150      size := r.SizeBytes()
   151      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size))
   152      return dst[size:]
   153  }
   154  
   155  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
   156  func (r *rlimit64) UnmarshalUnsafe(src []byte) []byte {
   157      size := r.SizeBytes()
   158      gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size))
   159      return src[size:]
   160  }
   161  
   162  // CopyOutN implements marshal.Marshallable.CopyOutN.
   163  func (r *rlimit64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   164      // Construct a slice backed by dst's underlying memory.
   165      var buf []byte
   166      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   167      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r)))
   168      hdr.Len = r.SizeBytes()
   169      hdr.Cap = r.SizeBytes()
   170  
   171      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   172      // Since we bypassed the compiler's escape analysis, indicate that r
   173      // must live until the use above.
   174      runtime.KeepAlive(r) // escapes: replaced by intrinsic.
   175      return length, err
   176  }
   177  
   178  // CopyOut implements marshal.Marshallable.CopyOut.
   179  func (r *rlimit64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   180      return r.CopyOutN(cc, addr, r.SizeBytes())
   181  }
   182  
   183  // CopyIn implements marshal.Marshallable.CopyIn.
   184  func (r *rlimit64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   185      // Construct a slice backed by dst's underlying memory.
   186      var buf []byte
   187      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   188      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r)))
   189      hdr.Len = r.SizeBytes()
   190      hdr.Cap = r.SizeBytes()
   191  
   192      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   193      // Since we bypassed the compiler's escape analysis, indicate that r
   194      // must live until the use above.
   195      runtime.KeepAlive(r) // escapes: replaced by intrinsic.
   196      return length, err
   197  }
   198  
   199  // WriteTo implements io.WriterTo.WriteTo.
   200  func (r *rlimit64) WriteTo(writer io.Writer) (int64, error) {
   201      // Construct a slice backed by dst's underlying memory.
   202      var buf []byte
   203      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   204      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r)))
   205      hdr.Len = r.SizeBytes()
   206      hdr.Cap = r.SizeBytes()
   207  
   208      length, err := writer.Write(buf)
   209      // Since we bypassed the compiler's escape analysis, indicate that r
   210      // must live until the use above.
   211      runtime.KeepAlive(r) // escapes: replaced by intrinsic.
   212      return int64(length), err
   213  }
   214  
   215  // SizeBytes implements marshal.Marshallable.SizeBytes.
   216  func (s *SchedParam) SizeBytes() int {
   217      return 4
   218  }
   219  
   220  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   221  func (s *SchedParam) MarshalBytes(dst []byte) []byte {
   222      hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.schedPriority))
   223      dst = dst[4:]
   224      return dst
   225  }
   226  
   227  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   228  func (s *SchedParam) UnmarshalBytes(src []byte) []byte {
   229      s.schedPriority = int32(hostarch.ByteOrder.Uint32(src[:4]))
   230      src = src[4:]
   231      return src
   232  }
   233  
   234  // Packed implements marshal.Marshallable.Packed.
   235  //go:nosplit
   236  func (s *SchedParam) Packed() bool {
   237      return true
   238  }
   239  
   240  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
   241  func (s *SchedParam) MarshalUnsafe(dst []byte) []byte {
   242      size := s.SizeBytes()
   243      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
   244      return dst[size:]
   245  }
   246  
   247  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
   248  func (s *SchedParam) UnmarshalUnsafe(src []byte) []byte {
   249      size := s.SizeBytes()
   250      gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
   251      return src[size:]
   252  }
   253  
   254  // CopyOutN implements marshal.Marshallable.CopyOutN.
   255  func (s *SchedParam) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   256      // Construct a slice backed by dst's underlying memory.
   257      var buf []byte
   258      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   259      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s)))
   260      hdr.Len = s.SizeBytes()
   261      hdr.Cap = s.SizeBytes()
   262  
   263      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   264      // Since we bypassed the compiler's escape analysis, indicate that s
   265      // must live until the use above.
   266      runtime.KeepAlive(s) // escapes: replaced by intrinsic.
   267      return length, err
   268  }
   269  
   270  // CopyOut implements marshal.Marshallable.CopyOut.
   271  func (s *SchedParam) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   272      return s.CopyOutN(cc, addr, s.SizeBytes())
   273  }
   274  
   275  // CopyIn implements marshal.Marshallable.CopyIn.
   276  func (s *SchedParam) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   277      // Construct a slice backed by dst's underlying memory.
   278      var buf []byte
   279      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   280      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s)))
   281      hdr.Len = s.SizeBytes()
   282      hdr.Cap = s.SizeBytes()
   283  
   284      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   285      // Since we bypassed the compiler's escape analysis, indicate that s
   286      // must live until the use above.
   287      runtime.KeepAlive(s) // escapes: replaced by intrinsic.
   288      return length, err
   289  }
   290  
   291  // WriteTo implements io.WriterTo.WriteTo.
   292  func (s *SchedParam) WriteTo(writer io.Writer) (int64, error) {
   293      // Construct a slice backed by dst's underlying memory.
   294      var buf []byte
   295      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   296      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s)))
   297      hdr.Len = s.SizeBytes()
   298      hdr.Cap = s.SizeBytes()
   299  
   300      length, err := writer.Write(buf)
   301      // Since we bypassed the compiler's escape analysis, indicate that s
   302      // must live until the use above.
   303      runtime.KeepAlive(s) // escapes: replaced by intrinsic.
   304      return int64(length), err
   305  }
   306  
   307  // SizeBytes implements marshal.Marshallable.SizeBytes.
   308  func (u *userSockFprog) SizeBytes() int {
   309      return 10 +
   310          1*6
   311  }
   312  
   313  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   314  func (u *userSockFprog) MarshalBytes(dst []byte) []byte {
   315      hostarch.ByteOrder.PutUint16(dst[:2], uint16(u.Len))
   316      dst = dst[2:]
   317      // Padding: dst[:sizeof(byte)*6] ~= [6]byte{0}
   318      dst = dst[1*(6):]
   319      hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Filter))
   320      dst = dst[8:]
   321      return dst
   322  }
   323  
   324  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   325  func (u *userSockFprog) UnmarshalBytes(src []byte) []byte {
   326      u.Len = uint16(hostarch.ByteOrder.Uint16(src[:2]))
   327      src = src[2:]
   328      // Padding: ~ copy([6]byte(u._), src[:sizeof(byte)*6])
   329      src = src[1*(6):]
   330      u.Filter = uint64(hostarch.ByteOrder.Uint64(src[:8]))
   331      src = src[8:]
   332      return src
   333  }
   334  
   335  // Packed implements marshal.Marshallable.Packed.
   336  //go:nosplit
   337  func (u *userSockFprog) Packed() bool {
   338      return true
   339  }
   340  
   341  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
   342  func (u *userSockFprog) MarshalUnsafe(dst []byte) []byte {
   343      size := u.SizeBytes()
   344      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
   345      return dst[size:]
   346  }
   347  
   348  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
   349  func (u *userSockFprog) UnmarshalUnsafe(src []byte) []byte {
   350      size := u.SizeBytes()
   351      gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
   352      return src[size:]
   353  }
   354  
   355  // CopyOutN implements marshal.Marshallable.CopyOutN.
   356  func (u *userSockFprog) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   357      // Construct a slice backed by dst's underlying memory.
   358      var buf []byte
   359      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   360      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
   361      hdr.Len = u.SizeBytes()
   362      hdr.Cap = u.SizeBytes()
   363  
   364      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   365      // Since we bypassed the compiler's escape analysis, indicate that u
   366      // must live until the use above.
   367      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
   368      return length, err
   369  }
   370  
   371  // CopyOut implements marshal.Marshallable.CopyOut.
   372  func (u *userSockFprog) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   373      return u.CopyOutN(cc, addr, u.SizeBytes())
   374  }
   375  
   376  // CopyIn implements marshal.Marshallable.CopyIn.
   377  func (u *userSockFprog) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   378      // Construct a slice backed by dst's underlying memory.
   379      var buf []byte
   380      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   381      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
   382      hdr.Len = u.SizeBytes()
   383      hdr.Cap = u.SizeBytes()
   384  
   385      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   386      // Since we bypassed the compiler's escape analysis, indicate that u
   387      // must live until the use above.
   388      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
   389      return length, err
   390  }
   391  
   392  // WriteTo implements io.WriterTo.WriteTo.
   393  func (u *userSockFprog) WriteTo(writer io.Writer) (int64, error) {
   394      // Construct a slice backed by dst's underlying memory.
   395      var buf []byte
   396      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   397      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
   398      hdr.Len = u.SizeBytes()
   399      hdr.Cap = u.SizeBytes()
   400  
   401      length, err := writer.Write(buf)
   402      // Since we bypassed the compiler's escape analysis, indicate that u
   403      // must live until the use above.
   404      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
   405      return int64(length), err
   406  }
   407  
   408  // SizeBytes implements marshal.Marshallable.SizeBytes.
   409  func (m *MessageHeader64) SizeBytes() int {
   410      return 56
   411  }
   412  
   413  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   414  func (m *MessageHeader64) MarshalBytes(dst []byte) []byte {
   415      hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.Name))
   416      dst = dst[8:]
   417      hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.NameLen))
   418      dst = dst[4:]
   419      // Padding: dst[:sizeof(uint32)] ~= uint32(0)
   420      dst = dst[4:]
   421      hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.Iov))
   422      dst = dst[8:]
   423      hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.IovLen))
   424      dst = dst[8:]
   425      hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.Control))
   426      dst = dst[8:]
   427      hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.ControlLen))
   428      dst = dst[8:]
   429      hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.Flags))
   430      dst = dst[4:]
   431      // Padding: dst[:sizeof(int32)] ~= int32(0)
   432      dst = dst[4:]
   433      return dst
   434  }
   435  
   436  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   437  func (m *MessageHeader64) UnmarshalBytes(src []byte) []byte {
   438      m.Name = uint64(hostarch.ByteOrder.Uint64(src[:8]))
   439      src = src[8:]
   440      m.NameLen = uint32(hostarch.ByteOrder.Uint32(src[:4]))
   441      src = src[4:]
   442      // Padding: var _ uint32 ~= src[:sizeof(uint32)]
   443      src = src[4:]
   444      m.Iov = uint64(hostarch.ByteOrder.Uint64(src[:8]))
   445      src = src[8:]
   446      m.IovLen = uint64(hostarch.ByteOrder.Uint64(src[:8]))
   447      src = src[8:]
   448      m.Control = uint64(hostarch.ByteOrder.Uint64(src[:8]))
   449      src = src[8:]
   450      m.ControlLen = uint64(hostarch.ByteOrder.Uint64(src[:8]))
   451      src = src[8:]
   452      m.Flags = int32(hostarch.ByteOrder.Uint32(src[:4]))
   453      src = src[4:]
   454      // Padding: var _ int32 ~= src[:sizeof(int32)]
   455      src = src[4:]
   456      return src
   457  }
   458  
   459  // Packed implements marshal.Marshallable.Packed.
   460  //go:nosplit
   461  func (m *MessageHeader64) Packed() bool {
   462      return true
   463  }
   464  
   465  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
   466  func (m *MessageHeader64) MarshalUnsafe(dst []byte) []byte {
   467      size := m.SizeBytes()
   468      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size))
   469      return dst[size:]
   470  }
   471  
   472  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
   473  func (m *MessageHeader64) UnmarshalUnsafe(src []byte) []byte {
   474      size := m.SizeBytes()
   475      gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size))
   476      return src[size:]
   477  }
   478  
   479  // CopyOutN implements marshal.Marshallable.CopyOutN.
   480  func (m *MessageHeader64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   481      // Construct a slice backed by dst's underlying memory.
   482      var buf []byte
   483      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   484      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m)))
   485      hdr.Len = m.SizeBytes()
   486      hdr.Cap = m.SizeBytes()
   487  
   488      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   489      // Since we bypassed the compiler's escape analysis, indicate that m
   490      // must live until the use above.
   491      runtime.KeepAlive(m) // escapes: replaced by intrinsic.
   492      return length, err
   493  }
   494  
   495  // CopyOut implements marshal.Marshallable.CopyOut.
   496  func (m *MessageHeader64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   497      return m.CopyOutN(cc, addr, m.SizeBytes())
   498  }
   499  
   500  // CopyIn implements marshal.Marshallable.CopyIn.
   501  func (m *MessageHeader64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   502      // Construct a slice backed by dst's underlying memory.
   503      var buf []byte
   504      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   505      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m)))
   506      hdr.Len = m.SizeBytes()
   507      hdr.Cap = m.SizeBytes()
   508  
   509      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   510      // Since we bypassed the compiler's escape analysis, indicate that m
   511      // must live until the use above.
   512      runtime.KeepAlive(m) // escapes: replaced by intrinsic.
   513      return length, err
   514  }
   515  
   516  // WriteTo implements io.WriterTo.WriteTo.
   517  func (m *MessageHeader64) WriteTo(writer io.Writer) (int64, error) {
   518      // Construct a slice backed by dst's underlying memory.
   519      var buf []byte
   520      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   521      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m)))
   522      hdr.Len = m.SizeBytes()
   523      hdr.Cap = m.SizeBytes()
   524  
   525      length, err := writer.Write(buf)
   526      // Since we bypassed the compiler's escape analysis, indicate that m
   527      // must live until the use above.
   528      runtime.KeepAlive(m) // escapes: replaced by intrinsic.
   529      return int64(length), err
   530  }
   531  
   532  // SizeBytes implements marshal.Marshallable.SizeBytes.
   533  func (m *multipleMessageHeader64) SizeBytes() int {
   534      return 8 +
   535          (*MessageHeader64)(nil).SizeBytes()
   536  }
   537  
   538  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   539  func (m *multipleMessageHeader64) MarshalBytes(dst []byte) []byte {
   540      dst = m.msgHdr.MarshalUnsafe(dst)
   541      hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.msgLen))
   542      dst = dst[4:]
   543      // Padding: dst[:sizeof(int32)] ~= int32(0)
   544      dst = dst[4:]
   545      return dst
   546  }
   547  
   548  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   549  func (m *multipleMessageHeader64) UnmarshalBytes(src []byte) []byte {
   550      src = m.msgHdr.UnmarshalUnsafe(src)
   551      m.msgLen = uint32(hostarch.ByteOrder.Uint32(src[:4]))
   552      src = src[4:]
   553      // Padding: var _ int32 ~= src[:sizeof(int32)]
   554      src = src[4:]
   555      return src
   556  }
   557  
   558  // Packed implements marshal.Marshallable.Packed.
   559  //go:nosplit
   560  func (m *multipleMessageHeader64) Packed() bool {
   561      return m.msgHdr.Packed()
   562  }
   563  
   564  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
   565  func (m *multipleMessageHeader64) MarshalUnsafe(dst []byte) []byte {
   566      if m.msgHdr.Packed() {
   567          size := m.SizeBytes()
   568          gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size))
   569          return dst[size:]
   570      }
   571      // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to MarshalBytes.
   572      return m.MarshalBytes(dst)
   573  }
   574  
   575  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
   576  func (m *multipleMessageHeader64) UnmarshalUnsafe(src []byte) []byte {
   577      if m.msgHdr.Packed() {
   578          size := m.SizeBytes()
   579          gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size))
   580          return src[size:]
   581      }
   582      // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
   583      return m.UnmarshalBytes(src)
   584  }
   585  
   586  // CopyOutN implements marshal.Marshallable.CopyOutN.
   587  func (m *multipleMessageHeader64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   588      if !m.msgHdr.Packed() {
   589          // Type multipleMessageHeader64 doesn't have a packed layout in memory, fall back to MarshalBytes.
   590          buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay.
   591          m.MarshalBytes(buf) // escapes: fallback.
   592          return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   593      }
   594  
   595      // Construct a slice backed by dst's underlying memory.
   596      var buf []byte
   597      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   598      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m)))
   599      hdr.Len = m.SizeBytes()
   600      hdr.Cap = m.SizeBytes()
   601  
   602      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   603      // Since we bypassed the compiler's escape analysis, indicate that m
   604      // must live until the use above.
   605      runtime.KeepAlive(m) // escapes: replaced by intrinsic.
   606      return length, err
   607  }
   608  
   609  // CopyOut implements marshal.Marshallable.CopyOut.
   610  func (m *multipleMessageHeader64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   611      return m.CopyOutN(cc, addr, m.SizeBytes())
   612  }
   613  
   614  // CopyIn implements marshal.Marshallable.CopyIn.
   615  func (m *multipleMessageHeader64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   616      if !m.msgHdr.Packed() {
   617          // Type multipleMessageHeader64 doesn't have a packed layout in memory, fall back to UnmarshalBytes.
   618          buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay.
   619          length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   620          // Unmarshal unconditionally. If we had a short copy-in, this results in a
   621          // partially unmarshalled struct.
   622          m.UnmarshalBytes(buf) // escapes: fallback.
   623          return length, err
   624      }
   625  
   626      // Construct a slice backed by dst's underlying memory.
   627      var buf []byte
   628      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   629      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m)))
   630      hdr.Len = m.SizeBytes()
   631      hdr.Cap = m.SizeBytes()
   632  
   633      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   634      // Since we bypassed the compiler's escape analysis, indicate that m
   635      // must live until the use above.
   636      runtime.KeepAlive(m) // escapes: replaced by intrinsic.
   637      return length, err
   638  }
   639  
   640  // WriteTo implements io.WriterTo.WriteTo.
   641  func (m *multipleMessageHeader64) WriteTo(writer io.Writer) (int64, error) {
   642      if !m.msgHdr.Packed() {
   643          // Type multipleMessageHeader64 doesn't have a packed layout in memory, fall back to MarshalBytes.
   644          buf := make([]byte, m.SizeBytes())
   645          m.MarshalBytes(buf)
   646          length, err := writer.Write(buf)
   647          return int64(length), err
   648      }
   649  
   650      // Construct a slice backed by dst's underlying memory.
   651      var buf []byte
   652      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   653      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m)))
   654      hdr.Len = m.SizeBytes()
   655      hdr.Cap = m.SizeBytes()
   656  
   657      length, err := writer.Write(buf)
   658      // Since we bypassed the compiler's escape analysis, indicate that m
   659      // must live until the use above.
   660      runtime.KeepAlive(m) // escapes: replaced by intrinsic.
   661      return int64(length), err
   662  }
   663