1## @file 2# 3# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR> 4# 5# This program and the accompanying materials are 6# licensed and made available under the terms and conditions of the BSD License 7# which accompanies this distribution. The full text of the license may be found at 8# http://opensource.org/licenses/bsd-license.php 9# 10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12# 13## 14 15#----------------------------------------- 16#VOID 17#AsmTransferControl ( 18# IN UINT32 S3WakingVector, 19# IN UINT32 AcpiLowMemoryBase 20# ); 21#----------------------------------------- 22 23ASM_GLOBAL ASM_PFX(AsmTransferControl) 24ASM_PFX(AsmTransferControl): 25 # S3WakingVector :DWORD 26 # AcpiLowMemoryBase :DWORD 27 pushl %ebp 28 movl %esp,%ebp 29 leal LABLE, %eax 30 pushl $0x28 # CS 31 pushl %eax 32 movl 8(%ebp),%ecx 33 shrdl $20,%ecx,%ebx 34 andl $0xf,%ecx 35 movw %cx,%bx 36 movl %ebx, jmp_addr 37 lret 38LABLE: 39 .byte 0xb8,0x30,0 # mov ax, 30h as selector 40 movw %ax,%ds 41 movw %ax,%es 42 movw %ax,%fs 43 movw %ax,%gs 44 movw %ax,%ss 45 movl %cr0, %eax # Get control register 0 46 .byte 0x66 47 .byte 0x83,0xe0,0xfe # and eax, 0fffffffeh ; Clear PE bit (bit #0) 48 .byte 0xf,0x22,0xc0 # mov cr0, eax ; Activate real mode 49 .byte 0xea # jmp far @jmp_addr 50jmp_addr: 51 .long 0 52 53ASM_GLOBAL ASM_PFX(AsmTransferControl32) 54ASM_PFX(AsmTransferControl32): 55 jmp ASM_PFX(AsmTransferControl) 56 57# dummy 58ASM_GLOBAL ASM_PFX(AsmTransferControl16) 59ASM_PFX(AsmTransferControl16): 60ASM_GLOBAL ASM_PFX(AsmFixAddress16) 61ASM_PFX(AsmFixAddress16): 62 .long 0 63ASM_GLOBAL ASM_PFX(AsmJmpAddr32) 64ASM_PFX(AsmJmpAddr32): 65 .long 0 66 67