S3Asm.S 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ## @file
  2. #
  3. # Copyright (c) 2013-2015 Intel Corporation.
  4. #
  5. # SPDX-License-Identifier: BSD-2-Clause-Patent
  6. #-----------------------------------------
  7. #VOID
  8. #AsmTransferControl (
  9. # IN UINT32 S3WakingVector,
  10. # IN UINT32 AcpiLowMemoryBase
  11. # );
  12. #-----------------------------------------
  13. ASM_GLOBAL ASM_PFX(AsmTransferControl)
  14. ASM_PFX(AsmTransferControl):
  15. # S3WakingVector :DWORD
  16. # AcpiLowMemoryBase :DWORD
  17. pushl %ebp
  18. movl %esp,%ebp
  19. leal LABLE, %eax
  20. pushl $0x28 # CS
  21. pushl %eax
  22. movl 8(%ebp),%ecx
  23. shrdl $20,%ecx,%ebx
  24. andl $0xf,%ecx
  25. movw %cx,%bx
  26. movl %ebx, jmp_addr
  27. lret
  28. LABLE:
  29. .byte 0xb8,0x30,0 # mov ax, 30h as selector
  30. movw %ax,%ds
  31. movw %ax,%es
  32. movw %ax,%fs
  33. movw %ax,%gs
  34. movw %ax,%ss
  35. movl %cr0, %eax # Get control register 0
  36. .byte 0x66
  37. .byte 0x83,0xe0,0xfe # and eax, 0fffffffeh ; Clear PE bit (bit #0)
  38. .byte 0xf,0x22,0xc0 # mov cr0, eax ; Activate real mode
  39. .byte 0xea # jmp far @jmp_addr
  40. jmp_addr:
  41. .long 0