/* ----------------------------------------------------------------------- *1*2* Copyright (C) 1991, 1992 Linus Torvalds3* Copyright 2007 rPath, Inc. - All Rights Reserved4*5* This file is part of the Linux kernel, and is made available under6* the terms of the GNU General Public License version 2.7*8* ----------------------------------------------------------------------- */910/*11* The actual transition into protected mode12*/1314#include <asm/boot.h>15#include <asm/processor-flags.h>16#include <asm/segment.h>17#include <linux/linkage.h>1819.text20.code162122/*23* void protected_mode_jump(u32 entrypoint, u32 bootparams);24*/25GLOBAL(protected_mode_jump)26movl %edx, %esi # Pointer to boot_params table2728xorl %ebx, %ebx29movw %cs, %bx30shll $4, %ebx31addl %ebx, 2f32jmp 1f # Short jump to serialize on 386/486331:3435movw $__BOOT_DS, %cx36movw $__BOOT_TSS, %di3738movl %cr0, %edx39orb $X86_CR0_PE, %dl # Protected mode40movl %edx, %cr04142# Transition to 32-bit mode43.byte 0x66, 0xea # ljmpl opcode442: .long in_pm32 # offset45.word __BOOT_CS # segment46ENDPROC(protected_mode_jump)4748.code3249.section ".text32","ax"50GLOBAL(in_pm32)51# Set up data segments for flat 32-bit mode52movl %ecx, %ds53movl %ecx, %es54movl %ecx, %fs55movl %ecx, %gs56movl %ecx, %ss57# The 32-bit code sets up its own stack, but this way we do have58# a valid stack if some debugging hack wants to use it.59addl %ebx, %esp6061# Set up TR to make Intel VT happy62ltr %di6364# Clear registers to allow for future extensions to the65# 32-bit boot protocol66xorl %ecx, %ecx67xorl %edx, %edx68xorl %ebx, %ebx69xorl %ebp, %ebp70xorl %edi, %edi7172# Set up LDTR to make Intel VT happy73lldt %cx7475jmpl *%eax # Jump to the 32-bit entrypoint76ENDPROC(in_pm32)777879