[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v15 8/9] target/loongarch: Adjust functions and structure to
From: |
Richard Henderson |
Subject: |
Re: [PATCH v15 8/9] target/loongarch: Adjust functions and structure to support user-mode |
Date: |
Sat, 11 Jun 2022 09:06:34 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
On 6/10/22 20:10, gaosong wrote:
pc 0x120000638 0x120000638 <main+32>
badvaddr 0x120000638 0x120000638 <main+32>
...
So badvaddr is the PC,
Yes.
void helper_asrtle_d(CPULoongArchState *env, target_ulong rj, target_ulong rk)
{
if (rj > rk) {
env->badvaddr = env->pc;
do_raise_exception(env, EXCCODE_BCE, env->badvaddr);
}
}
Well, not quite. The value of env->pc is not current; it is too expensive to update all
of the time. We need to recover that value by using TCG unwinding, e.g.:
if (rj > rk) {
cpu_restore_state(env_cpu(env), GETPC(), true);
env->badvaddr = env->pc;
However,
do_raise_exception(env, EXCCODE_ADEM, GETPC());
expects to do it's own cpu_restore_state via cpu_loop_exit_restore(), and we should not do
that twice.
Therefore, since the value of badvaddr is something that we can more easily recover later
than earlier, we should move the setting of badvaddr for ADEM to loongarch_cpu_do_interrupt():
case EXCCODE_ADEM:
env->badvaddr = env->pc;
cause = cs->exception_index;
break;
It is probably worthwhile to check how many other exceptions should be having
the same effect.
r~
- [PATCH v15 5/9] linux-user: Add LoongArch cpu_loop support, (continued)
- [PATCH v15 5/9] linux-user: Add LoongArch cpu_loop support, Song Gao, 2022/06/08
- [PATCH v15 4/9] linux-user: Add LoongArch syscall support, Song Gao, 2022/06/08
- [PATCH v15 8/9] target/loongarch: Adjust functions and structure to support user-mode, Song Gao, 2022/06/08
- Re: [PATCH v15 8/9] target/loongarch: Adjust functions and structure to support user-mode, WANG Xuerui, 2022/06/09
- Re: [PATCH v15 8/9] target/loongarch: Adjust functions and structure to support user-mode, Richard Henderson, 2022/06/09
- Re: [PATCH v15 8/9] target/loongarch: Adjust functions and structure to support user-mode, gaosong, 2022/06/10
- Re: [PATCH v15 8/9] target/loongarch: Adjust functions and structure to support user-mode, Richard Henderson, 2022/06/10
- Re: [PATCH v15 8/9] target/loongarch: Adjust functions and structure to support user-mode, gaosong, 2022/06/10
- Re: [PATCH v15 8/9] target/loongarch: Adjust functions and structure to support user-mode,
Richard Henderson <=
- Re: [PATCH v15 8/9] target/loongarch: Adjust functions and structure to support user-mode, gaosong, 2022/06/12
- Re: [PATCH v15 8/9] target/loongarch: Adjust functions and structure to support user-mode, Richard Henderson, 2022/06/13