~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/kernel/acpi/wakeup_32.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2         .text
  3 #include <linux/linkage.h>
  4 #include <asm/segment.h>
  5 #include <asm/page_types.h>
  6 
  7 # Copyright 2003, 2008 Pavel Machek <pavel@suse.cz
  8 
  9         .code32
 10         ALIGN
 11 
 12 SYM_CODE_START(wakeup_pmode_return)
 13         movw    $__KERNEL_DS, %ax
 14         movw    %ax, %ss
 15         movw    %ax, %fs
 16         movw    %ax, %gs
 17 
 18         movw    $__USER_DS, %ax
 19         movw    %ax, %ds
 20         movw    %ax, %es
 21 
 22         # reload the gdt, as we need the full 32 bit address
 23         lidt    saved_idt
 24         lldt    saved_ldt
 25         ljmp    $(__KERNEL_CS), $1f
 26 1:
 27         movl    %cr3, %eax
 28         movl    %eax, %cr3
 29         wbinvd
 30 
 31         # and restore the stack ... but you need gdt for this to work
 32         movl    saved_context_esp, %esp
 33 
 34         movl    %cs:saved_magic, %eax
 35         cmpl    $0x12345678, %eax
 36         jne     bogus_magic
 37 
 38         # jump to place where we left off
 39         movl    saved_eip, %eax
 40         jmp     *%eax
 41 SYM_CODE_END(wakeup_pmode_return)
 42 
 43 bogus_magic:
 44         jmp     bogus_magic
 45 
 46 
 47 
 48 save_registers:
 49         sidt    saved_idt
 50         sldt    saved_ldt
 51         str     saved_tss
 52 
 53         leal    4(%esp), %eax
 54         movl    %eax, saved_context_esp
 55         movl    %ebx, saved_context_ebx
 56         movl    %ebp, saved_context_ebp
 57         movl    %esi, saved_context_esi
 58         movl    %edi, saved_context_edi
 59         pushfl
 60         popl    saved_context_eflags
 61 
 62         movl    $ret_point, saved_eip
 63         RET
 64 
 65 
 66 restore_registers:
 67         movl    saved_context_ebp, %ebp
 68         movl    saved_context_ebx, %ebx
 69         movl    saved_context_esi, %esi
 70         movl    saved_context_edi, %edi
 71         pushl   saved_context_eflags
 72         popfl
 73         RET
 74 
 75 SYM_CODE_START(do_suspend_lowlevel)
 76         call    save_processor_state
 77         call    save_registers
 78         pushl   $3
 79         call    x86_acpi_enter_sleep_state
 80         addl    $4, %esp
 81 
 82 #       In case of S3 failure, we'll emerge here.  Jump
 83 #       to ret_point to recover
 84         jmp     ret_point
 85         .p2align 4,,7
 86 ret_point:
 87         call    restore_registers
 88         call    restore_processor_state
 89         RET
 90 SYM_CODE_END(do_suspend_lowlevel)
 91 
 92 .data
 93 ALIGN
 94 SYM_DATA(saved_magic,   .long 0)
 95 saved_eip:              .long 0
 96 
 97 # saved registers
 98 saved_idt:      .long   0,0
 99 saved_ldt:      .long   0
100 saved_tss:      .long   0
101 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php