// automatically generated by stateify.

//go:build amd64 && amd64 && amd64 && amd64 && amd64 && amd64
// +build amd64,amd64,amd64,amd64,amd64,amd64

package linux

import (
	"context"

	"github.com/sagernet/gvisor/pkg/state"
)

func (p *PtraceRegs) StateTypeName() string {
	return "pkg/abi/linux.PtraceRegs"
}

func (p *PtraceRegs) StateFields() []string {
	return []string{
		"R15",
		"R14",
		"R13",
		"R12",
		"Rbp",
		"Rbx",
		"R11",
		"R10",
		"R9",
		"R8",
		"Rax",
		"Rcx",
		"Rdx",
		"Rsi",
		"Rdi",
		"Orig_rax",
		"Rip",
		"Cs",
		"Eflags",
		"Rsp",
		"Ss",
		"Fs_base",
		"Gs_base",
		"Ds",
		"Es",
		"Fs",
		"Gs",
	}
}

func (p *PtraceRegs) beforeSave() {}

// +checklocksignore
func (p *PtraceRegs) StateSave(stateSinkObject state.Sink) {
	p.beforeSave()
	stateSinkObject.Save(0, &p.R15)
	stateSinkObject.Save(1, &p.R14)
	stateSinkObject.Save(2, &p.R13)
	stateSinkObject.Save(3, &p.R12)
	stateSinkObject.Save(4, &p.Rbp)
	stateSinkObject.Save(5, &p.Rbx)
	stateSinkObject.Save(6, &p.R11)
	stateSinkObject.Save(7, &p.R10)
	stateSinkObject.Save(8, &p.R9)
	stateSinkObject.Save(9, &p.R8)
	stateSinkObject.Save(10, &p.Rax)
	stateSinkObject.Save(11, &p.Rcx)
	stateSinkObject.Save(12, &p.Rdx)
	stateSinkObject.Save(13, &p.Rsi)
	stateSinkObject.Save(14, &p.Rdi)
	stateSinkObject.Save(15, &p.Orig_rax)
	stateSinkObject.Save(16, &p.Rip)
	stateSinkObject.Save(17, &p.Cs)
	stateSinkObject.Save(18, &p.Eflags)
	stateSinkObject.Save(19, &p.Rsp)
	stateSinkObject.Save(20, &p.Ss)
	stateSinkObject.Save(21, &p.Fs_base)
	stateSinkObject.Save(22, &p.Gs_base)
	stateSinkObject.Save(23, &p.Ds)
	stateSinkObject.Save(24, &p.Es)
	stateSinkObject.Save(25, &p.Fs)
	stateSinkObject.Save(26, &p.Gs)
}

func (p *PtraceRegs) afterLoad(context.Context) {}

// +checklocksignore
func (p *PtraceRegs) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &p.R15)
	stateSourceObject.Load(1, &p.R14)
	stateSourceObject.Load(2, &p.R13)
	stateSourceObject.Load(3, &p.R12)
	stateSourceObject.Load(4, &p.Rbp)
	stateSourceObject.Load(5, &p.Rbx)
	stateSourceObject.Load(6, &p.R11)
	stateSourceObject.Load(7, &p.R10)
	stateSourceObject.Load(8, &p.R9)
	stateSourceObject.Load(9, &p.R8)
	stateSourceObject.Load(10, &p.Rax)
	stateSourceObject.Load(11, &p.Rcx)
	stateSourceObject.Load(12, &p.Rdx)
	stateSourceObject.Load(13, &p.Rsi)
	stateSourceObject.Load(14, &p.Rdi)
	stateSourceObject.Load(15, &p.Orig_rax)
	stateSourceObject.Load(16, &p.Rip)
	stateSourceObject.Load(17, &p.Cs)
	stateSourceObject.Load(18, &p.Eflags)
	stateSourceObject.Load(19, &p.Rsp)
	stateSourceObject.Load(20, &p.Ss)
	stateSourceObject.Load(21, &p.Fs_base)
	stateSourceObject.Load(22, &p.Gs_base)
	stateSourceObject.Load(23, &p.Ds)
	stateSourceObject.Load(24, &p.Es)
	stateSourceObject.Load(25, &p.Fs)
	stateSourceObject.Load(26, &p.Gs)
}

func init() {
	state.Register((*PtraceRegs)(nil))
}
