We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
We run our operation code in 32 bits mode but we have a need to change to 64bits mode just for one instruction. How can I go to 64bits mode, execute one instruction and go back to 32 bits mode.
You cannot. If you run in 64Bit EL1 you can execute 32bit EL0, but if you are in 32Bit EL1 you are stuck.
What instruction do you want to execute?
Need to write to 64bits address range. we have function to read from 64bits. I am trying to understand this code.
FAST_PATH_CODE static inline uint32_t read_from_64bit_address(uint64_t address) { #if defined(__GNUC__) && defined(__arm__) uint32_t address_upper = (uint32_t)(address >> 32); uint32_t address_lower = (uint32_t)(address); register uint32_t result asm("r0"); asm volatile ( "mov r0, %[command]\n" "mov r1, %[addr_upper]\n" "mov r2, %[addr_lower]\n" "smc #0\n" : "=r&" (result) : [addr_upper] "r" (address_upper), [addr_lower] "r" (address_lower), [command] "g" (SMC_LONG_ADDRESS_READ_SINGLE) : "r1", "r2"); return result; #else // only supports production builds // for sim builds, just return the address by direct de-referencing return (*((volatile uint32_t*)(address))); #endif }
At first, please use "insert->insert code" when posting code. Then, why not post at first.
So now to your code: It calls the monitor (EL3) which runs in 64bit mode and does the read on behalf of your application (running in EL1).
So you need to have also a write function in the monitor.
Thanks