Changeset e515167d in mainline
- Timestamp:
- 2005-09-03T09:52:47Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- be56c17
- Parents:
- 5a5ed25
- Files:
-
- 1 added
- 8 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/Makefile.inc
r5a5ed25 re515167d 35 35 arch/fmath.c \ 36 36 arch/mm/memory_init.c \ 37 arch/cpu/cpu.c 37 arch/cpu/cpu.c \ 38 arch/proc/scheduler.c \ 39 arch/userspace.c -
arch/amd64/include/asm.h
r5a5ed25 re515167d 52 52 } 53 53 54 static inline void cpu_sleep(void) { __asm__ ("hlt"); };55 static inline void cpu_halt(void) { __asm__ ("hlt"); };54 static inline void cpu_sleep(void) { __asm__ volatile ("hlt"); }; 55 static inline void cpu_halt(void) { __asm__ volatile ("hlt"); }; 56 56 57 57 -
arch/amd64/src/asm_utils.S
r5a5ed25 re515167d 56 56 57 57 58 # THIS IS USERSPACE CODE 59 .global utext 60 utext: 61 xor %ax,%ax; 62 mov %ax,%ds; 63 mov %ax,%es; 64 mov %ax,%fs; 65 mov %ax,%gs; 66 0: 67 int $48 68 jmp 0b 69 # not reached 70 utext_end: 71 72 .data 73 .global utext_size 74 utext_size: 75 .long utext_end - utext 76 77 58 78 ## Determine CPUID support 59 79 # -
arch/amd64/src/cpu/cpu.c
r5a5ed25 re515167d 63 63 void set_TS_flag(void) 64 64 { 65 asm 66 ( 65 __asm__ volatile ( 67 66 "mov %%cr0,%%rax;" 68 67 "or $8,%%rax;" … … 71 70 : 72 71 :"%rax" 73 );72 ); 74 73 } 75 74 76 75 void reset_TS_flag(void) 77 76 { 78 asm 79 ( 77 __asm__ volatile ( 80 78 "mov %%cr0,%%rax;" 81 79 "btc $4,%%rax;" … … 84 82 : 85 83 :"%rax" 86 );84 ); 87 85 } 86 87 void cpu_arch_init(void) 88 { 89 CPU->arch.tss = tss_p; 90 CPU->fpu_owner=NULL; 91 } 92 93 94 void cpu_identify(void) 95 { 96 cpu_info_t info; 97 int i; 98 99 CPU->arch.vendor = VendorUnknown; 100 if (has_cpuid()) { 101 cpuid(0, &info); 102 103 /* 104 * Check for AMD processor. 105 */ 106 if (info.cpuid_ebx==AMD_CPUID_EBX && info.cpuid_ecx==AMD_CPUID_ECX && info.cpuid_edx==AMD_CPUID_EDX) { 107 CPU->arch.vendor = VendorAMD; 108 } 109 110 /* 111 * Check for Intel processor. 112 */ 113 if (info.cpuid_ebx==INTEL_CPUID_EBX && info.cpuid_ecx==INTEL_CPUID_ECX && info.cpuid_edx==INTEL_CPUID_EDX) { 114 CPU->arch.vendor = VendorIntel; 115 } 116 117 cpuid(1, &info); 118 CPU->arch.family = (info.cpuid_eax>>8)&0xf; 119 CPU->arch.model = (info.cpuid_eax>>4)&0xf; 120 CPU->arch.stepping = (info.cpuid_eax>>0)&0xf; 121 } 122 } 123 124 void cpu_print_report(cpu_t* m) 125 { 126 printf("cpu%d: (%s family=%d model=%d stepping=%d) %dMHz\n", 127 m->id, vendor_str[m->arch.vendor], m->arch.family, m->arch.model, m->arch.stepping, 128 m->frequency_mhz); 129 } -
arch/amd64/src/dummy.s
r5a5ed25 re515167d 29 29 .text 30 30 31 .global userspace32 .global before_thread_runs_arch33 .global cpu_identify34 .global cpu_arch_init35 .global cpu_sleep36 .global cpu_print_report37 .global dummy38 .global fpu_init39 40 before_thread_runs_arch:41 userspace:42 cpu_identify:43 cpu_arch_init:44 cpu_sleep:45 cpu_print_report:46 47 dummy:48 31 0: 49 32 ret 50 51 fpu_init:52 fninit53 ret -
arch/amd64/src/proc/scheduler.c
r5a5ed25 re515167d 1 1 /* 2 * Copyright (C) 2005 Jakub Vana2 * Copyright (C) 2005 Ondrej Palkovsky 3 3 * All rights reserved. 4 4 * … … 25 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 *28 27 */ 29 28 30 #include <fpu_context.h> 29 #include <proc/scheduler.h> 30 #include <cpu.h> 31 #include <proc/thread.h> 32 #include <arch.h> 33 #include <arch/context.h> /* SP_DELTA */ 31 34 32 void fpu_context_save(fpu_context_t *fctx)35 void before_thread_runs_arch(void) 33 36 { 37 CPU->arch.tss->rsp0 = (__address) &THREAD->kstack[THREAD_STACK_SIZE-SP_DELTA]; 34 38 } 35 36 37 void fpu_context_restore(fpu_context_t *fctx)38 {39 }40 41 42 void fpu_lazy_context_save(fpu_context_t *fctx)43 {44 }45 46 void fpu_lazy_context_restore(fpu_context_t *fctx)47 {48 49 } -
arch/ia32/src/fpu_context.c
r5a5ed25 re515167d 50 50 void fpu_lazy_context_save(fpu_context_t *fctx) 51 51 { 52 asm 53 ( 54 "push %%eax;" 55 "mov 0x8(%%esp),%%eax;" 56 "fnsave (%%eax);" 57 "pop %%eax;" 58 :"=m"(fctx) 59 : 60 :"eax" 61 ); 52 return; 53 __asm__ ( 54 "fnsave %0" 55 : "=m"(fctx) 56 ); 62 57 } 63 58 64 59 void fpu_lazy_context_restore(fpu_context_t *fctx) 65 60 { 66 asm 67 ( 68 "push %%eax;" 69 "mov 0x8(%%esp),%%eax;" 70 "frstor (%%eax);" 71 "pop %%eax;" 72 :"=m"(fctx) 73 : 74 :"eax" 75 ); 61 return; 62 __asm__ ( 63 "frstor %0" 64 : "=m"(fctx) 65 ); 76 66 } 77 67 -
src/build.amd64
r5a5ed25 re515167d 9 9 set -e 10 10 cd ../arch 11 for a in drivers bios mm/frame.c mm/tlb.c mm/memory_init.c boot/memmap.S; do11 for a in drivers bios fpu_context.c mm/frame.c mm/tlb.c mm/memory_init.c boot/memmap.S; do 12 12 if [ \! -e amd64/src/$a ]; then 13 13 echo ln -sf `pwd`/ia32/src/$a amd64/src/$a -
src/mm/vm.c
r5a5ed25 re515167d 71 71 // memcpy((void *) &dst_ptl0[KAS_START_INDEX], (void *) &src_ptl0[KAS_START_INDEX], KAS_INDICES); 72 72 73 memcpy((void *) dst_ptl0, (void *) GET_PTL0_ADDRESS(), PAGE_SIZE);73 memcpy((void *) dst_ptl0,(void *) src_ptl0, PAGE_SIZE); 74 74 75 75 m->ptl0 = (pte_t *) KA2PA((__address) dst_ptl0);
Note:
See TracChangeset
for help on using the changeset viewer.