• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1;; @file
2;   This is the assembly code for transferring to control to OS S3 waking vector
3;   for IA32 platform
4;
5; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
6;
7; This program and the accompanying materials
8; are licensed and made available under the terms and conditions of the BSD License
9; which accompanies this distribution.  The full text of the license may be found at
10; http://opensource.org/licenses/bsd-license.php
11;
12; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14;
15;;
16    SECTION .text
17
18global ASM_PFX(AsmFixAddress16)
19global ASM_PFX(AsmJmpAddr32)
20
21;-----------------------------------------
22;VOID
23;AsmTransferControl (
24;  IN   UINT32           S3WakingVector,
25;  IN   UINT32           AcpiLowMemoryBase
26;  );
27;-----------------------------------------
28
29global ASM_PFX(AsmTransferControl)
30ASM_PFX(AsmTransferControl):
31    ; S3WakingVector    :DWORD
32    ; AcpiLowMemoryBase :DWORD
33    push  ebp
34    mov   ebp, esp
35    lea   eax, [.0]
36    push  0x28               ; CS
37    push  eax
38    mov   ecx, [ebp + 8]
39    shrd  ebx, ecx, 20
40    and   ecx, 0xf
41    mov   bx, cx
42    mov   [@jmp_addr + 1], ebx
43    retf
44
45BITS 16
46.0:
47    mov   ax, 0x30
48o32 mov   ds, eax
49o32 mov   es, eax
50o32 mov   fs, eax
51o32 mov   gs, eax
52o32 mov   ss, eax
53    mov   eax, cr0          ; Get control register 0
54    and   eax, 0x0fffffffe  ; Clear PE bit (bit #0)
55    mov   cr0, eax          ; Activate real mode
56@jmp_addr:
57    jmp  0x0:0x0
58
59global ASM_PFX(AsmTransferControl32)
60ASM_PFX(AsmTransferControl32):
61  jmp ASM_PFX(AsmTransferControl)
62
63; dummy
64global ASM_PFX(AsmTransferControl16)
65ASM_PFX(AsmTransferControl16):
66ASM_PFX(AsmFixAddress16): DD 0
67ASM_PFX(AsmJmpAddr32): DD 0
68
69