Skip to content

Commit 6cfc08f

Browse files
authored
Merge pull request below#63 from rosshjb/fmt-str-fix
fix: debug format string
2 parents 35a5e91 + e1371dd commit 6cfc08f

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

Chapter 09/debug.s

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
stp X14, X15, [SP, #-16]!
1515
stp X16, X17, [SP, #-16]!
1616
stp X18, LR, [SP, #-16]!
17+
mov X1, #\reg // for the %u
1718
mov X2, X\reg // for the %d
1819
mov X3, X\reg // for the %x
19-
mov X1, #\reg
20-
add X1, X1, #'0' // for %c
2120
str X1, [SP, #-32]! // Move the stack pointer four doublewords (32 bytes) down and push X1 onto the stack
2221
str X2, [SP, #8] // Push X2 to one doubleword above the current stack pointer
2322
str X3, [SP, #16] // Push X3 to two doublewords above the current stack pointer
@@ -67,6 +66,6 @@
6766
.endm
6867

6968
.data
70-
ptfStr: .asciz "X%c = %32ld, 0x%016lx\n"
69+
ptfStr: .asciz "X%-2u = %32ld, 0x%016lx\n"
7170
.align 4
7271
.text

Chapter 11/debug.s

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
stp X14, X15, [SP, #-16]!
1515
stp X16, X17, [SP, #-16]!
1616
stp X18, LR, [SP, #-16]!
17+
mov X1, #\reg // for the %u
1718
mov X2, X\reg // for the %d
1819
mov X3, X\reg // for the %x
19-
mov X1, #\reg
20-
add X1, X1, #'0' // for %c
2120
str X1, [SP, #-32]! // Move the stack pointer four doublewords (32 bytes) down and push X1 onto the stack
2221
str X2, [SP, #8] // Push X2 to one doubleword above the current stack pointer
2322
str X3, [SP, #16] // Push X3 to two doublewords above the current stack pointer
@@ -67,6 +66,6 @@
6766
.endm
6867

6968
.data
70-
ptfStr: .asciz "X%c = %32ld, 0x%016lx\n"
69+
ptfStr: .asciz "X%-2u = %32ld, 0x%016lx\n"
7170
.align 4
7271
.text

0 commit comments

Comments
 (0)