Return to ring 0 after iret
Posted: Thu Feb 25, 2010 4:36 am
Hi all!
I am using x86 processor and I want to do some function in CPL1
after it I want to return in ring0. Is it possible?
I am using x86 processor and I want to do some function in CPL1
Code: Select all
#define __STR(X) #X
#define STR(X) __STR(X)
__asm__ __volatile__ (
"\tcli\n" //stop interupt
"\tmov $"STR(__MASTER_CONTROL_DS)", %%ax\n"
"\tmov %%ax, %%ds\n"
"\tmov %%ax, %%es\n"
"\tmov %%ax, %%fs\n"
"\tmov %%ax, %%gs\n"
"\tmov %%esp, %%eax"
"\tpushl $"STR(__MASTER_CONTROL_DS)"\n"
"\tpushl %%eax\n"
"\tpushl %1\n"
"\tpushl $"STR(__MASTER_CONTROL_CS)"\n"
"\tpushl $1f\n"
"\tiret\n"
"\t1:\n"
"\tcall %0\n"
"\tnop\n"
::"r"(addr), "r" (flags | X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | X86_EFLAGS_NT | 0x2): "eax", "memory");
#undef STR
#undef __STR