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