gitlab.com/Raven-IO/raven-delve@v1.22.4/pkg/proc/native/threads_windows_arm64.go (about)

     1  package native
     2  
     3  import (
     4  	"gitlab.com/Raven-IO/raven-delve/pkg/proc"
     5  	"gitlab.com/Raven-IO/raven-delve/pkg/proc/winutil"
     6  )
     7  
     8  func newContext() *winutil.ARM64CONTEXT {
     9  	return winutil.NewARM64CONTEXT()
    10  }
    11  
    12  func registers(t *nativeThread) (proc.Registers, error) {
    13  	context := newContext()
    14  
    15  	context.SetFlags(_CONTEXT_ALL)
    16  	err := t.getContext(context)
    17  	if err != nil {
    18  		return nil, err
    19  	}
    20  
    21  	return winutil.NewARM64Registers(context, t.dbp.iscgo), nil
    22  }
    23  
    24  func newRegisters(context *winutil.ARM64CONTEXT, TebBaseAddress uint64, iscgo bool) *winutil.ARM64Registers {
    25  	return winutil.NewARM64Registers(context, iscgo)
    26  }
    27  
    28  func (t *nativeThread) setContext(context *winutil.ARM64CONTEXT) error {
    29  	return _SetThreadContext(t.os.hThread, context)
    30  }
    31  
    32  func (t *nativeThread) getContext(context *winutil.ARM64CONTEXT) error {
    33  	return _GetThreadContext(t.os.hThread, context)
    34  }
    35  
    36  func (t *nativeThread) restoreRegisters(savedRegs proc.Registers) error {
    37  	return t.setContext(savedRegs.(*winutil.ARM64Registers).Context)
    38  }