set_c0_status()函数在哪里定义?

时间:2018-07-27 09:19:52

标签: gcc mips

代码位于:

https://github.com/intel/linux-intel-4.9/blob/master/arch/mips/cavium-octeon/octeon-irq.c

使用函数或宏 set_c0_status()

定义在哪里?
如果将它内置在GCC MIPS编译器中,那么它在哪里记录?

2 个答案:

答案 0 :(得分:1)

set_c0_status函数在mipsregs.h中定义,并通过以下宏层次结构进行扩展:

https://github.com/torvalds/linux/blob/master/arch/mips/include/asm/mipsregs.h

/*
 * Manipulate bits in a register.
 */
#define __BUILD_SET_COMMON(name)                                \
static inline unsigned int                                      \

set_##name(unsigned int set)                                    \
{                                                               \
        unsigned int res, new;                                  \
                                                                \
        res = read_##name();                                    \
        new = res | set;                                        \
        write_##name(new);                                      \
                                                                \
        return res;                                             \
}                                                               \

...

/*
 * Manipulate bits in a c0 register.
 */
#define __BUILD_SET_C0(name)    __BUILD_SET_COMMON(c0_##name)

__BUILD_SET_C0(status)

答案 1 :(得分:1)

我在arch / mips / kvm / kvm_mips.c中找到了这个

static
void kvm_mips_set_c0_status (void)
{
    uint32_t status = read_c0_status();

    if (cpu_has_fpu)
    status |= (ST0_CU1);

    if (cpu_has_dsp)
    status |= (ST0_MX);

    write_c0_status(status);
    __asm volatile ("ehb");
}

并且mipsregs.h(https://elixir.bootlin.com/linux/latest/source/arch/mips/include/asm/mipsregs.h#L1639)中定义了write_c0_status,所以我想您应该在那寻找答案。