Skip to content

Commit fc1f42e

Browse files
committed
workaround bug in bochscpu api, cpu id is not ignored, enforcing value 0
1 parent 0bdc939 commit fc1f42e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

examples/template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def outp_cb(sess: bochscpu.Session, cpu_id: int, len: int, val: int):
106106
pass
107107

108108

109-
def phy_access_cb(sess: bochscpu.Session, cpu_id: int, lin: int, phy: int, len: int, memtype: int, rw: int):
109+
def phy_access_cb(sess: bochscpu.Session, cpu_id: int, lin: int, phy: int, len: int, rw: int):
110110
pass
111111

112112

python/inc/bochscpu.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,9 @@ struct CPU
373373
{
374374
CPU()
375375
{
376-
this->id = g_sessionId++;
377-
this->__cpu = ::bochscpu_cpu_new(this->id);
376+
this->id = g_sessionId++;
377+
// this->__cpu = ::bochscpu_cpu_new(this->id);
378+
this->__cpu = ::bochscpu_cpu_new(0);
378379
if ( !this->__cpu )
379380
throw std::runtime_error("Invalid CPU ID");
380381
dbg("Created CPU#%lu", this->id);
@@ -617,7 +618,7 @@ struct Hook
617618
std::function<void(Session*, uint32_t, unsigned, uint64_t)> wrmsr;
618619
std::function<void(Session*, uint32_t, void*)> repeat_iteration;
619620
std::function<void(Session*, uint32_t, uint64_t, uint64_t, uintptr_t, uint32_t, uint32_t)> lin_access;
620-
std::function<void(Session*, uint32_t, uint64_t, uint64_t, uintptr_t, unsigned)> phy_access;
621+
std::function<void(Session*, uint32_t, uint64_t, uint64_t, uintptr_t, uint32_t)> phy_access;
621622
std::function<void(Session*, uint16_t, uintptr_t)> inp;
622623
std::function<void(Session*, uint16_t, uintptr_t, unsigned)> inp2;
623624
std::function<void(Session*, uint16_t, uintptr_t, unsigned)> outp;

0 commit comments

Comments
 (0)