> On 16 Jun 2025, at 16:48, Peter Maydell <peter.mayd...@linaro.org> wrote: > > On Sat, 14 Jun 2025 at 13:50, <r...@wjsota.com> wrote: >> >> Hi! >> >> Is `qemu-aarch64 -cpu neoverse-n1` supposed to emulate the `retaa` >> instruction? >> >> I have a binary called `main_pac` compiled from >> https://learn.arm.com/learning-paths/servers-and-cloud-computing/pac/example/ >> . >> >> The compiling command is `aarch64-linux-gnu-gcc -march=armv8.5-a -fPIC >> -pedantic -Wall -Wextra -ggdb3 -O0 -mbranch-protection=standard >> -fno-stack-protector -fPIE -static main.c -o main_pac`. The binary includes >> the `paciasp` and `retaa` instructions associated with ARM PAC. >> >> ``` >> (gdb) disas main >> Dump of assembler code for function main: >> 0x0000000000400858 <+0>: paciasp >> 0x000000000040085c <+4>: stp x29, x30, [sp, #-32]! >> […] >> 0x0000000000400898 <+64>: ldp x29, x30, [sp], #32 >> 0x000000000040089c <+68>: retaa >> End of assembler dump. >> (gdb) quit >> ``` >> >> When emulated using `qemu-aarch64 -cpu neoverse-n1` , the program completes >> without issues. >> ``` >> user@dell-op7020:~/learning/arm_learning_path_pac$ qemu-aarch64 -cpu >> neoverse-n1 main_pac test >> Hello World! > > This might be a bug, but why are you compiling for armv8.5 and > then trying to run the code on a CPU type that isn't armv8.5 > in the first place?
It wasn’t intentional. I was just trying to learn about PAC from ARM’s Learning Path. I ran it on the wrong cpu by accident and was taken aback by the Illegal Instruction error. Then I got the idea to try it out on QEMU just for fun. That is how I found the unexpected behavior. Cheers, Solomon > > thanks > -- PMM