#include "usermode.h" void install_tss(int cpu_no){ // now fill each value // set values necessary sys_tss.ss0 = 0x10; // now set the IO bitmap (not necessary, so set above limit) sys_tss.iomap = ( unsigned short ) sizeof( tss_struct ); } void switch_to_user_mode() { // Set up a stack structure for switching to user mode. asm volatile(" \ cli; \ mov $0x23, %ax; \ mov %ax, %ds; \ mov %ax, %es; \ mov %ax, %fs; \ mov %ax, %gs; \ \ mov %esp, %eax; \ pushl $0x23; \ pushl %eax; \ pushf; \ mov $0x200, %eax; \ push %eax; \ pushl $0x1B; \ push $1f; \ iret; \ 1: \ "); }