mirror of
https://github.com/vee1e/speakeasy.git
synced 2026-09-01 19:07:23 +00:00
update order of operations for initialization of kernel emulator. add get_pc interface for speakeasy.
This commit is contained in:
parent
68dda8eab0
commit
c0d28e82cf
2 changed files with 19 additions and 10 deletions
|
|
@ -770,6 +770,15 @@ class Speakeasy(object):
|
|||
"""
|
||||
self.emu.set_stack_ptr(addr)
|
||||
|
||||
def get_pc(self) -> int:
|
||||
"""
|
||||
Get the value of the current program counter
|
||||
|
||||
return:
|
||||
value of the program counter
|
||||
"""
|
||||
return self.emu.get_pc()
|
||||
|
||||
def set_pc(self, addr: int) -> None:
|
||||
"""
|
||||
Set the value of the current program counter
|
||||
|
|
|
|||
|
|
@ -164,6 +164,16 @@ class WinKernelEmulator(WindowsEmulator, IoManager):
|
|||
if s not in self.profiler.strings['unicode']:
|
||||
self.profiler.strings['unicode'].append(s)
|
||||
|
||||
# Set the emulator to run in protected mode
|
||||
self._setup_gdt(self.get_arch())
|
||||
|
||||
self.setup_kernel_mode()
|
||||
|
||||
self.setup_user_shared_data()
|
||||
|
||||
if not self.stack_base:
|
||||
self.stack_base, stack_ptr = self.alloc_stack(pe.stack_commit)
|
||||
|
||||
# Init imported data
|
||||
for addr, imp in pe.imports.items():
|
||||
mn, fn = imp
|
||||
|
|
@ -176,16 +186,6 @@ class WinKernelEmulator(WindowsEmulator, IoManager):
|
|||
data_ptr.to_bytes(self.get_ptr_size(),
|
||||
'little'))
|
||||
|
||||
# Set the emulator to run in protected mode
|
||||
self._setup_gdt(self.get_arch())
|
||||
|
||||
self.setup_kernel_mode()
|
||||
|
||||
self.setup_user_shared_data()
|
||||
|
||||
if not self.stack_base:
|
||||
self.stack_base, stack_ptr = self.alloc_stack(pe.stack_commit)
|
||||
|
||||
return pe
|
||||
|
||||
def pool_alloc(self, pooltype, size, tag='None'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue