-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'more-aggressive-traversal' into 'main'
More aggressive code traversal See merge request rewriting/ddisasm!1216
- Loading branch information
Showing
15 changed files
with
266 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.PHONY: clean check | ||
out.txt: ex | ||
@qemu-arm -L /usr/arm-linux-gnueabihf $^ > $@ | ||
|
||
ex: ex_original.s | ||
arm-linux-gnueabihf-gcc -nostartfiles -o $@ $^ | ||
clean: | ||
rm -f ex out.txt | ||
check: ex | ||
qemu-arm -L /usr/arm-linux-gnueabihf $^ > /tmp/res.txt | ||
@ diff out.txt /tmp/res.txt && echo TEST OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# This example has adr instructions referencing code | ||
# ADR won't include the least signficant bit that determines the decode mode | ||
# So thumb_to_thumb and arm_to_thumb transitions need to add 1 to the relative address | ||
|
||
.syntax unified | ||
.section .text | ||
|
||
.align 2 | ||
.arm | ||
.global _start | ||
_start: | ||
adr r2, arm_to_arm | ||
mov pc, r2 | ||
bl exit | ||
|
||
.type arm_to_arm, %function | ||
arm_to_arm: | ||
ldr r0, =ok1_str | ||
bl puts | ||
adr r2, arm_to_thumb | ||
# adr won't capture the bit in the label so we need to add 1 to change mode | ||
add r2, r2, #1 | ||
bx r2 | ||
|
||
|
||
.thumb | ||
.type arm_to_thumb, %function | ||
arm_to_thumb: | ||
ldr r0, =ok2_str | ||
bl puts | ||
adr r2, thumb_to_thumb | ||
# adr won't capture the bit in the pc to stay in thumb mode. | ||
add r2, r2, #1 | ||
bx r2 | ||
|
||
.type thumb_to_thumb, %function | ||
thumb_to_thumb: | ||
ldr r0, =ok3_str | ||
bl puts | ||
adr r2, thumb_to_arm | ||
bx r2 | ||
.arm | ||
.type thumb_to_arm, %function | ||
thumb_to_arm: | ||
ldr r0, =ok4_str | ||
bl puts | ||
mov r0, #0 | ||
bl exit | ||
|
||
.global main | ||
.type main, %function | ||
.thumb | ||
.align 2 | ||
main: | ||
push { lr } | ||
mov r0, #0 | ||
pop { pc } | ||
|
||
.section .rodata | ||
ok1_str: | ||
.ascii "OK1\n\0" | ||
ok2_str: | ||
.ascii "OK2\n\0" | ||
ok3_str: | ||
.ascii "OK3\n\0" | ||
ok4_str: | ||
.ascii "OK4\n\0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.