[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 4/6] linux-user/elfload: Introduce MIPS GET_FEATURE_REG_EQ
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v2 4/6] linux-user/elfload: Introduce MIPS GET_FEATURE_REG_EQU() macro |
Date: |
Tue, 1 Dec 2020 20:00:26 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 |
On 12/1/20 6:36 PM, Richard Henderson wrote:
> On 12/1/20 7:35 AM, Philippe Mathieu-Daudé wrote:
>> +#define GET_FEATURE_REG_EQU(_reg, _mask, _val, _hwcap) \
>> + do { \
>> + if ((cpu->env._reg & (_mask)) == _val) { \
>> + hwcaps |= _hwcap; \
>> + } \
>> + } while (0)
>> +
>> static uint32_t get_elf_hwcap(void)
>> {
>> MIPSCPU *cpu = MIPS_CPU(thread_cpu);
>> uint32_t hwcaps = 0;
>>
>> - GET_FEATURE_INSN(ISA_MIPS32R6 | ISA_MIPS64R6, HWCAP_MIPS_R6);
>> + GET_FEATURE_REG_EQU(CP0_Config0, 7 << CP0C0_AR, 2, HWCAP_MIPS_R6);
>
> You'd need 2 << CP0C0_AR for the equality to match.
Oops...
> Would it be better to have the shift as a separate argument?
Yes, thanks!
Phil.
- [PATCH v2 0/6] linux-user: Rework get_elf_hwcap() and support MIPS Loongson 2F/3E, Philippe Mathieu-Daudé, 2020/12/01
- [PATCH v2 1/6] linux-user/elfload: Move GET_FEATURE macro out of get_elf_hwcap() body, Philippe Mathieu-Daudé, 2020/12/01
- [PATCH v2 2/6] linux-user/elfload: Rename MIPS GET_FEATURE() as GET_FEATURE_INSN(), Philippe Mathieu-Daudé, 2020/12/01
- [PATCH v2 3/6] linux-user/elfload: Introduce MIPS GET_FEATURE_REG_SET() macro, Philippe Mathieu-Daudé, 2020/12/01
- [PATCH v2 5/6] linux-user/elfload: Update HWCAP bits from linux 5.7, Philippe Mathieu-Daudé, 2020/12/01
- [PATCH v2 4/6] linux-user/elfload: Introduce MIPS GET_FEATURE_REG_EQU() macro, Philippe Mathieu-Daudé, 2020/12/01
- [PATCH v2 6/6] linux-user: Add support for MIPS Loongson 2F/3E, Philippe Mathieu-Daudé, 2020/12/01