vnc: 0.945 instruction: 0.925 device: 0.911 socket: 0.907 graphic: 0.903 assembly: 0.900 other: 0.899 mistranslation: 0.896 KVM: 0.881 semantic: 0.876 boot: 0.852 network: 0.844 Hardfault when accessing FPSCR register QEMU release version: v6.0.0-rc2 command line: qemu-system-arm -machine mps3-an547 -nographic -kernel .elf -semihosting -semihosting-config enable=on,target=native host operating system: Linux ISCNR90TMR1S 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux guest operating system: none (bare metal) Observation: I am simulating embedded firmware for a Cortex-M55 device, using MPS3-AN547 machine. In the startup code I am accessing the FPSCR core register: unsigned int fpscr =__get_FPSCR(); fpscr = fpscr & (~FPU_FPDSCR_AHP_Msk); __set_FPSCR(fpscr); where the register access functions __get_FPSCR() and __set_FPSCR(fpscr) are taken from CMSIS_5 at ./CMSIS/Core/include/cmsis_gcc.h I observe hardfaults upon __get_FPSCR() and __set_FPSCR(fpscr). The same startup code works fine on the Arm Corstone-300 FVP. Does your code enable the FPU (via the CPACR and, if running in NonSecure) the NSACR? If not then a fault is exactly what you should expect. (I believe the FVP has a non-standard behaviour where it will enable the FPU by default even though real hardware does not behave that way.) Yes, I think I did: SCB->NSACR |= (3U << 10U); /* enable Non-secure access to CP10 and CP11 coprocessors */ __DSB(); __ISB(); SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */ (3U << 11U*2U) ); /* enable CP11 Full Access */ __DSB(); __ISB(); But I get a NOCP (no coprocessor) hard fault. Does the qemu mps3-an547 model contain the FPU by default or do I have to select it via the command line? Is there an example code / test case included in the qemu database where I can lookup the usage of mps3-an547 + FPU? Do you have a guest binary and QEMU commandline I can use to reproduce the issue ? Command line is qemu-system-arm -machine mps3-an547 -nographic -kernel test.elf -semihosting -semihosting-config enable=on,target=native Binary is attached. It does int main(int argc, char* argv[]) { SCB->NSACR |= (3U << 10U); /* enable Non-secure access to CP10 and CP11 coprocessors */ __DSB(); __ISB(); SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */ (3U << 11U*2U) ); /* enable CP11 Full Access */ __DSB(); __ISB(); // enable DL branch cache #define CCR (*((volatile unsigned int *)0xE000ED14)) #define CCR_DL (1 << 19) CCR |= CCR_DL; __ISB(); uint32_t result; __asm volatile ("VMRS %0, fpscr" : "=r" (result) ); // <-- NOCP hardfault printf("fpscr = 0x%08lx\r\n", result); __asm volatile ("VMRS %0, mvfr0" : "=r" (result) ); printf("mvfr0 = 0x%08lx\r\n", result); __asm volatile ("VMRS %0, mvfr1" : "=r" (result) ); printf("mvfr1 = 0x%08lx\r\n", result); __asm volatile ("VMRS %0, mvfr2" : "=r" (result) ); printf("mvfr2 = 0x%08lx\r\n", result); exit(0); } Thank you for your help! Thanks. This is a bug in the AN547 model -- we were accidentally turning off the FPU. I'll write a patch. NB that with that bug fixed your code then hits an UNDEF trying to do: 0x00000996: eef7 1a10 vmrs r1, mvfr0 Only A-profile CPUs have MVFR0 accessible via the vmrs instruction. For M-profile this register is memory-mapped, at 0xE000EF40. The bug fix for the QEMU part of this is https://