Changeset 4fb6bf36 in mainline
- Timestamp:
- 2008-01-11T17:49:35Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0ee4322
- Parents:
- eb27ce5a
- Location:
- kernel/arch/amd64
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/cpuid.h
reb27ce5a r4fb6bf36 38 38 #define AMD_CPUID_EXTENDED 0x80000001 39 39 #define AMD_EXT_NOEXECUTE 20 40 #define AMD_EXT_LONG_MODE 29 40 41 41 #define INTEL_CPUID_STANDARD 0x1 42 #define INTEL_CPUID_STANDARD 0x00000001 43 #define INTEL_CPUID_EXTENDED 0x80000000 42 44 #define INTEL_SSE2 26 43 45 #define INTEL_FXSAVE 24 -
kernel/arch/amd64/src/amd64.c
reb27ce5a r4fb6bf36 104 104 void arch_pre_mm_init(void) 105 105 { 106 cpu_info_t cpuid_s; 107 108 cpuid(AMD_CPUID_EXTENDED,&cpuid_s); 109 if (! (cpuid_s.cpuid_edx & (1<<AMD_EXT_NOEXECUTE))) 110 panic("Processor does not support No-execute pages.\n"); 111 112 cpuid(INTEL_CPUID_STANDARD,&cpuid_s); 113 if (! (cpuid_s.cpuid_edx & (1<<INTEL_FXSAVE))) 114 panic("Processor does not support FXSAVE/FXRESTORE.\n"); 115 116 if (! (cpuid_s.cpuid_edx & (1<<INTEL_SSE2))) 117 panic("Processor does not support SSE2 instructions.\n"); 118 119 /* Enable No-execute pages */ 106 /* Enable no-execute pages */ 120 107 set_efer_flag(AMD_NXE_FLAG); 121 108 /* Enable FPU */ … … 124 111 /* Initialize segmentation */ 125 112 pm_init(); 126 127 128 * clear the NT (nested-thread) flag113 114 /* Disable I/O on nonprivileged levels 115 * clear the NT (nested-thread) flag 129 116 */ 130 117 clean_IOPL_NT_flags(); -
kernel/arch/amd64/src/boot/boot.S
reb27ce5a r4fb6bf36 1 # 1 2 2 # Copyright (c) 2005 Ondrej Palkovsky 3 3 # Copyright (c) 2006 Martin Decky … … 76 76 # the Default operand size must not be 1 when entering long mode 77 77 78 movl $ 0x80000000, %eax78 movl $(INTEL_CPUID_EXTENDED), %eax 79 79 cpuid 80 cmp $0x80000000, %eax # any function > 80000000h? 81 jbe long_mode_unsupported 82 movl $(AMD_CPUID_EXTENDED), %eax # Extended function code 80000001 80 cmp $(INTEL_CPUID_EXTENDED), %eax 81 ja extended_cpuid_supported 82 83 movl $extended_cpuid_msg, %esi 84 jmp error_halt 85 86 extended_cpuid_supported: 87 88 movl $(AMD_CPUID_EXTENDED), %eax 83 89 cpuid 84 bt $ 29, %edx # Test if long mode is supported.90 bt $(AMD_EXT_LONG_MODE), %edx 85 91 jc long_mode_supported 86 87 long_mode_unsupported: 92 88 93 movl $long_mode_msg, %esi 89 94 jmp error_halt 90 95 91 96 long_mode_supported: 97 98 bt $(AMD_EXT_NOEXECUTE), %edx 99 jc noexecute_supported 100 101 movl $noexecute_msg, %esi 102 jmp error_halt 103 104 noexecute_supported: 105 106 movl $(INTEL_CPUID_STANDARD), %eax 107 cpuid 108 bt $(INTEL_FXSAVE), %edx 109 jc fx_supported 110 111 movl $fx_msg, %esi 112 jmp error_halt 113 114 fx_supported: 115 116 bt $(INTEL_SSE2), %edx 117 jc sse2_supported 118 119 movl $sse2_msg, %esi 120 jmp error_halt 121 122 sse2_supported: 92 123 93 124 #ifdef CONFIG_FB … … 112 143 #endif 113 144 114 # Enable 64-bit page trans altion entries - CR4.PAE = 1.145 # Enable 64-bit page translation entries - CR4.PAE = 1. 115 146 # Paging is not enabled until after long mode is enabled 116 147 … … 128 159 movl $EFER_MSR_NUM, %ecx # EFER MSR number 129 160 rdmsr # Read EFER 130 btsl $AMD_LME_FLAG, %eax # Set LME =1161 btsl $AMD_LME_FLAG, %eax # Set LME = 1 131 162 wrmsr # Write EFER 132 163 133 # Enable paging to activate long mode (set CR0.PG =1)164 # Enable paging to activate long mode (set CR0.PG = 1) 134 165 135 166 movl %cr0, %eax … … 636 667 .long 0 637 668 669 extended_cpuid_msg: 670 .asciz "Extended CPUID not supported. System halted." 638 671 long_mode_msg: 639 672 .asciz "64 bit long mode not supported. System halted." 673 noexecute_msg: 674 .asciz "No-execute pages not supported. System halted." 675 fx_msg: 676 .asciz "FXSAVE/FXRESTORE instructions not supported. System halted." 677 sse2_msg: 678 .asciz "SSE2 instructions not supported. System halted."
Note:
See TracChangeset
for help on using the changeset viewer.