Changeset 169587a in mainline
- Timestamp:
- 2005-02-21T21:47:22Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b109ebb
- Parents:
- 0ded477
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/include/apic.h
r0ded477 r169587a 40 40 #define IPI_STARTUP 0 41 41 42 #define DLVRMODE_FIXED (0<<8) 42 43 #define DLVRMODE_INIT (5<<8) 43 44 #define DLVRMODE_STUP (6<<8) … … 57 58 #define ICRlo (0x300/sizeof(__u32)) 58 59 #define ICRhi (0x310/sizeof(__u32)) 59 #define ICRloClear (( 0xff<<0)|(1<<13)|(3<<16)|(0xfff<<20))60 #define ICRloClear ((1<<13)|(3<<16)|(0xfff<<20)) 60 61 #define ICRhiClear (0xffffff<<0) 61 62 … … 116 117 extern void l_apic_init(void); 117 118 extern void l_apic_eoi(void); 119 extern int l_apic_broadcast_custom_ipi(__u8 vector); 118 120 extern int l_apic_send_init_ipi(__u8 apicid); 119 121 extern void l_apic_debug(void); -
arch/ia32/include/interrupt.h
r0ded477 r169587a 60 60 61 61 #define VECTOR_SYSCALL (IVT_FREEBASE+0) 62 #define VECTOR_TLB_SHUTDOWN (IVT_FREEBASE+1) 62 63 63 64 typedef void (* iroutine)(__u8 n, __u32 stack[]); … … 77 78 extern void page_fault(__u8 n, __u32 stack[]); 78 79 extern void syscall(__u8 n, __u32 stack[]); 80 extern void tlb_shutdown_ipi(__u8 n, __u32 stack[]); 79 81 80 82 extern void trap_virtual_enable_irqs(__u16 irqmask); -
arch/ia32/src/ia32.c
r0ded477 r169587a 57 57 58 58 trap_register(VECTOR_SYSCALL, syscall); 59 60 #ifdef __SMP__ 61 trap_register(VECTOR_TLB_SHUTDOWN, tlb_shutdown_ipi); 62 #endif /* __SMP__ */ 59 63 } 60 64 } -
arch/ia32/src/interrupt.c
r0ded477 r169587a 34 34 #include <cpu.h> 35 35 #include <arch/asm.h> 36 #include <mm/tlb.h> 36 37 37 38 /* … … 94 95 } 95 96 97 void tlb_shutdown_ipi(__u8 n, __u32 stack[]) 98 { 99 trap_virtual_eoi(); 100 tlb_shutdown_ipi_recv(); 101 } 102 96 103 void trap_virtual_enable_irqs(__u16 irqmask) 97 104 { -
arch/ia32/src/mm/page.c
r0ded477 r169587a 135 135 pt[pte].uaccessible = (flags & PAGE_USER) != 0; 136 136 pt[pte].writeable = (flags & PAGE_WRITE) != 0; 137 138 tlb_invalidate(0);139 137 } -
arch/ia32/src/mm/tlb.c
r0ded477 r169587a 30 30 #include <arch/asm.h> 31 31 32 #ifdef __SMP__ 33 #include <arch/apic.h> 34 #include <arch/interrupt.h> 35 #endif /* __SMP__ */ 36 32 37 void tlb_invalidate(int asid) 33 38 { 34 39 cpu_write_dba(cpu_read_dba()); 35 40 } 41 42 #ifdef __SMP__ 43 void tlb_shutdown_ipi_send(void) 44 { 45 (void) l_apic_broadcast_custom_ipi(VECTOR_TLB_SHUTDOWN); 46 } 47 #endif /* __SMP__ */ -
arch/ia32/src/smp/apic.c
r0ded477 r169587a 143 143 144 144 /* 145 * Send all CPUs excluding the->cpu IPI vector. 146 */ 147 int l_apic_broadcast_custom_ipi(__u8 vector) 148 { 149 __u32 lo; 150 151 /* 152 * Read the ICR register in and zero all non-reserved fields. 153 */ 154 lo = l_apic[ICRlo] & ICRloClear; 155 156 lo |= DLVRMODE_FIXED | DESTMODE_LOGIC | LEVEL_ASSERT | SHORTHAND_EXCL | TRGRMODE_LEVEL | vector; 157 158 l_apic[ICRlo] = lo; 159 160 lo = l_apic[ICRlo] & ICRloClear; 161 if (lo & SEND_PENDING) 162 printf("IPI is pending.\n"); 163 164 return apic_poll_errors(); 165 } 166 167 /* 145 168 * Universal Start-up Algorithm for bringing up the AP processors. 146 169 */ -
include/mm/tlb.h
r0ded477 r169587a 30 30 #define __TLB_H__ 31 31 32 extern void tlb_shutdown(void); 32 #ifdef __SMP__ 33 extern void tlb_init(void); 34 extern void tlb_shutdown_start(void); 35 extern void tlb_shutdown_finalize(void); 36 extern void tlb_shutdown_ipi_recv(void); 37 #else 38 39 #define tlb_init() ; 40 #define tlb_shutdown_start() ; 41 #define tlb_shutdown_finalize() ; 42 #define tlb_shutdown_ipi_recv() ; 43 44 #endif /* __SMP__ */ 45 46 /* Export TLB interface that each architecture must implement. */ 33 47 extern void tlb_invalidate(int asid); 48 extern void tlb_shutdown_ipi_send(void); 34 49 35 50 #endif -
src/main/main.c
r0ded477 r169587a 47 47 #include <mm/frame.h> 48 48 #include <mm/page.h> 49 #include <mm/tlb.h> 49 50 #include <synch/waitq.h> 50 51 … … 111 112 frame_init(); 112 113 page_init(); 114 tlb_init(); 113 115 114 116 #ifdef __SMP__ -
src/mm/tlb.c
r0ded477 r169587a 28 28 29 29 #include <mm/tlb.h> 30 #include <synch/spinlock.h> 31 #include <typedefs.h> 32 #include <arch/atomic.h> 33 #include <config.h> 30 34 31 void tlb_shutdown(void) 35 #ifdef __SMP__ 36 static spinlock_t tlblock; 37 static volatile int tlb_shutdown_cnt; 38 39 void tlb_init(void) 32 40 { 33 /* TODO: implement tlb_shutdown */ 41 spinlock_initialize(&tlblock); 42 tlb_shutdown_cnt = 0; 34 43 } 44 45 /* must be called with interrupts disabled */ 46 void tlb_shutdown_start(void) 47 { 48 spinlock_lock(&tlblock); 49 tlb_shutdown_ipi_send(); 50 51 while (tlb_shutdown_cnt < config.cpu_active - 1) 52 ; 53 54 tlb_shutdown_cnt = 0; 55 } 56 57 void tlb_shutdown_finalize(void) 58 { 59 spinlock_unlock(&tlblock); 60 } 61 62 void tlb_shutdown_ipi_recv(void) 63 { 64 atomic_inc((int *) &tlb_shutdown_cnt); 65 spinlock_lock(&tlblock); 66 spinlock_unlock(&tlblock); 67 tlb_invalidate(0); /* TODO: use valid ASID */ 68 } 69 #endif /* __SMP__ */ -
src/mm/vm.c
r0ded477 r169587a 30 30 #include <mm/page.h> 31 31 #include <mm/frame.h> 32 #include <mm/tlb.h> 32 33 #include <arch/mm/page.h> 33 34 #include <arch/types.h> … … 143 144 for (i=0; i<a->size; i++) 144 145 map_page_to_frame(a->address + i*PAGE_SIZE, 0, PAGE_NOT_PRESENT, 0); 145 146 146 147 spinlock_unlock(&a->lock); 147 148 cpu_priority_restore(pri); … … 169 170 170 171 pri = cpu_priority_high(); 172 173 tlb_shutdown_start(); 174 171 175 spinlock_lock(&m->lock); 172 176 … … 175 179 176 180 spinlock_unlock(&m->lock); 181 182 tlb_invalidate(0); 183 tlb_shutdown_finalize(); 184 177 185 cpu_priority_restore(pri); 178 186 }
Note:
See TracChangeset
for help on using the changeset viewer.