Your Location is: Home > Linux-kernel
What is the in-line assembly code for kernel preemption and disable interrupts?
I know that in kernel I can call
get_cpu() to disable kernel preemption and
local_irq_save(flags) to disable interrupt. I'm curious how can I still achieve the same goal without calling these functions. I have three questions,
I found that
cliinstruction is the one responsible for disabling interrupts. Therefore, I was wondering if the following in-line assembly,
asm volatile("cli": : :"memory");
is enough to disable interrupts. If It works, how can I check if it actually disables interrupts?
Is there any inline assembly instruction that I can use to disable kernel preemption?
I know it is not possible to disable interrupts from the userspace. I just wondering if somehow someone manages to run that
cliinstruction from the userspace. Will it still be able to disable the interrupts? If the answer is no then why?