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

     1  // Copyright 2020 The gVisor Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  //go:build amd64
    16  // +build amd64
    17  
    18  package linux
    19  
    20  // PtraceRegs is the set of CPU registers exposed by ptrace. Source:
    21  // syscall.PtraceRegs.
    22  //
    23  // +marshal
    24  // +stateify savable
    25  type PtraceRegs struct {
    26  	R15      uint64
    27  	R14      uint64
    28  	R13      uint64
    29  	R12      uint64
    30  	Rbp      uint64
    31  	Rbx      uint64
    32  	R11      uint64
    33  	R10      uint64
    34  	R9       uint64
    35  	R8       uint64
    36  	Rax      uint64
    37  	Rcx      uint64
    38  	Rdx      uint64
    39  	Rsi      uint64
    40  	Rdi      uint64
    41  	Orig_rax uint64
    42  	Rip      uint64
    43  	Cs       uint64
    44  	Eflags   uint64
    45  	Rsp      uint64
    46  	Ss       uint64
    47  	Fs_base  uint64
    48  	Gs_base  uint64
    49  	Ds       uint64
    50  	Es       uint64
    51  	Fs       uint64
    52  	Gs       uint64
    53  }
    54  
    55  // InstructionPointer returns the address of the next instruction to
    56  // be executed.
    57  func (p *PtraceRegs) InstructionPointer() uint64 {
    58  	return p.Rip
    59  }
    60  
    61  // StackPointer returns the address of the Stack pointer.
    62  func (p *PtraceRegs) StackPointer() uint64 {
    63  	return p.Rsp
    64  }
    65  
    66  // SetStackPointer sets the stack pointer to the specified value.
    67  func (p *PtraceRegs) SetStackPointer(sp uint64) {
    68  	p.Rsp = sp
    69  }