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

TOMOYO Linux Cross Reference
Linux/arch/x86/boot/pm.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/x86/boot/pm.c (Version linux-6.11-rc3) and /arch/sparc64/boot/pm.c (Version linux-6.7.12)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /* -*- linux-c -*- ---------------------------    
  3  *                                                
  4  *   Copyright (C) 1991, 1992 Linus Torvalds      
  5  *   Copyright 2007 rPath, Inc. - All Rights R    
  6  *                                                
  7  * -------------------------------------------    
  8                                                   
  9 /*                                                
 10  * Prepare the machine for transition to prote    
 11  */                                               
 12                                                   
 13 #include "boot.h"                                 
 14 #include <asm/desc_defs.h>                        
 15 #include <asm/segment.h>                          
 16                                                   
 17 /*                                                
 18  * Invoke the realmode switch hook if present;    
 19  * disable all interrupts.                        
 20  */                                               
 21 static void realmode_switch_hook(void)            
 22 {                                                 
 23         if (boot_params.hdr.realmode_swtch) {     
 24                 asm volatile("lcallw *%0"         
 25                              : : "m" (boot_par    
 26                              : "eax", "ebx", "    
 27         } else {                                  
 28                 asm volatile("cli");              
 29                 outb(0x80, 0x70); /* Disable N    
 30                 io_delay();                       
 31         }                                         
 32 }                                                 
 33                                                   
 34 /*                                                
 35  * Disable all interrupts at the legacy PIC.      
 36  */                                               
 37 static void mask_all_interrupts(void)             
 38 {                                                 
 39         outb(0xff, 0xa1);       /* Mask all in    
 40         io_delay();                               
 41         outb(0xfb, 0x21);       /* Mask all bu    
 42         io_delay();                               
 43 }                                                 
 44                                                   
 45 /*                                                
 46  * Reset IGNNE# if asserted in the FPU.           
 47  */                                               
 48 static void reset_coprocessor(void)               
 49 {                                                 
 50         outb(0, 0xf0);                            
 51         io_delay();                               
 52         outb(0, 0xf1);                            
 53         io_delay();                               
 54 }                                                 
 55                                                   
 56 /*                                                
 57  * Set up the GDT                                 
 58  */                                               
 59                                                   
 60 struct gdt_ptr {                                  
 61         u16 len;                                  
 62         u32 ptr;                                  
 63 } __attribute__((packed));                        
 64                                                   
 65 static void setup_gdt(void)                       
 66 {                                                 
 67         /* There are machines which are known     
 68            being 8-byte unaligned.  Intel reco    
 69         static const u64 boot_gdt[] __attribut    
 70                 /* CS: code, read/execute, 4 G    
 71                 [GDT_ENTRY_BOOT_CS] = GDT_ENTR    
 72                 /* DS: data, read/write, 4 GB,    
 73                 [GDT_ENTRY_BOOT_DS] = GDT_ENTR    
 74                 /* TSS: 32-bit tss, 104 bytes,    
 75                 /* We only have a TSS here to     
 76                    we don't actually use it fo    
 77                 [GDT_ENTRY_BOOT_TSS] = GDT_ENT    
 78         };                                        
 79         /* Xen HVM incorrectly stores a pointe    
 80            of the gdt_ptr contents.  Thus, mak    
 81            stay in memory, at least long enoug    
 82            proper kernel GDT. */                  
 83         static struct gdt_ptr gdt;                
 84                                                   
 85         gdt.len = sizeof(boot_gdt)-1;             
 86         gdt.ptr = (u32)&boot_gdt + (ds() << 4)    
 87                                                   
 88         asm volatile("lgdtl %0" : : "m" (gdt))    
 89 }                                                 
 90                                                   
 91 /*                                                
 92  * Set up the IDT                                 
 93  */                                               
 94 static void setup_idt(void)                       
 95 {                                                 
 96         static const struct gdt_ptr null_idt =    
 97         asm volatile("lidtl %0" : : "m" (null_    
 98 }                                                 
 99                                                   
100 /*                                                
101  * Actual invocation sequence                     
102  */                                               
103 void go_to_protected_mode(void)                   
104 {                                                 
105         /* Hook before leaving real mode, also    
106         realmode_switch_hook();                   
107                                                   
108         /* Enable the A20 gate */                 
109         if (enable_a20()) {                       
110                 puts("A20 gate not responding,    
111                 die();                            
112         }                                         
113                                                   
114         /* Reset coprocessor (IGNNE#) */          
115         reset_coprocessor();                      
116                                                   
117         /* Mask all interrupts in the PIC */      
118         mask_all_interrupts();                    
119                                                   
120         /* Actual transition to protected mode    
121         setup_idt();                              
122         setup_gdt();                              
123         protected_mode_jump(boot_params.hdr.co    
124                             (u32)&boot_params     
125 }                                                 
126                                                   

~ [ 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