aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/boot/pmjump.S
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-07-11 15:18:53 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-12 13:55:55 -0400
commit7052fdd890bda0b3904674b69a1d24aec0a10d67 (patch)
treeaffabf35de94117520a70a6a0b289e236beb4344 /arch/i386/boot/pmjump.S
parent5e8ddcbe8692ca9854991c6875d302fa7e424e3c (diff)
Code for actual protected-mode entry
This is the code which actually does the switch to protected mode, including all preparation. It is also responsible for invoking the boot loader hooks, if present. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/i386/boot/pmjump.S')
-rw-r--r--arch/i386/boot/pmjump.S54
1 files changed, 54 insertions, 0 deletions
diff --git a/arch/i386/boot/pmjump.S b/arch/i386/boot/pmjump.S
new file mode 100644
index 000000000000..2e559233725a
--- /dev/null
+++ b/arch/i386/boot/pmjump.S
@@ -0,0 +1,54 @@
1/* ----------------------------------------------------------------------- *
2 *
3 * Copyright (C) 1991, 1992 Linus Torvalds
4 * Copyright 2007 rPath, Inc. - All Rights Reserved
5 *
6 * This file is part of the Linux kernel, and is made available under
7 * the terms of the GNU General Public License version 2.
8 *
9 * ----------------------------------------------------------------------- */
10
11/*
12 * arch/i386/boot/pmjump.S
13 *
14 * The actual transition into protected mode
15 */
16
17#include <asm/boot.h>
18#include <asm/segment.h>
19
20 .text
21
22 .globl protected_mode_jump
23 .type protected_mode_jump, @function
24
25 .code16
26
27/*
28 * void protected_mode_jump(u32 entrypoint, u32 bootparams);
29 */
30protected_mode_jump:
31 xorl %ebx, %ebx # Flag to indicate this is a boot
32 movl %edx, %esi # Pointer to boot_params table
33 movl %eax, 2f # Patch ljmpl instruction
34 jmp 1f # Short jump to flush instruction q.
35
361:
37 movw $__BOOT_DS, %cx
38
39 movl %cr0, %edx
40 orb $1, %dl # Protected mode (PE) bit
41 movl %edx, %cr0
42
43 movw %cx, %ds
44 movw %cx, %es
45 movw %cx, %fs
46 movw %cx, %gs
47 movw %cx, %ss
48
49 # Jump to the 32-bit entrypoint
50 .byte 0x66, 0xea # ljmpl opcode
512: .long 0 # offset
52 .word __BOOT_CS # segment
53
54 .size protected_mode_jump, .-protected_mode_jump