]> git.proxmox.com Git - mirror_qemu.git/commit
target/loongarch: Fix raise_mmu_exception() set wrong exception_index
authorSong Gao <gaosong@loongson.cn>
Tue, 1 Nov 2022 06:53:31 +0000 (14:53 +0800)
committerSong Gao <gaosong@loongson.cn>
Fri, 4 Nov 2022 09:09:50 +0000 (17:09 +0800)
commit8752b1306002237c39b3f849ca564c9db55c8b1f
tree762cbe102ac173040bc2f03e5ed9b7b94cf85b35
parenta6b129c8102668717370ec27490523fb1290ae5d
target/loongarch: Fix raise_mmu_exception() set wrong exception_index

When the address is invalid address, We should set exception_index
according to MMUAccessType, and EXCCODE_ADEF need't update badinstr.
Otherwise, The system enters an infinite loop. e.g:
run test.c on system mode
test.c:
    #include<stdio.h>

    void (*func)(int *);

    int main()
    {
        int i = 8;
        void *ptr = (void *)0x4000000000000000;
        func = ptr;
        func(&i);
        return 0;
    }

Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20221101073210.3934280-2-gaosong@loongson.cn>
target/loongarch/cpu.c
target/loongarch/tlb_helper.c