Changeset 89344d85 in mainline
- Timestamp:
- 2005-09-03T00:19:23Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 36b209a
- Parents:
- e4a6dda
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/Makefile.inc
re4a6dda r89344d85 34 34 arch/asm_utils.S \ 35 35 arch/fmath.c \ 36 arch/mm/memory_init.c 36 arch/mm/memory_init.c \ 37 arch/cpu/cpu.c -
arch/amd64/include/cpu.h
re4a6dda r89344d85 30 30 #define __amd64_CPU_H__ 31 31 32 #include <config.h> 33 #include <proc/thread.h> 32 33 #define EFER_MSR_NUM 0xc0000080 34 #define AMD_SCE_FLAG 0 35 #define AMD_LME_FLAG 8 36 #define AMD_LMA_FLAG 10 37 #define AMD_FFXSR_FLAG 14 38 #define AMD_NXE_FLAG 11 39 40 #ifndef __ASM__ 41 34 42 #include <typedefs.h> 35 43 #include <arch/pm.h> 36 #include <arch/asm.h>37 44 38 45 struct cpu_arch { … … 45 52 46 53 47 void set_TS_flag(void); 48 void reset_TS_flag(void); 54 extern void set_TS_flag(void); 55 extern void reset_TS_flag(void); 56 extern void set_efer_flag(int flag); 57 extern __u64 read_efer_flag(void); 58 59 #endif /* __ASM__ */ 49 60 50 61 #endif -
arch/amd64/include/cpuid.h
re4a6dda r89344d85 32 32 #include <arch/types.h> 33 33 34 #define AMD_CPUID_EXTENDED 0x80000001 35 #define AMD_EXT_NOEXECUTE 20 36 34 37 struct cpu_info { 35 38 __u32 cpuid_eax; … … 41 44 extern int has_cpuid(void); 42 45 43 static inline void cpuid(__u32 cmd, cpu_info_t *info) 44 { 45 __asm__ ( 46 "movl %1, %eax" 47 "cpuid" 48 "movl %eax, 0(%0)" 49 "movl %ebx, 4(%0)" 50 "movl %ecx, 8(%0)" 51 "movl %edx, 12(%0)" 52 : "=m"(info) 53 : "r"(cmd) 54 : "%eax","%ebx","%ecx","%edx" 55 ); 56 } 46 extern void cpuid(__u32 cmd, cpu_info_t *info); 47 57 48 58 49 extern __u64 rdtsc(void); -
arch/amd64/include/mm/page.h
re4a6dda r89344d85 43 43 #else 44 44 # define KA2PA(x) ((x) + 0x80000000) 45 //# define PA2KA(x) ((x)) - 0x80000000)45 # define PA2KA(x) ((x) - 0x80000000) 46 46 #endif 47 47 -
arch/amd64/src/amd64.c
re4a6dda r89344d85 40 40 #include <arch/bios/bios.h> 41 41 #include <arch/mm/memory_init.h> 42 #include <arch/cpu.h> 43 #include <print.h> 44 #include <arch/cpuid.h> 42 45 43 46 void arch_pre_mm_init(void) 44 47 { 48 struct cpu_info cpuid_s; 49 50 cpuid(AMD_CPUID_EXTENDED,&cpuid_s); 51 if (! (cpuid_s.cpuid_edx & (1<<AMD_EXT_NOEXECUTE))) { 52 printf("We do not support NX!!-----------\n"); 53 printf("%X------\n",cpuid_s.cpuid_edx); 54 cpu_halt(); 55 } 56 set_efer_flag(AMD_NXE_FLAG); 57 45 58 pm_init(); 46 59 -
arch/amd64/src/asm_utils.S
re4a6dda r89344d85 40 40 .global interrupt_handlers 41 41 .global panic_printf 42 .global cpuid 42 43 43 44 panic_printf: … … 47 48 .global has_cpuid 48 49 .global rdtsc 49 50 50 .global read_efer_flag 51 .global set_efer_flag 52 51 53 ## Determine CPUID support 52 54 # … … 71 73 ret 72 74 75 cpuid: 76 movq %rbx, %r10 # we have to preserve rbx across function calls 77 78 movl %edi,%eax # load the command into %eax 79 80 cpuid 81 movl %eax,0(%rsi) 82 movl %ebx,4(%rsi) 83 movl %ecx,8(%rsi) 84 movl %edx,12(%rsi) 85 86 movq %r10, %rbx 87 ret 73 88 74 89 rdtsc: … … 76 91 rdtsc 77 92 ret 78 93 94 set_efer_flag: 95 movq $0xc0000080, %rcx 96 rdmsr 97 btsl %edi, %eax 98 wrmsr 99 ret 100 101 read_efer_flag: 102 movq $0xc0000080, %rcx 103 rdmsr 104 ret 79 105 80 106 # Push all general purpose registers on stack except %rbp, %rsp -
arch/amd64/src/boot/boot.S
re4a6dda r89344d85 32 32 #include <arch/mm/ptl.h> 33 33 #include <arch/pm.h> 34 #include <arch/cpu.h> 34 35 35 36 #define START_STACK 0x7c00 … … 102 103 103 104 # Enable long mode 104 movl $ 0xc0000080, %ecx # EFER MSR number105 movl $EFER_MSR_NUM, %ecx # EFER MSR number 105 106 rdmsr # Read EFER 106 btsl $ 8, %eax # Set LME=1107 btsl $AMD_LME_FLAG, %eax # Set LME=1 107 108 wrmsr # Write EFER 108 109 -
arch/amd64/src/dummy.s
re4a6dda r89344d85 36 36 .global cpu_print_report 37 37 .global dummy 38 .global reset_TS_flag39 38 .global fpu_init 40 39 … … 45 44 cpu_sleep: 46 45 cpu_print_report: 47 reset_TS_flag:48 46 fpu_init: 49 47 -
include/cpu.h
re4a6dda r89344d85 75 75 76 76 extern void cpu_init(void); 77 extern void cpu_halt(void);78 77 79 78 extern void cpu_arch_init(void); -
src/mm/page.c
re4a6dda r89344d85 84 84 memsetb(newpt, PAGE_SIZE, 0); 85 85 SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page), KA2PA(newpt)); 86 SET_PTL1_FLAGS(ptl0, PTL0_INDEX(page), PAGE_PRESENT | PAGE_USER );86 SET_PTL1_FLAGS(ptl0, PTL0_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC); 87 87 } 88 88 … … 93 93 memsetb(newpt, PAGE_SIZE, 0); 94 94 SET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page), KA2PA(newpt)); 95 SET_PTL2_FLAGS(ptl1, PTL1_INDEX(page), PAGE_PRESENT | PAGE_USER );95 SET_PTL2_FLAGS(ptl1, PTL1_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC); 96 96 } 97 97 … … 102 102 memsetb(newpt, PAGE_SIZE, 0); 103 103 SET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page), KA2PA(newpt)); 104 SET_PTL3_FLAGS(ptl2, PTL2_INDEX(page), PAGE_PRESENT | PAGE_USER );104 SET_PTL3_FLAGS(ptl2, PTL2_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC); 105 105 } 106 106
Note:
See TracChangeset
for help on using the changeset viewer.