Skip to content

Commit b3e32d6

Browse files
committed
[embedded] Use an explicit asm sequence in qemu_exit instead of 'register asm()'
1 parent 0e985f1 commit b3e32d6

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

utils/embedded-test-support/arm-qemu-stm32f1/support.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ __attribute((section(".vectors"))) void *vector_table[114] = {
4848
};
4949

5050
void qemu_exit() {
51-
register uintptr_t a asm("r0") = 0x18;
52-
register uintptr_t b asm("r1") = 0x20026;
53-
__asm__ volatile("BKPT #0xAB" : : "r"(a), "r"(b));
51+
__asm__ volatile("mov r0, #0x18");
52+
__asm__ volatile("movw r1, #0x0026");
53+
__asm__ volatile("movt r1, #0x2"); // construct 0x20026 in r1
54+
__asm__ volatile("bkpt #0xab");
5455
}
5556

5657
int putchar(int c) {

utils/embedded-test-support/arm-qemu-stm32f4/support.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ __attribute((section(".vectors"))) void *vector_table[114] = {
4848
};
4949

5050
void qemu_exit() {
51-
register uintptr_t a asm("r0") = 0x18;
52-
register uintptr_t b asm("r1") = 0x20026;
53-
__asm__ volatile("BKPT #0xAB" : : "r"(a), "r"(b));
51+
__asm__ volatile("mov r0, #0x18");
52+
__asm__ volatile("movw r1, #0x0026");
53+
__asm__ volatile("movt r1, #0x2"); // construct 0x20026 in r1
54+
__asm__ volatile("bkpt #0xab");
5455
}
5556

5657
int putchar(int c) {

0 commit comments

Comments
 (0)