diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2019-04-17 18:15:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-17 18:15:10 +0200 |
| commit | a75ac6e9ca986d5d1aa1f6d0b7b21a8895de1bad (patch) | |
| tree | 03ad61eef00e1a97ff252577262353c568b1c351 | |
| parent | 74254d1b9174ed9265908d79914f50284c8bd96f (diff) | |
| parent | 5637a0f468beaba3bbd6920fa980504e282b7d06 (diff) | |
| download | miasm-a75ac6e9ca986d5d1aa1f6d0b7b21a8895de1bad.tar.gz miasm-a75ac6e9ca986d5d1aa1f6d0b7b21a8895de1bad.zip | |
Merge pull request #988 from WilliamBruneau/more_cpuid
Add some x86_cpuid indexes implementations
| -rw-r--r-- | miasm/jitter/emulatedsymbexec.py | 30 | ||||
| -rw-r--r-- | miasm/jitter/op_semantics.c | 35 |
2 files changed, 65 insertions, 0 deletions
diff --git a/miasm/jitter/emulatedsymbexec.py b/miasm/jitter/emulatedsymbexec.py index 4355c0b9..35986fb9 100644 --- a/miasm/jitter/emulatedsymbexec.py +++ b/miasm/jitter/emulatedsymbexec.py @@ -19,6 +19,36 @@ class EmulatedSymbExec(SymbolicExecutionEngine): 2: 0x00000209, 3: 0x078bf9ff }, + 2: { + 0: 0, + 1: 0, + 2: 0, + 3: 0 + }, + 4: { + 0: 0, + 1: 0, + 2: 0, + 3: 0 + }, + 7: { + 0: 0, + 1: (1 << 0) | (1 << 3), + 2: 0, + 3: 0 + }, + 0x80000000: { + 0: 0x80000008, + 1: 0, + 2: 0, + 3: 0 + }, + 0x80000001: { + 0: 0, + 1: 0, + 2: (1 << 0) | (1 << 8), + 3: (1 << 11) | (1 << 29), + }, } def __init__(self, cpu, vm, *args, **kwargs): diff --git a/miasm/jitter/op_semantics.c b/miasm/jitter/op_semantics.c index 79dcdcf4..6725ae64 100644 --- a/miasm/jitter/op_semantics.c +++ b/miasm/jitter/op_semantics.c @@ -380,6 +380,41 @@ unsigned int x86_cpuid(unsigned int a, unsigned int reg_num) return 0x00000000; } } + // Extended Function CPUID Information + else if (a == 0x80000000){ + switch(reg_num){ + case 0: + // Pentium 4 Processor supporting Hyper-Threading + // Technology to Intel Xeon Processor 5100 Series + return 0x80000008; + case 1: + return 0x00000000; + case 2: + return 0x00000000; + case 3: + return 0x00000000; + } + } + else if (a == 0x80000001){ + switch(reg_num){ + case 0: + // Extended Processor Signature and Extended Feature + // Bits + return 0x00000000; + case 1: + return 0x00000000; + case 2: + return (/* LAHF-SAHF */ 1 << 0) + | (/* LZCNT */ 0 << 5) + | (/* PREFETCHW */ 1 << 8); + case 3: + return (/* SYSCALL/SYSRET */ 1 << 11) + | (/* Execute Disable Bit available */ 0 << 20) + | (/* 1-GByte pages available */ 0 << 26) + | (/* RDTSCP and IA32_TSC_AUX available */ 0 << 27) + | (/* Intel ® 64 Architecture available */ 1 << 29); + } + } else{ fprintf(stderr, "WARNING not implemented x86_cpuid index %X!\n", a); exit(EXIT_FAILURE); |