/* SPDX-License-Identifier: GPL-2.0-only */1/* ----------------------------------------------------------------------- *2*3* Copyright (C) 1991, 1992 Linus Torvalds4* Copyright 2007 rPath, Inc. - All Rights Reserved5*6* ----------------------------------------------------------------------- */78/*9* The actual transition into protected mode10*/1112#include <asm/boot.h>13#include <asm/processor-flags.h>14#include <asm/segment.h>15#include <linux/linkage.h>1617.text18.code161920/*21* void protected_mode_jump(u32 entrypoint, u32 bootparams);22*/23SYM_FUNC_START_NOALIGN(protected_mode_jump)24movl %edx, %esi # Pointer to boot_params table2526xorl %ebx, %ebx27movw %cs, %bx28shll $4, %ebx29addl %ebx, 2f30jmp 1f # Short jump to serialize on 386/486311:3233movw $__BOOT_DS, %cx34movw $__BOOT_TSS, %di3536movl %cr0, %edx37orb $X86_CR0_PE, %dl # Protected mode38movl %edx, %cr03940# Transition to 32-bit mode41.byte 0x66, 0xea # ljmpl opcode422: .long .Lin_pm32 # offset43.word __BOOT_CS # segment44SYM_FUNC_END(protected_mode_jump)4546.code3247.section ".text32","ax"48SYM_FUNC_START_LOCAL_NOALIGN(.Lin_pm32)49# Set up data segments for flat 32-bit mode50movl %ecx, %ds51movl %ecx, %es52movl %ecx, %fs53movl %ecx, %gs54movl %ecx, %ss55# The 32-bit code sets up its own stack, but this way we do have56# a valid stack if some debugging hack wants to use it.57addl %ebx, %esp5859# Set up TR to make Intel VT happy60ltr %di6162# Clear registers to allow for future extensions to the63# 32-bit boot protocol64xorl %ecx, %ecx65xorl %edx, %edx66xorl %ebx, %ebx67xorl %ebp, %ebp68xorl %edi, %edi6970# Set up LDTR to make Intel VT happy71lldt %cx7273jmpl *%eax # Jump to the 32-bit entrypoint74SYM_FUNC_END(.Lin_pm32)757677