• 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    .586P
17    .model  flat,C
18    .code
19
20PUBLIC   AsmFixAddress16
21PUBLIC   AsmJmpAddr32
22
23;-----------------------------------------
24;VOID
25;AsmTransferControl (
26;  IN   UINT32           S3WakingVector,
27;  IN   UINT32           AcpiLowMemoryBase
28;  );
29;-----------------------------------------
30
31AsmTransferControl  PROC
32    ; S3WakingVector    :DWORD
33    ; AcpiLowMemoryBase :DWORD
34    push  ebp
35    mov   ebp, esp
36    lea   eax, @F
37    push  28h               ; CS
38    push  eax
39    mov   ecx, [ebp + 8]
40    shrd  ebx, ecx, 20
41    and   ecx, 0fh
42    mov   bx, cx
43    mov   [@jmp_addr], ebx
44    retf
45@@:
46    DB    0b8h, 30h, 0      ; mov ax, 30h as selector
47    mov   ds, ax
48    mov   es, ax
49    mov   fs, ax
50    mov   gs, ax
51    mov   ss, ax
52    mov   eax, cr0          ; Get control register 0
53    DB    66h
54    DB    83h, 0e0h, 0feh   ; and    eax, 0fffffffeh  ; Clear PE bit (bit #0)
55    DB    0fh, 22h, 0c0h    ; mov    cr0, eax         ; Activate real mode
56    DB    0eah              ; jmp far @jmp_addr
57@jmp_addr DD  ?
58
59AsmTransferControl  ENDP
60
61AsmTransferControl32  PROC
62  jmp AsmTransferControl
63AsmTransferControl32  ENDP
64
65; dummy
66AsmTransferControl16  PROC
67AsmFixAddress16  DD ?
68AsmJmpAddr32 DD  ?
69AsmTransferControl16  ENDP
70
71    END