Where is the set_c0_status() function defined?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Where is the set_c0_status() function defined?



The code at:



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



Uses the function or macro set_c0_status()



Where is that defined?
If this is built into the GCC MIPS compiler, then where is it documented ?





Really puzzling! I'm no kernel expert, but it is the first time I can't find the declaration of a function!
– Arash Kazemi
21 mins ago






2 Answers
2



I found this in 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");
}



and the write_c0_status is defined in mipsregs.h ( https://elixir.bootlin.com/linux/latest/source/arch/mips/include/asm/mipsregs.h#L1639 ), So I guess you should look there for the answer.



The set_c0_status function is defined in mipsregs.h and expanded by the following macro hierarchy:


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)






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

Future solutions