qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v11 19/26] linux-user: Add LoongArch signal support


From: Richard Henderson
Subject: Re: [PATCH v11 19/26] linux-user: Add LoongArch signal support
Date: Wed, 24 Nov 2021 11:44:45 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 11/24/21 11:22 AM, gaosong wrote:
I see that  kernel  define  the fcc used type uint64_t,   and  used movgr2cf/movcf2gr save and restore the fcc0-fcc7. but  qemu define  fcc0-fcc7 as  bool cf[8] at target/loongarch/cpu.h,   how qemu can save/restore fcc,  Do you have any idea?
Does we can define the fcc   as   bool cf[8]  at  struct target_sigcontext?

No, you need to leave the declaration the same.

To create the uint64_t, you do what the kernel does in sc_save_fcc: insert each bit into the first bit of each byte.

static uint64_t read_all_fcc(CPULoongArchState *env)
{
    uint64_t ret = 0;

    for (int i = 0; i < 8; ++i) {
        ret |= (uint64_t)env->cf[i] << (i * 8);
    }
    return ret;
}

And similarly from sc_restore_fcc:

static void write_all_fcc(CPULoongArchState *env, uint64_t val)
{
    for (int i = 0; i < 8; ++i) {
        env->cf[i] = (val >> (i * 8)) & 1;
    }
}

Remembering that movcf2gr copies the least significant bit.


r~



reply via email to

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