- Timestamp:
- 2011-08-19T16:46:22Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ab34cc9
- Parents:
- 633bcc6 (diff), 45059d6b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- kernel
- Files:
-
- 12 edited
-
arch/ia32/Makefile.inc (modified) (1 diff)
-
arch/ia32/include/asm.h (modified) (2 diffs)
-
arch/ia32/include/atomic.h (modified) (1 diff)
-
arch/ia32/include/cycle.h (modified) (2 diffs)
-
arch/ia32/src/asm.S (modified) (1 diff)
-
arch/ia32/src/boot/boot.S (modified) (5 diffs)
-
arch/ia32/src/cpu/cpu.c (modified) (1 diff)
-
arch/ia32/src/proc/scheduler.c (modified) (1 diff)
-
arch/ia32/src/syscall.c (modified) (2 diffs)
-
generic/include/ipc/event.h (modified) (3 diffs)
-
generic/src/console/console.c (modified) (1 diff)
-
generic/src/ipc/event.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/Makefile.inc
r633bcc6 r16f9782 64 64 endif 65 65 66 ifeq ($(PROCESSOR),i486) 67 CMN2 = -march=i486 68 endif 69 66 70 ifeq ($(PROCESSOR),core) 67 71 CMN2 = -march=prescott -
kernel/arch/ia32/include/asm.h
r633bcc6 r16f9782 311 311 } 312 312 313 #ifndef PROCESSOR_i486 313 314 /** Write to MSR */ 314 315 NO_TRACE static inline void write_msr(uint32_t msr, uint64_t value) … … 335 336 return ((uint64_t) dx << 32) | ax; 336 337 } 338 #endif 337 339 338 340 -
kernel/arch/ia32/include/atomic.h
r633bcc6 r16f9782 121 121 asm volatile ( 122 122 "0:\n" 123 #ifndef PROCESSOR_i486 123 124 "pause\n" /* Pentium 4's HT love this instruction */ 125 #endif 124 126 "mov %[count], %[tmp]\n" 125 127 "testl %[tmp], %[tmp]\n" -
kernel/arch/ia32/include/cycle.h
r633bcc6 r16f9782 40 40 NO_TRACE static inline uint64_t get_cycle(void) 41 41 { 42 #ifdef PROCESSOR_i486 43 return 0; 44 #else 42 45 uint64_t v; 43 46 … … 48 51 49 52 return v; 53 #endif 50 54 } 51 55 -
kernel/arch/ia32/src/asm.S
r633bcc6 r16f9782 405 405 xorl %eax, %eax 406 406 cmpl $(GDT_SELECTOR(KTEXT_DES)), ISTATE_OFFSET_CS(%esp) 407 #ifdef PROCESSOR_i486 408 jz 0f 409 movl %eax, %ebp 410 0: 411 #else 407 412 cmovnzl %eax, %ebp 413 #endif 408 414 409 415 movl %ebp, ISTATE_OFFSET_EBP_FRAME(%esp) -
kernel/arch/ia32/src/boot/boot.S
r633bcc6 r16f9782 97 97 pm_status $status_prot 98 98 99 movl $(INTEL_CPUID_LEVEL), %eax100 cpuid101 cmp $0x0, %eax /* any function > 0? */102 jbe pse_unsupported103 104 movl $(INTEL_CPUID_STANDARD), %eax105 cpuid106 bt $(INTEL_PSE), %edx107 jc pse_supported108 109 pse_unsupported:110 111 pm_error $err_pse112 113 pse_supported:114 115 99 #include "vesa_prot.inc" 116 100 … … 140 124 jmp hlt0 141 125 126 /** Calculate unmapped address of the end of the kernel. */ 127 calc_end_of_kernel: 128 movl $hardcoded_load_address, %edi 129 andl $0x7fffffff, %edi 130 movl (%edi), %esi 131 andl $0x7fffffff, %esi 132 133 movl $hardcoded_ktext_size, %edi 134 andl $0x7fffffff, %edi 135 addl (%edi), %esi 136 andl $0x7fffffff, %esi 137 138 movl $hardcoded_kdata_size, %edi 139 andl $0x7fffffff, %edi 140 addl (%edi), %esi 141 andl $0x7fffffff, %esi 142 movl %esi, end_of_kernel 143 ret 144 145 /** Find free 2M (+4k for alignment) region where to store page tables */ 146 find_mem_for_pt: 147 /* Check if multiboot info is present */ 148 cmpl $0x2BADB002, grub_eax 149 je check_multiboot_map 150 ret 151 check_multiboot_map: 152 /* Copy address of the multiboot info to ebx */ 153 movl grub_ebx, %ebx 154 /* Check if memory map flag is present */ 155 movl (%ebx), %edx 156 andl $(1 << 6), %edx 157 jnz use_multiboot_map 158 ret 159 use_multiboot_map: 160 /* Copy address of the memory map to edx */ 161 movl 48(%ebx), %edx 162 movl %edx, %ecx 163 addl 44(%ebx), %ecx 164 /* Find a free region at least 2M in size */ 165 check_memmap_loop: 166 /* Is this a free region? */ 167 cmp $1, 20(%edx) 168 jnz next_region 169 /* Check size */ 170 cmp $0, 16(%edx) 171 jnz next_region 172 cmpl $(2 * 1024 * 1024 + 4 * 1024), 12(%edx) 173 jbe next_region 174 cmp $0, 8(%edx) 175 jz found_region 176 next_region: 177 cmp %ecx, %edx 178 jbe next_region_do 179 ret 180 next_region_do: 181 addl (%edx), %edx 182 addl $4, %edx 183 jmp check_memmap_loop 184 found_region: 185 /* Use end of the found region */ 186 mov 4(%edx), %ecx 187 add 12(%edx), %ecx 188 sub $(2 * 1024 * 1024), %ecx 189 mov %ecx, free_area 190 ret 191 192 142 193 /** Setup mapping for the kernel. 143 194 * … … 148 199 .global map_kernel 149 200 map_kernel: 201 /* Paging features */ 150 202 movl %cr4, %ecx 151 orl $(1 << 4), %ecx /* PSE on */152 203 andl $(~(1 << 5)), %ecx /* PAE off */ 153 204 movl %ecx, %cr4 154 205 206 call calc_end_of_kernel 207 call find_mem_for_pt 208 mov end_of_kernel, %esi 209 mov free_area, %ecx 210 cmpl %esi, %ecx 211 jbe use_end_of_kernel 212 mov %ecx, %esi 213 /* Align address down to 4k */ 214 andl $(~4095), %esi 215 use_end_of_kernel: 216 217 /* Align address to 4k */ 218 addl $4095, %esi 219 andl $(~4095), %esi 220 221 /* Allocate space for page tables*/ 222 movl %esi, pt_loc 223 movl $ballocs, %edi 224 andl $0x7fffffff, %edi 225 movl %esi, (%edi) 226 addl $4, %edi 227 movl $(2*1024*1024), (%edi) 228 229 /* Fill page tables */ 230 xorl %ecx, %ecx 231 xorl %ebx, %ebx 232 233 floop_pt: 234 movl $((1 << 1) | (1 << 0)), %eax 235 orl %ebx, %eax 236 movl %eax, (%esi, %ecx, 4) 237 addl $(4 * 1024), %ebx 238 239 incl %ecx 240 cmpl $(512 * 1024), %ecx 241 jl floop_pt 242 243 /* Fill page directory */ 155 244 movl $(page_directory + 0), %esi 156 245 movl $(page_directory + 2048), %edi 157 246 xorl %ecx, %ecx 158 xorl %ebx, %ebx247 movl pt_loc, %ebx 159 248 160 249 floop: 161 movl $((1 << 7) | (1 <<1) | (1 << 0)), %eax250 movl $((1 << 1) | (1 << 0)), %eax 162 251 orl %ebx, %eax 163 252 /* Mapping 0x00000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */ … … 165 254 /* Mapping 0x80000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */ 166 255 movl %eax, (%edi, %ecx, 4) 167 addl $(4 * 1024 * 1024), %ebx256 addl $(4 * 1024), %ebx 168 257 169 258 incl %ecx … … 523 612 524 613 grub_ebx: 614 .long 0 615 616 pt_loc: 617 .long 0 618 end_of_kernel: 619 .long 0 620 free_area: 525 621 .long 0 526 622 -
kernel/arch/ia32/src/cpu/cpu.c
r633bcc6 r16f9782 118 118 ); 119 119 } 120 120 121 #ifndef PROCESSOR_i486 121 122 if (CPU->arch.fi.bits.sep) { 122 123 /* Setup fast SYSENTER/SYSEXIT syscalls */ 123 124 syscall_setup_cpu(); 124 125 } 126 #endif 125 127 } 126 128 -
kernel/arch/ia32/src/proc/scheduler.c
r633bcc6 r16f9782 60 60 uintptr_t kstk = (uintptr_t) &THREAD->kstack[STACK_SIZE]; 61 61 62 #ifndef PROCESSOR_i486 62 63 if (CPU->arch.fi.bits.sep) { 63 64 /* Set kernel stack for CP3 -> CPL0 switch via SYSENTER */ 64 65 write_msr(IA32_MSR_SYSENTER_ESP, kstk - sizeof(istate_t)); 65 66 } 67 #endif 66 68 67 69 /* Set kernel stack for CPL3 -> CPL0 switch via interrupt */ -
kernel/arch/ia32/src/syscall.c
r633bcc6 r16f9782 39 39 #include <arch/pm.h> 40 40 41 #ifndef PROCESSOR_i486 41 42 /** Enable & setup support for SYSENTER/SYSEXIT */ 42 43 void syscall_setup_cpu(void) … … 49 50 write_msr(IA32_MSR_SYSENTER_EIP, (uint32_t) sysenter_handler); 50 51 } 52 #endif 51 53 52 54 /** @} -
kernel/generic/include/ipc/event.h
r633bcc6 r16f9782 41 41 #include <ipc/ipc.h> 42 42 43 typedef struct task task_t;43 struct task; 44 44 45 45 typedef void (*event_callback_t)(void *); … … 63 63 64 64 extern void event_init(void); 65 extern void event_task_init( task_t*);65 extern void event_task_init(struct task *); 66 66 extern void event_cleanup_answerbox(answerbox_t *); 67 67 extern void event_set_unmask_callback(event_type_t, event_callback_t); 68 extern void event_task_set_unmask_callback( task_t*, event_task_type_t,68 extern void event_task_set_unmask_callback(struct task *, event_task_type_t, 69 69 event_callback_t); 70 70 … … 97 97 extern int event_notify(event_type_t, bool, sysarg_t, sysarg_t, sysarg_t, 98 98 sysarg_t, sysarg_t); 99 extern int event_task_notify( task_t*, event_task_type_t, bool, sysarg_t, sysarg_t,99 extern int event_task_notify(struct task *, event_task_type_t, bool, sysarg_t, sysarg_t, 100 100 sysarg_t, sysarg_t, sysarg_t); 101 101 -
kernel/generic/src/console/console.c
r633bcc6 r16f9782 248 248 } 249 249 250 void klog_update(void *e )250 void klog_update(void *event) 251 251 { 252 252 if (!atomic_get(&klog_inited)) -
kernel/generic/src/ipc/event.c
r633bcc6 r16f9782 81 81 } 82 82 83 void event_task_init(task_t *t )83 void event_task_init(task_t *task) 84 84 { 85 85 for (unsigned int i = EVENT_END; i < EVENT_TASK_END; i++) 86 event_initialize(evno2event(i, t ));86 event_initialize(evno2event(i, task)); 87 87 } 88 88 … … 130 130 } 131 131 132 void event_task_set_unmask_callback(task_t *t , event_task_type_t evno,132 void event_task_set_unmask_callback(task_t *task, event_task_type_t evno, 133 133 event_callback_t callback) 134 134 { … … 136 136 ASSERT(evno < EVENT_TASK_END); 137 137 138 _event_set_unmask_callback(evno2event(evno, t ), callback);138 _event_set_unmask_callback(evno2event(evno, task), callback); 139 139 } 140 140 … … 213 213 /** Send per-task kernel notification event 214 214 * 215 * @param t Destination task.215 * @param task Destination task. 216 216 * @param evno Event type. 217 217 * @param mask Mask further notifications after a successful … … 231 231 * 232 232 */ 233 int event_task_notify(task_t *t , event_task_type_t evno, bool mask, sysarg_t a1,234 sysarg_t a 2, sysarg_t a3, sysarg_t a4, sysarg_t a5)233 int event_task_notify(task_t *task, event_task_type_t evno, bool mask, 234 sysarg_t a1, sysarg_t a2, sysarg_t a3, sysarg_t a4, sysarg_t a5) 235 235 { 236 236 ASSERT(evno >= (int) EVENT_END); 237 237 ASSERT(evno < EVENT_TASK_END); 238 238 239 return event_enqueue(evno2event(evno, t ), mask, a1, a2, a3, a4, a5);239 return event_enqueue(evno2event(evno, task), mask, a1, a2, a3, a4, a5); 240 240 } 241 241
Note:
See TracChangeset
for help on using the changeset viewer.
