.global jump_to_userspace jump_to_userspace: mov $0x20 | 0x3, %ax movw %ax, %ds movw %ax, %es movw %ax, %fs movw %ax, %gs pushl $0x20 | 0x3 /* SS*/ pushl $0x00c00100 /* ESP */ pushf /* EFLAGS */ popl %eax orl $0x200, %eax pushl %eax /* Set interrupts */ pushl $0x18 | 0x3 /* CS */ pushl $0x00800000 /* EIP */ iret