qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 01/11] riscv: Add privilege level to DisasContext


From: Richard Henderson
Subject: Re: [PATCH 01/11] riscv: Add privilege level to DisasContext
Date: Fri, 16 Sep 2022 08:05:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 9/16/22 08:00, Richard Henderson wrote:
Or, keep the field, because it's usage will be more self-documentary, but copy the value from ctx->mmu_idx and add a comment.

Or, add an inline function like

static inline int priv_level(DisasContext *ctx)
{
#ifdef CONFIG_USER_ONLY
    return PRV_U;
#else
    /* Priv level equals mmu index -- see cpu_mmu_index. */
    return ctx->mmu_idx;
#endif
}

so that usages within a user-only build are compile-time constant and folded 
away.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]