bindings: update to support X86 MSR id

This commit is contained in:
Nguyen Anh Quynh 2017-02-24 21:51:01 +08:00
parent fc72622ba8
commit f4325f8c4e
6 changed files with 14 additions and 9 deletions

View File

@ -257,7 +257,8 @@ module X86 =
let UC_X86_REG_TR = 245 let UC_X86_REG_TR = 245
let UC_X86_REG_FPCW = 246 let UC_X86_REG_FPCW = 246
let UC_X86_REG_FPTAG = 247 let UC_X86_REG_FPTAG = 247
let UC_X86_REG_ENDING = 248 let UC_X86_REG_MSR = 248
let UC_X86_REG_ENDING = 249
// X86 instructions // X86 instructions

View File

@ -252,7 +252,8 @@ const (
X86_REG_TR = 245 X86_REG_TR = 245
X86_REG_FPCW = 246 X86_REG_FPCW = 246
X86_REG_FPTAG = 247 X86_REG_FPTAG = 247
X86_REG_ENDING = 248 X86_REG_MSR = 248
X86_REG_ENDING = 249
// X86 instructions // X86 instructions

View File

@ -254,7 +254,8 @@ public interface X86Const {
public static final int UC_X86_REG_TR = 245; public static final int UC_X86_REG_TR = 245;
public static final int UC_X86_REG_FPCW = 246; public static final int UC_X86_REG_FPCW = 246;
public static final int UC_X86_REG_FPTAG = 247; public static final int UC_X86_REG_FPTAG = 247;
public static final int UC_X86_REG_ENDING = 248; public static final int UC_X86_REG_MSR = 248;
public static final int UC_X86_REG_ENDING = 249;
// X86 instructions // X86 instructions

View File

@ -357,11 +357,11 @@ class Uc(object):
if status != uc.UC_ERR_OK: if status != uc.UC_ERR_OK:
raise UcError(status) raise UcError(status)
# read from MSR # read from MSR - X86 only
def msr_read(self, msr_id): def msr_read(self, msr_id):
return self.reg_read(x86_const.UC_X86_REG_MSR, msr_id) return self.reg_read(x86_const.UC_X86_REG_MSR, msr_id)
# write to MSR # write to MSR - X86 only
def msr_write(self, msr_id, value): def msr_write(self, msr_id, value):
return self.reg_write(x86_const.UC_X86_REG_MSR, (msr_id, value)) return self.reg_write(x86_const.UC_X86_REG_MSR, (msr_id, value))

View File

@ -252,7 +252,8 @@ module Unicorn
UC_X86_REG_TR = 245 UC_X86_REG_TR = 245
UC_X86_REG_FPCW = 246 UC_X86_REG_FPCW = 246
UC_X86_REG_FPTAG = 247 UC_X86_REG_FPTAG = 247
UC_X86_REG_ENDING = 248 UC_X86_REG_MSR = 248
UC_X86_REG_ENDING = 249
# X86 instructions # X86 instructions

View File

@ -22,8 +22,8 @@ typedef struct uc_x86_mmr {
// Model-Specific Register structure, use this with UC_X86_REG_MSR (as the register ID) in // Model-Specific Register structure, use this with UC_X86_REG_MSR (as the register ID) in
// call to uc_reg_write/uc_reg_read() to manipulate MSRs. // call to uc_reg_write/uc_reg_read() to manipulate MSRs.
typedef struct uc_x86_msr { typedef struct uc_x86_msr {
uint32_t rid; uint32_t rid; // MSR id
uint64_t value; uint64_t value; // MSR value
} uc_x86_msr; } uc_x86_msr;
// Callback function for tracing SYSCALL/SYSENTER (for uc_hook_intr()) // Callback function for tracing SYSCALL/SYSENTER (for uc_hook_intr())
@ -83,7 +83,8 @@ typedef enum uc_x86_reg {
UC_X86_REG_R14D, UC_X86_REG_R15D, UC_X86_REG_R8W, UC_X86_REG_R9W, UC_X86_REG_R10W, UC_X86_REG_R14D, UC_X86_REG_R15D, UC_X86_REG_R8W, UC_X86_REG_R9W, UC_X86_REG_R10W,
UC_X86_REG_R11W, UC_X86_REG_R12W, UC_X86_REG_R13W, UC_X86_REG_R14W, UC_X86_REG_R15W, UC_X86_REG_R11W, UC_X86_REG_R12W, UC_X86_REG_R13W, UC_X86_REG_R14W, UC_X86_REG_R15W,
UC_X86_REG_IDTR, UC_X86_REG_GDTR, UC_X86_REG_LDTR, UC_X86_REG_TR, UC_X86_REG_FPCW, UC_X86_REG_IDTR, UC_X86_REG_GDTR, UC_X86_REG_LDTR, UC_X86_REG_TR, UC_X86_REG_FPCW,
UC_X86_REG_FPTAG, UC_X86_REG_MSR, UC_X86_REG_FPTAG,
UC_X86_REG_MSR, // Model-Specific Register
UC_X86_REG_ENDING // <-- mark the end of the list of registers UC_X86_REG_ENDING // <-- mark the end of the list of registers
} uc_x86_reg; } uc_x86_reg;