All pastes #1389995 Raw Edit

Someone

public text v1 · immutable
#1389995 ·published 2009-04-12 21:22 UTC
rendered paste body
/* prot.S - protected mode code */

#define ASM	1
#include <mem.h>

        .code32
	.text
	.globl	enter_realmode, _enter_realmode
enter_realmode:
_enter_realmode:
	cli
	movl $realidtdesc,%eax
	lidt (%eax)
        movl %cr0, %eax
	xorl $(CR0_PE),%eax
	movl %eax,%cr0
	movw $(SEG_REAL),%ax
	movw %ax,%gs
	movw %ax,%fs
	movw %ax,%es
	movw %ax,%ds
        ljmpl $(SEG_REAL),$realmode_entry
     
	.code16
	.extern enter_protmode, _enter_protmode
	.text
realmode_entry:
_realmode_entry:
#sti
       jmpl enter_protmode
       nop