S3Asm.asm 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. ; SPDX-License-Identifier: BSD-2-Clause-Patent
  8. .586P
  9. .model flat,C
  10. .code
  11. ;-----------------------------------------
  12. ;VOID
  13. ;AsmTransferControl (
  14. ; IN UINT32 S3WakingVector,
  15. ; IN UINT32 AcpiLowMemoryBase
  16. ; );
  17. ;-----------------------------------------
  18. AsmTransferControl PROC
  19. ; S3WakingVector :DWORD
  20. ; AcpiLowMemoryBase :DWORD
  21. push ebp
  22. mov ebp, esp
  23. lea eax, @F
  24. push 28h ; CS
  25. push eax
  26. mov ecx, [ebp + 8]
  27. shrd ebx, ecx, 20
  28. and ecx, 0fh
  29. mov bx, cx
  30. mov @jmp_addr, ebx
  31. retf
  32. @@:
  33. DB 0b8h, 30h, 0 ; mov ax, 30h as selector
  34. mov ds, ax
  35. mov es, ax
  36. mov fs, ax
  37. mov gs, ax
  38. mov ss, ax
  39. mov eax, cr0 ; Get control register 0
  40. DB 66h
  41. DB 83h, 0e0h, 0feh ; and eax, 0fffffffeh ; Clear PE bit (bit #0)
  42. DB 0fh, 22h, 0c0h ; mov cr0, eax ; Activate real mode
  43. DB 0eah ; jmp far @jmp_addr
  44. @jmp_addr DD ?
  45. AsmTransferControl ENDP
  46. END