github.com/Rookout/GoSDK@v0.1.48/pkg/services/assembler/regs.go (about)

     1  package assembler
     2  
     3  var dwarfRegToAsmReg = func() map[uint64]Reg {
     4  	mapping := make(map[uint64]Reg, len(asmRegToSysReg))
     5  	for asmReg, sysReg := range asmRegToSysReg {
     6  		if dwarfReg, ok := sysRegToDwarfReg[sysReg]; ok {
     7  			mapping[uint64(dwarfReg)] = asmReg
     8  		}
     9  	}
    10  	return mapping
    11  }()
    12  
    13  func AsmRegToSysReg(reg Reg) int16 {
    14  	return asmRegToSysReg[reg]
    15  }
    16  
    17  func DwarfRegToAsmReg(reg uint64) (Reg, bool) {
    18  	res, ok := dwarfRegToAsmReg[reg]
    19  	return res, ok
    20  }