create rusage branch.
This commit is contained in:
@@ -1813,4 +1813,25 @@ int running_on_kvm(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
mod_nmi_ctx(void *nmi_ctx, void (*func)())
|
||||
{
|
||||
unsigned long *l = nmi_ctx;
|
||||
int i;
|
||||
unsigned long flags;
|
||||
|
||||
struct x86_cpu_local_variables *v;
|
||||
|
||||
if(!ihk_mc_get_processor_id()) {
|
||||
v = get_x86_this_cpu_local();
|
||||
}
|
||||
asm volatile("pushf; pop %0" : "=r"(flags) : : "memory", "cc");
|
||||
for (i = 0; i < 22; i++)
|
||||
l[i] = l[i + 5];
|
||||
l[i++] = (unsigned long)func; // return address
|
||||
l[i++] = 0x20; // KERNEL CS
|
||||
l[i++] = flags & ~RFLAGS_IF; // rflags (disable interrupt)
|
||||
l[i++] = (unsigned long)(l + 27); // ols rsp
|
||||
l[i++] = 0x28; // KERNEL DS
|
||||
}
|
||||
/*** end of file ***/
|
||||
|
||||
Reference in New Issue
Block a user