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