Changeset 7f043c0 in mainline
- Timestamp:
- 2007-05-31T21:39:13Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7bb0c32
- Parents:
- d8431986
- Location:
- kernel
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/debugger.h
rd8431986 r7f043c0 49 49 50 50 extern void debugger_init(void); 51 extern int breakpoint_add( void * where,int flags, int curidx);51 extern int breakpoint_add(const void *where, const int flags, int curidx); 52 52 extern void breakpoint_del(int slot); 53 53 -
kernel/arch/amd64/src/debugger.c
rd8431986 r7f043c0 103 103 104 104 /** Print table of active breakpoints */ 105 int cmd_print_breakpoints(cmd_arg_t *argv )105 int cmd_print_breakpoints(cmd_arg_t *argv __attribute__((unused))) 106 106 { 107 107 int i; … … 112 112 if (breakpoints[i].address) { 113 113 symbol = get_symtab_entry(breakpoints[i].address); 114 printf("%d. % p in %s\n",i,114 printf("%d. %lx in %s\n", i, 115 115 breakpoints[i].address, symbol); 116 116 printf(" Count(%d) ", breakpoints[i].counter); … … 174 174 /** Enable hardware breakpoint 175 175 * 176 *177 176 * @param where Address of HW breakpoint 178 177 * @param flags Type of breakpoint (EXECUTE, WRITE) 179 178 * @return Debug slot on success, -1 - no available HW breakpoint 180 179 */ 181 int breakpoint_add( void * where,int flags, int curidx)180 int breakpoint_add(const void *where, const int flags, int curidx) 182 181 { 183 182 ipl_t ipl; … … 185 184 bpinfo_t *cur; 186 185 187 ASSERT( 186 ASSERT(flags & (BKPOINT_INSTR | BKPOINT_WRITE | BKPOINT_READ_WRITE)); 188 187 189 188 ipl = interrupts_disable(); … … 192 191 if (curidx == -1) { 193 192 /* Find free space in slots */ 194 for (i =0; i<BKPOINTS_MAX; i++)193 for (i = 0; i < BKPOINTS_MAX; i++) 195 194 if (!breakpoints[i].address) { 196 195 curidx = i; … … 224 223 225 224 #ifdef amd64 226 # define getip(x)((x)->rip)225 # define getip(x) ((x)->rip) 227 226 #else 228 # define getip(x)((x)->eip)227 # define getip(x) ((x)->eip) 229 228 #endif 230 229 … … 238 237 if (*((unative_t *) breakpoints[slot].address) != 0) 239 238 return; 240 printf("**** Found ZERO on address % p****\n",241 slot, breakpoints[slot].address);239 printf("**** Found ZERO on address %lx (slot %d) ****\n", 240 breakpoints[slot].address, slot); 242 241 } else { 243 printf("Data watchpoint - new data: % p\n",242 printf("Data watchpoint - new data: %lx\n", 244 243 *((unative_t *) breakpoints[slot].address)); 245 244 } 246 245 } 247 printf("Reached breakpoint %d:% p(%s)\n", slot, getip(istate),246 printf("Reached breakpoint %d:%lx(%s)\n", slot, getip(istate), 248 247 get_symtab_entry(getip(istate))); 249 248 printf("***Type 'exit' to exit kconsole.\n"); … … 314 313 #endif 315 314 316 static void debug_exception(int n , istate_t *istate)315 static void debug_exception(int n __attribute__((unused)), istate_t *istate) 317 316 { 318 317 unative_t dr6; … … 338 337 339 338 #ifdef CONFIG_SMP 340 static void debug_ipi(int n , istate_t *istate)339 static void debug_ipi(int n __attribute__((unused)), istate_t *istate __attribute__((unused))) 341 340 { 342 341 int i; 343 342 344 343 spinlock_lock(&bkpoint_lock); 345 for (i =0; i < BKPOINTS_MAX; i++)344 for (i = 0; i < BKPOINTS_MAX; i++) 346 345 setup_dr(i); 347 346 spinlock_unlock(&bkpoint_lock); -
kernel/arch/ia32/include/asm.h
rd8431986 r7f043c0 258 258 uintptr_t v; 259 259 260 asm volatile ("andl %%esp, %0\n" : "=r" (v) : "0" (~(STACK_SIZE-1))); 260 asm volatile ( 261 "andl %%esp, %0\n" 262 : "=r" (v) 263 : "0" (~(STACK_SIZE - 1)) 264 ); 261 265 262 266 return v; -
kernel/arch/ia32/include/context.h
rd8431986 r7f043c0 46 46 * One item is put onto stack to support get_stack_base(). 47 47 */ 48 #define SP_DELTA (8 +STACK_ITEM_SIZE)48 #define SP_DELTA (8 + STACK_ITEM_SIZE) 49 49 50 50 /* -
kernel/arch/ia32/include/mm/frame.h
rd8431986 r7f043c0 37 37 38 38 #define FRAME_WIDTH 12 /* 4K */ 39 #define FRAME_SIZE (1 <<FRAME_WIDTH)39 #define FRAME_SIZE (1 << FRAME_WIDTH) 40 40 41 41 #ifdef KERNEL -
kernel/arch/ia32/include/smp/apic.h
rd8431986 r7f043c0 347 347 extern uint32_t io_apic_read(uint8_t address); 348 348 extern void io_apic_write(uint8_t address , uint32_t x); 349 extern void io_apic_change_ioredtbl( int pin, int dest, uint8_t v, int flags);349 extern void io_apic_change_ioredtbl(uint8_t pin, uint8_t dest, uint8_t v, int flags); 350 350 extern void io_apic_disable_irqs(uint16_t irqmask); 351 351 extern void io_apic_enable_irqs(uint16_t irqmask); -
kernel/arch/ia32/src/ddi/ddi.c
rd8431986 r7f043c0 126 126 if ((bits = TASK->arch.iomap.bits)) { 127 127 bitmap_t iomap; 128 task_t *task = TASK; 128 129 129 130 ASSERT(TASK->arch.iomap.map); 130 131 bitmap_initialize(&iomap, CPU->arch.tss->iomap, TSS_IOMAP_SIZE * 8); 131 bitmap_copy(&iomap, & TASK->arch.iomap, TASK->arch.iomap.bits);132 bitmap_copy(&iomap, &task->arch.iomap, task->arch.iomap.bits); 132 133 /* 133 134 * It is safe to set the trailing eight bits because of the extra -
kernel/arch/ia32/src/mm/page.c
rd8431986 r7f043c0 84 84 uintptr_t virtaddr = PA2KA(last_frame); 85 85 pfn_t i; 86 for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) 87 page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE | PAGE_WRITE); 86 for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) { 87 uintptr_t addr = PFN2ADDR(i); 88 page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr, PAGE_NOT_CACHEABLE | PAGE_WRITE); 89 } 88 90 89 91 last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); … … 92 94 } 93 95 94 void page_fault(int n , istate_t *istate)96 void page_fault(int n __attribute__((unused)), istate_t *istate) 95 97 { 96 98 uintptr_t page; … … 111 113 112 114 decode_istate(istate); 113 printf("page fault address: %# x\n", page);115 printf("page fault address: %#lx\n", page); 114 116 panic("page fault\n"); 115 117 } -
kernel/arch/ia32/src/proc/scheduler.c
rd8431986 r7f043c0 67 67 #ifdef CONFIG_DEBUG_AS_WATCHPOINT 68 68 /* Set watchpoint on AS to ensure that nobody sets it to zero */ 69 if (CPU->id < BKPOINTS_MAX) 70 breakpoint_add(&((the_t *) THREAD->kstack)->as, 71 BKPOINT_WRITE | BKPOINT_CHECK_ZERO, 72 CPU->id); 69 if (CPU->id < BKPOINTS_MAX) { 70 the_t *the = THE; 71 breakpoint_add(&((the_t *) the->thread->kstack)->as, 72 BKPOINT_WRITE | BKPOINT_CHECK_ZERO, the->cpu->id); 73 } 73 74 #endif 74 75 } -
kernel/arch/ia32/src/smp/apic.c
rd8431986 r7f043c0 126 126 * @param istate Interrupted state. 127 127 */ 128 static void apic_spurious(int n , istate_t *istate)128 static void apic_spurious(int n __attribute__((unused)), istate_t *istate __attribute__((unused))) 129 129 { 130 130 #ifdef CONFIG_DEBUG 131 printf("cpu% d: APIC spurious interrupt\n", CPU->id);131 printf("cpu%u: APIC spurious interrupt\n", CPU->id); 132 132 #endif 133 133 } … … 138 138 } 139 139 140 static void l_apic_timer_irq_handler(irq_t *irq, void *arg , ...)140 static void l_apic_timer_irq_handler(irq_t *irq, void *arg __attribute__((unused)), ...) 141 141 { 142 142 /* … … 154 154 { 155 155 io_apic_id_t idreg; 156 unsigned int i; 157 156 158 157 exc_register(VECTOR_APIC_SPUR, "apic_spurious", (iroutine) apic_spurious); 159 158 … … 177 176 irq_register(&l_apic_timer_irq); 178 177 178 uint8_t i; 179 179 for (i = 0; i < IRQ_COUNT; i++) { 180 180 int pin; 181 181 182 182 if ((pin = smp_irq_to_pin(i)) != -1) 183 io_apic_change_ioredtbl( pin, DEST_ALL, IVT_IRQBASE + i, LOPRI);183 io_apic_change_ioredtbl((uint8_t) pin, DEST_ALL, (uint8_t) (IVT_IRQBASE + i), LOPRI); 184 184 } 185 185 … … 329 329 for (i = 0; i<2; i++) { 330 330 icr.lo = l_apic[ICRlo]; 331 icr.vector = ( (uintptr_t) ap_boot) / 4096; /* calculate the reset vector */331 icr.vector = (uint8_t) (((uintptr_t) ap_boot) >> 12); /* calculate the reset vector */ 332 332 icr.delmod = DELMOD_STARTUP; 333 333 icr.destmod = DESTMOD_PHYS; … … 426 426 427 427 /* Program Logical Destination Register. */ 428 ASSERT(CPU->id < 8) 428 429 ldr.value = l_apic[LDR]; 429 if (CPU->id < sizeof(CPU->id)*8) /* size in bits */ 430 ldr.id = (1<<CPU->id); 430 ldr.id = (uint8_t) (1 << CPU->id); 431 431 l_apic[LDR] = ldr.value; 432 432 … … 514 514 * @param flags Flags. 515 515 */ 516 void io_apic_change_ioredtbl( int pin, int dest, uint8_t v, int flags)516 void io_apic_change_ioredtbl(uint8_t pin, uint8_t dest, uint8_t v, int flags) 517 517 { 518 518 io_redirection_reg_t reg; … … 522 522 dlvr = DELMOD_LOWPRI; 523 523 524 reg.lo = io_apic_read( IOREDTBL + pin*2);525 reg.hi = io_apic_read( IOREDTBL + pin*2 + 1);524 reg.lo = io_apic_read((uint8_t) (IOREDTBL + pin * 2)); 525 reg.hi = io_apic_read((uint8_t) (IOREDTBL + pin * 2 + 1)); 526 526 527 527 reg.dest = dest; … … 532 532 reg.intvec = v; 533 533 534 io_apic_write( IOREDTBL + pin*2, reg.lo);535 io_apic_write( IOREDTBL + pin*2 + 1, reg.hi);534 io_apic_write((uint8_t) (IOREDTBL + pin * 2), reg.lo); 535 io_apic_write((uint8_t) (IOREDTBL + pin * 2 + 1), reg.hi); 536 536 } 537 537 … … 554 554 pin = smp_irq_to_pin(i); 555 555 if (pin != -1) { 556 reg.lo = io_apic_read( IOREDTBL + pin * 2);556 reg.lo = io_apic_read((uint8_t) (IOREDTBL + pin * 2)); 557 557 reg.masked = true; 558 io_apic_write( IOREDTBL + pin * 2, reg.lo);558 io_apic_write((uint8_t) (IOREDTBL + pin * 2), reg.lo); 559 559 } 560 560 … … 573 573 io_redirection_reg_t reg; 574 574 575 for (i = 0; i < 16; i++) {575 for (i = 0; i < 16; i++) { 576 576 if (irqmask & (1 << i)) { 577 577 /* … … 581 581 pin = smp_irq_to_pin(i); 582 582 if (pin != -1) { 583 reg.lo = io_apic_read( IOREDTBL + pin * 2);583 reg.lo = io_apic_read((uint8_t) (IOREDTBL + pin * 2)); 584 584 reg.masked = false; 585 io_apic_write( IOREDTBL + pin * 2, reg.lo);585 io_apic_write((uint8_t) (IOREDTBL + pin * 2), reg.lo); 586 586 } 587 587 -
kernel/arch/ia32/src/smp/mps.c
rd8431986 r7f043c0 55 55 #define CT_SIGNATURE 0x504d4350 56 56 57 int mps_fs_check(uint8_t *base);58 int mps_ct_check(void);59 60 int configure_via_ct(void);61 int configure_via_default(uint8_t n);62 63 int ct_processor_entry(struct __processor_entry *pr);64 void ct_bus_entry(struct __bus_entry *bus);65 void ct_io_apic_entry(struct __io_apic_entry *ioa);66 void ct_io_intr_entry(struct __io_intr_entry *iointr);67 void ct_l_intr_entry(struct __l_intr_entry *lintr);68 69 void ct_extended_entries(void);57 static int mps_fs_check(uint8_t *base); 58 static int mps_ct_check(void); 59 60 static int configure_via_ct(void); 61 static int configure_via_default(uint8_t n); 62 63 static int ct_processor_entry(struct __processor_entry *pr); 64 static void ct_bus_entry(struct __bus_entry *bus); 65 static void ct_io_apic_entry(struct __io_apic_entry *ioa); 66 static void ct_io_intr_entry(struct __io_intr_entry *iointr); 67 static void ct_l_intr_entry(struct __l_intr_entry *lintr); 68 69 static void ct_extended_entries(void); 70 70 71 71 static struct mps_fs *fs; … … 109 109 { 110 110 ASSERT(i < processor_entry_cnt); 111 return processor_entries[i].cpu_flags & 0x1;111 return (bool) ((processor_entries[i].cpu_flags & 0x01) == 0x01); 112 112 } 113 113 … … 115 115 { 116 116 ASSERT(i < processor_entry_cnt); 117 return processor_entries[i].cpu_flags & 0x2;117 return (bool) ((processor_entries[i].cpu_flags & 0x02) == 0x02); 118 118 } 119 119 … … 134 134 135 135 for (i = 0, sum = 0; i < 16; i++) 136 sum += base[i];136 sum = (uint8_t) (sum + base[i]); 137 137 138 138 return !sum; … … 151 151 /* count the checksum for the base table */ 152 152 for (i=0,sum=0; i < ct->base_table_length; i++) 153 sum += base[i];153 sum = (uint8_t) (sum + base[i]); 154 154 155 155 if (sum) … … 158 158 /* count the checksum for the extended table */ 159 159 for (i=0,sum=0; i < ct->ext_table_length; i++) 160 sum += ext[i];160 sum = (uint8_t) (sum + ext[i]); 161 161 162 162 return sum == ct->ext_table_checksum; … … 287 287 } 288 288 289 int configure_via_default(uint8_t n )289 int configure_via_default(uint8_t n __attribute__((unused))) 290 290 { 291 291 /* … … 297 297 298 298 299 int ct_processor_entry(struct __processor_entry *pr )299 int ct_processor_entry(struct __processor_entry *pr __attribute__((unused))) 300 300 { 301 301 /* … … 309 309 } 310 310 311 void ct_bus_entry(struct __bus_entry *bus )311 void ct_bus_entry(struct __bus_entry *bus __attribute__((unused))) 312 312 { 313 313 #ifdef MPSCT_VERBOSE … … 338 338 339 339 //#define MPSCT_VERBOSE 340 void ct_io_intr_entry(struct __io_intr_entry *iointr )340 void ct_io_intr_entry(struct __io_intr_entry *iointr __attribute__((unused))) 341 341 { 342 342 #ifdef MPSCT_VERBOSE … … 369 369 } 370 370 371 void ct_l_intr_entry(struct __l_intr_entry *lintr )371 void ct_l_intr_entry(struct __l_intr_entry *lintr __attribute__((unused))) 372 372 { 373 373 #ifdef MPSCT_VERBOSE -
kernel/arch/ia32/src/smp/smp.c
rd8431986 r7f043c0 99 99 * as an initialization stack for each AP.) 100 100 */ 101 void kmp(void *arg )101 void kmp(void *arg __attribute__((unused))) 102 102 { 103 103 unsigned int i; … … 113 113 * Set the warm-reset vector to the real-mode address of 4K-aligned ap_boot() 114 114 */ 115 *((uint16_t *) (PA2KA(0x467 + 0))) = ((uintptr_t) ap_boot) >> 4; /* segment */116 *((uint16_t *) (PA2KA(0x467 + 2))) = 115 *((uint16_t *) (PA2KA(0x467 + 0))) = (uint16_t) (((uintptr_t) ap_boot) >> 4); /* segment */ 116 *((uint16_t *) (PA2KA(0x467 + 2))) = 0; /* offset */ 117 117 118 118 /* … … 125 125 pic_disable_irqs(0xffff); 126 126 apic_init(); 127 128 uint8_t apic = l_apic_id(); 127 129 128 130 for (i = 0; i < ops->cpu_count(); i++) { … … 141 143 continue; 142 144 143 if (ops->cpu_apic_id(i) == l_apic_id()) {144 printf("%s: bad processor entry #% d, will not send IPI to myself\n", __FUNCTION__, i);145 if (ops->cpu_apic_id(i) == apic) { 146 printf("%s: bad processor entry #%u, will not send IPI to myself\n", __FUNCTION__, i); 145 147 continue; 146 148 } … … 149 151 * Prepare new GDT for CPU in question. 150 152 */ 151 if (!(gdt_new = (struct descriptor *) malloc(GDT_ITEMS *sizeof(struct descriptor), FRAME_ATOMIC)))153 if (!(gdt_new = (struct descriptor *) malloc(GDT_ITEMS * sizeof(struct descriptor), FRAME_ATOMIC))) 152 154 panic("couldn't allocate memory for GDT\n"); 153 155 … … 164 166 * supposed to wake us up. 165 167 */ 166 if (waitq_sleep_timeout(&ap_completion_wq, 1000000, SYNCH_FLAGS_NONE) == ESYNCH_TIMEOUT) 167 printf("%s: waiting for cpu%d (APIC ID = %d) timed out\n", __FUNCTION__, config.cpu_active > i ? config.cpu_active : i, ops->cpu_apic_id(i)); 168 if (waitq_sleep_timeout(&ap_completion_wq, 1000000, SYNCH_FLAGS_NONE) == ESYNCH_TIMEOUT) { 169 unsigned int cpu = (config.cpu_active > i) ? config.cpu_active : i; 170 printf("%s: waiting for cpu%u (APIC ID = %d) timed out\n", __FUNCTION__, cpu, ops->cpu_apic_id(i)); 171 } 168 172 } else 169 173 printf("INIT IPI for l_apic%d failed\n", ops->cpu_apic_id(i)); -
kernel/genarch/src/acpi/acpi.c
rd8431986 r7f043c0 60 60 61 61 for (i = 0; i < 20; i++) 62 sum += rsdp[i];62 sum = (uint8_t) (sum + rsdp[i]); 63 63 64 64 if (sum) … … 69 69 70 70 for (; i < r->length; i++) 71 sum += rsdp[i];71 sum = (uint8_t) (sum + rsdp[i]); 72 72 73 73 return !sum; … … 82 82 83 83 for (i = 0; i < h->length; i++) 84 sum += sdt[i];84 sum = (uint8_t) (sum + sdt[i]); 85 85 86 86 return !sum; … … 106 106 goto next; 107 107 *signature_map[j].sdt_ptr = h; 108 printf("%#z x: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);108 printf("%#zp: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description); 109 109 } 110 110 } … … 127 127 goto next; 128 128 *signature_map[j].sdt_ptr = h; 129 printf("%#z x: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);129 printf("%#zp: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description); 130 130 } 131 131 } … … 161 161 162 162 rsdp_found: 163 printf("%#z x: ACPI Root System Description Pointer\n", acpi_rsdp);163 printf("%#zp: ACPI Root System Description Pointer\n", acpi_rsdp); 164 164 165 165 acpi_rsdt = (struct acpi_rsdt *) (unative_t) acpi_rsdp->rsdt_address; -
kernel/generic/include/interrupt.h
rd8431986 r7f043c0 49 49 { \ 50 50 if (istate_from_uspace(istate)) { \ 51 klog_printf("Task %llu killed due to an exception at %p.", TASK->taskid, istate_get_pc(istate)); \ 51 task_t *task = TASK; \ 52 klog_printf("Task %llu killed due to an exception at %p.", task->taskid, istate_get_pc(istate)); \ 52 53 klog_printf(" " cmd, ##__VA_ARGS__); \ 53 task_kill( TASK->taskid); \54 task_kill(task->taskid); \ 54 55 thread_exit(); \ 55 56 } \ -
kernel/generic/src/printf/printf_core.c
rd8431986 r7f043c0 419 419 * TYPE:@n 420 420 * - "hh" Signed or unsigned char.@n 421 * - "h" Signed or u signed short.@n422 * - "" Signed or u signed int (default value).@n423 * - "l" Signed or u signed long int.@n424 * - "ll" Signed or u signed long long int.@n421 * - "h" Signed or unsigned short.@n 422 * - "" Signed or unsigned int (default value).@n 423 * - "l" Signed or unsigned long int.@n 424 * - "ll" Signed or unsigned long long int.@n 425 425 * - "z" unative_t (non-standard extension).@n 426 426 * … … 434 434 * 435 435 * - P, p Print value of a pointer. Void * value is expected and it is printed in hexadecimal notation with prefix 436 * (as with \%#X or\%#x for 32bit or \%#X / \%#x for 64bit long pointers).436 * (as with \%#X / \%#x for 32bit or \%#X / \%#x for 64bit long pointers). 437 437 * 438 438 * - b Print value as unsigned binary number. Prefix is not printed by default. (Nonstandard extension.)
Note:
See TracChangeset
for help on using the changeset viewer.