inet.af/netstack@v0.0.0-20220214151720-7585b01ddccf/abi/linux/ptrace_arm64.go (about)

     1  // Copyright 2019 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 arm64
    16  // +build arm64
    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  	Regs   [31]uint64
    27  	Sp     uint64
    28  	Pc     uint64
    29  	Pstate uint64
    30  }
    31  
    32  // InstructionPointer returns the address of the next instruction to be
    33  // executed.
    34  func (p *PtraceRegs) InstructionPointer() uint64 {
    35  	return p.Pc
    36  }
    37  
    38  // StackPointer returns the address of the Stack pointer.
    39  func (p *PtraceRegs) StackPointer() uint64 {
    40  	return p.Sp
    41  }
    42  
    43  // SetStackPointer sets the stack pointer to the specified value.
    44  func (p *PtraceRegs) SetStackPointer(sp uint64) {
    45  	p.Sp = sp
    46  }