Skip to content

ARM64 ESR cannot be read #1732

Closed
Closed
@liamwhite

Description

@liamwhite

In the following snippet

int main() {
    // ...
    uc_open(UC_ARCH_ARM64, UC_MODE_ARM, &uc);

    u64 fpv = 3ULL << 20;
    u64 psr = 0;
    uc_reg_write(uc, UC_ARM64_REG_CPACR_EL1, &fpv);
    uc_reg_write(uc, UC_ARM64_REG_PSTATE, &psr);

    uc_hook hook{};
    uc_hook_add(uc, &hook, UC_HOOK_INTR, (void*)InterruptHook, nullptr, 0, UINT64_MAX);
    // ...
}

void InterruptHook(uc_engine* uc, u32 int_no, void* user_data) {
    u64 esr{};
    uc_reg_read(uc, UC_ARM64_REG_ESR_EL1, &esr);
    
    // esr is always 0
}

, when guest code takes a syscall from EL0, then attempting to fetch the esr_el1 register only ever returns 0. (The esr_elX registers are all zero and none provide any information.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions