Skip to content

Commit

Permalink
Added debug logging to register sync and some final comments
Browse files Browse the repository at this point in the history
  • Loading branch information
albrecht-flo committed Mar 21, 2023
1 parent fbac386 commit 7271ec5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions avatar2/archs/arm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# from capstone import CS_ARCH_ARM, CS_MODE_LITTLE_ENDIAN, CS_MODE_BIG_ENDIAN

from capstone import *
from keystone.keystone_const import *
from unicorn import *
Expand All @@ -19,6 +17,7 @@ class ARM(Architecture):

qemu_name = 'arm'
gdb_name = 'arm'
# Based on gdb profile
registers = {'r0': 0, 'r1': 1, 'r2': 2, 'r3': 3, 'r4': 4, 'r5': 5, 'r6': 6,
'r7': 7, 'r8': 8, 'r9': 9, 'r10': 10, 'r11': 11, 'r12': 12, 'ip': 12,
'sp': 13, 'lr': 14, 'pc': 15, 'cpsr': 25,
Expand Down Expand Up @@ -53,6 +52,7 @@ class ARM_CORTEX_M3(ARM):
unicorn_arch = UC_ARCH_ARM
unicorn_mode = UC_MODE_LITTLE_ENDIAN | UC_MODE_THUMB
sr_name = 'xpsr'
# The xpsr register has different register numbers across QEmu and OpenOCD, so we make sure to read/write it only by name
special_registers = {'xpsr': {'gdb_expression': "$xpsr", 'format': "{:d}"}}

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions avatar2/avatar2.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ def transfer_state(self, from_target, to_target, sync_regs=True, synced_ranges=[
# Sync the registers!
for r in regs:
val = from_target.read_register(r)
self.log.debug("Synchronizing register %6s (%s) " % (r, val))
to_target.write_register(r, val)
self.log.info("Synchronized Registers")

Expand Down
2 changes: 1 addition & 1 deletion generate_dockerfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

DESCRIPTION="Script to build avatar2 core and its endpoints using Docker."
USAGE=""" generate_dockerfile.py [options]
Exemple:
Example:
./generate_dockerfile.py \\
--endpoint_list avatar-qemu panda \\
--qemu_targets arm-softmmu mips-softmmu
Expand Down

0 comments on commit 7271ec5

Please sign in to comment.