github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/loader/loader_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package loader 4 5 import ( 6 "context" 7 8 "github.com/metacubex/gvisor/pkg/state" 9 ) 10 11 func (v *VDSO) StateTypeName() string { 12 return "pkg/sentry/loader.VDSO" 13 } 14 15 func (v *VDSO) StateFields() []string { 16 return []string{ 17 "ParamPage", 18 "vdso", 19 "os", 20 "arch", 21 "phdrs", 22 } 23 } 24 25 func (v *VDSO) beforeSave() {} 26 27 // +checklocksignore 28 func (v *VDSO) StateSave(stateSinkObject state.Sink) { 29 v.beforeSave() 30 var phdrsValue []elfProgHeader 31 phdrsValue = v.savePhdrs() 32 stateSinkObject.SaveValue(4, phdrsValue) 33 stateSinkObject.Save(0, &v.ParamPage) 34 stateSinkObject.Save(1, &v.vdso) 35 stateSinkObject.Save(2, &v.os) 36 stateSinkObject.Save(3, &v.arch) 37 } 38 39 func (v *VDSO) afterLoad(context.Context) {} 40 41 // +checklocksignore 42 func (v *VDSO) StateLoad(ctx context.Context, stateSourceObject state.Source) { 43 stateSourceObject.Load(0, &v.ParamPage) 44 stateSourceObject.Load(1, &v.vdso) 45 stateSourceObject.Load(2, &v.os) 46 stateSourceObject.Load(3, &v.arch) 47 stateSourceObject.LoadValue(4, new([]elfProgHeader), func(y any) { v.loadPhdrs(ctx, y.([]elfProgHeader)) }) 48 } 49 50 func (e *elfProgHeader) StateTypeName() string { 51 return "pkg/sentry/loader.elfProgHeader" 52 } 53 54 func (e *elfProgHeader) StateFields() []string { 55 return []string{ 56 "Type", 57 "Flags", 58 "Off", 59 "Vaddr", 60 "Paddr", 61 "Filesz", 62 "Memsz", 63 "Align", 64 } 65 } 66 67 func (e *elfProgHeader) beforeSave() {} 68 69 // +checklocksignore 70 func (e *elfProgHeader) StateSave(stateSinkObject state.Sink) { 71 e.beforeSave() 72 stateSinkObject.Save(0, &e.Type) 73 stateSinkObject.Save(1, &e.Flags) 74 stateSinkObject.Save(2, &e.Off) 75 stateSinkObject.Save(3, &e.Vaddr) 76 stateSinkObject.Save(4, &e.Paddr) 77 stateSinkObject.Save(5, &e.Filesz) 78 stateSinkObject.Save(6, &e.Memsz) 79 stateSinkObject.Save(7, &e.Align) 80 } 81 82 func (e *elfProgHeader) afterLoad(context.Context) {} 83 84 // +checklocksignore 85 func (e *elfProgHeader) StateLoad(ctx context.Context, stateSourceObject state.Source) { 86 stateSourceObject.Load(0, &e.Type) 87 stateSourceObject.Load(1, &e.Flags) 88 stateSourceObject.Load(2, &e.Off) 89 stateSourceObject.Load(3, &e.Vaddr) 90 stateSourceObject.Load(4, &e.Paddr) 91 stateSourceObject.Load(5, &e.Filesz) 92 stateSourceObject.Load(6, &e.Memsz) 93 stateSourceObject.Load(7, &e.Align) 94 } 95 96 func init() { 97 state.Register((*VDSO)(nil)) 98 state.Register((*elfProgHeader)(nil)) 99 }