This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

A53 - How to change between 32bits to 64bits

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.

Top replies

Parents
  • 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
    }

Reply
  • 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
    }

Children