From e6cb76a2e25ad267796278be01fe693d05fc9429 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Wed, 3 Mar 2010 15:45:01 +0000 Subject: [PATCH] no more kprintf - kernel uses libsys printf now, only kputc is special to the kernel. --- kernel/arch/i386/apic.c | 20 ++++++------ kernel/arch/i386/apic_asm.S | 2 +- kernel/arch/i386/arch_do_vmctl.c | 2 +- kernel/arch/i386/clock.c | 4 +-- kernel/arch/i386/do_sdevio.c | 8 ++--- kernel/arch/i386/exception.c | 32 ++++++++++---------- kernel/arch/i386/memory.c | 38 +++++++++++------------ kernel/arch/i386/protect.c | 42 +++++++++++++------------- kernel/arch/i386/system.c | 22 +++++++------- kernel/arch/i386/watchdog.c | 6 ++-- kernel/debug.c | 20 ++++++------ kernel/debug.h | 6 ++-- kernel/main.c | 6 ++-- kernel/proc.c | 52 ++++++++++++++++---------------- kernel/proto.h | 1 - kernel/system.c | 24 +++++++-------- kernel/system/do_copy.c | 4 +-- kernel/system/do_cprofile.c | 16 +++++----- kernel/system/do_devio.c | 6 ++-- kernel/system/do_getinfo.c | 4 +-- kernel/system/do_irqctl.c | 4 +-- kernel/system/do_newmap.c | 2 +- kernel/system/do_privctl.c | 12 ++++---- kernel/system/do_safecopy.c | 34 ++++++++++----------- kernel/system/do_safemap.c | 10 +++--- kernel/system/do_sigsend.c | 4 +-- kernel/system/do_sprofile.c | 4 +-- kernel/system/do_sysctl.c | 6 ++-- kernel/system/do_umap.c | 17 +++++------ kernel/system/do_unused.c | 2 +- kernel/system/do_vdevio.c | 2 +- kernel/system/do_vmctl.c | 4 +-- kernel/utility.c | 17 +++-------- kernel/watchdog.c | 4 +-- 34 files changed, 213 insertions(+), 224 deletions(-) diff --git a/kernel/arch/i386/apic.c b/kernel/arch/i386/apic.c index 4aa7a90fc..dc9933841 100644 --- a/kernel/arch/i386/apic.c +++ b/kernel/arch/i386/apic.c @@ -108,7 +108,7 @@ PUBLIC void apic_calibrate_clocks(void) irq_hook_t calib_clk; - BOOT_VERBOSE(kprintf("Calibrating clock\n")); + BOOT_VERBOSE(printf("Calibrating clock\n")); /* * Set Initial count register to the highest value so it does not * underflow during the testing period @@ -156,10 +156,10 @@ PUBLIC void apic_calibrate_clocks(void) tsc_delta = sub64(tsc1, tsc0); lapic_bus_freq[cpuid] = system_hz * lapic_delta / (PROBE_TICKS - 1); - BOOT_VERBOSE(kprintf("APIC bus freq %lu MHz\n", + BOOT_VERBOSE(printf("APIC bus freq %lu MHz\n", lapic_bus_freq[cpuid] / 1000000)); cpu_freq = div64u(tsc_delta, PROBE_TICKS - 1) * system_hz; - BOOT_VERBOSE(kprintf("CPU %d freq %lu MHz\n", cpuid, + BOOT_VERBOSE(printf("CPU %d freq %lu MHz\n", cpuid, cpu_freq / 1000000)); cpu_set_freq(cpuid, cpu_freq); @@ -291,7 +291,7 @@ PRIVATE int lapic_enable_in_msr(void) addr = (msr.lo >> 12) | ((msr.hi & 0xf) << 20); if (phys2vir(addr) != (lapic_addr >> 12)) { if (msr.hi & 0xf) { - kprintf("ERROR : APIC address needs more then 32 bits\n"); + printf("ERROR : APIC address needs more then 32 bits\n"); return 0; } lapic_addr = phys2vir(msr.lo & ~((1 << 12) - 1)); @@ -313,7 +313,7 @@ PUBLIC int lapic_enable(void) cpu_has_tsc = _cpufeature(_CPUF_I386_TSC); if (!cpu_has_tsc) { - kprintf("CPU lacks timestamp counter, " + printf("CPU lacks timestamp counter, " "cannot calibrate LAPIC timer\n"); return 0; } @@ -374,14 +374,14 @@ PUBLIC int lapic_enable(void) *((u32_t *)lapic_eoi_addr) = 0; apic_calibrate_clocks(); - BOOT_VERBOSE(kprintf("APIC timer calibrated\n")); + BOOT_VERBOSE(printf("APIC timer calibrated\n")); return 1; } PRIVATE void apic_spurios_intr(void) { - kprintf("WARNING spurious interrupt\n"); + printf("WARNING spurious interrupt\n"); for(;;); } @@ -444,7 +444,7 @@ PUBLIC void apic_idt_init(int reset) #ifdef CONFIG_APIC_DEBUG if (cpu_is_bsp(cpuid)) - kprintf("APIC debugging is enabled\n"); + printf("APIC debugging is enabled\n"); lapic_set_dummy_handlers(); #endif @@ -459,10 +459,10 @@ PUBLIC void apic_idt_init(int reset) /* configure the timer interupt handler */ if (cpu_is_bsp(cpuid)) { local_timer_intr_handler = (vir_bytes) lapic_bsp_timer_int_handler; - BOOT_VERBOSE(kprintf("Initiating BSP timer handler\n")); + BOOT_VERBOSE(printf("Initiating BSP timer handler\n")); } else { local_timer_intr_handler = (vir_bytes) lapic_ap_timer_int_handler; - BOOT_VERBOSE(kprintf("Initiating AP timer handler\n")); + BOOT_VERBOSE(printf("Initiating AP timer handler\n")); } /* register the timer interrupt handler for this CPU */ diff --git a/kernel/arch/i386/apic_asm.S b/kernel/arch/i386/apic_asm.S index 6c2cef6ac..3d0a138cf 100644 --- a/kernel/arch/i386/apic_asm.S +++ b/kernel/arch/i386/apic_asm.S @@ -181,7 +181,7 @@ lapic_intr_dummy_handler_msg: #define lapic_intr_dummy_handler(vect) \ pushl $vect; \ push $lapic_intr_dummy_handler_msg; \ - call kprintf; \ + call printf; \ 1: jmp 1b; /* never return */ #define LAPIC_INTR_DUMMY_HANDLER(vect) \ diff --git a/kernel/arch/i386/arch_do_vmctl.c b/kernel/arch/i386/arch_do_vmctl.c index 0607a8d8e..78ca63f6b 100644 --- a/kernel/arch/i386/arch_do_vmctl.c +++ b/kernel/arch/i386/arch_do_vmctl.c @@ -81,6 +81,6 @@ struct proc *p; - kprintf("arch_do_vmctl: strange param %d\n", m_ptr->SVMCTL_PARAM); + printf("arch_do_vmctl: strange param %d\n", m_ptr->SVMCTL_PARAM); return EINVAL; } diff --git a/kernel/arch/i386/clock.c b/kernel/arch/i386/clock.c index cbc48d02b..f5a728143 100644 --- a/kernel/arch/i386/clock.c +++ b/kernel/arch/i386/clock.c @@ -85,7 +85,7 @@ PUBLIC int arch_init_local_timer(unsigned freq) lapic_set_timer_periodic(freq); } else { - BOOT_VERBOSE(kprintf("Initiating legacy i8253 timer\n")); + BOOT_VERBOSE(printf("Initiating legacy i8253 timer\n")); #else { #endif @@ -112,7 +112,7 @@ PUBLIC int arch_register_local_timer_handler(irq_handler_t handler) #ifdef CONFIG_APIC if (lapic_addr) { /* Using APIC, it is configured in apic_idt_init() */ - BOOT_VERBOSE(kprintf("Using LAPIC timer as tick source\n")); + BOOT_VERBOSE(printf("Using LAPIC timer as tick source\n")); } else #endif { diff --git a/kernel/arch/i386/do_sdevio.c b/kernel/arch/i386/do_sdevio.c index 090b800ce..df4a1b441 100644 --- a/kernel/arch/i386/do_sdevio.c +++ b/kernel/arch/i386/do_sdevio.c @@ -43,7 +43,7 @@ PUBLIC int do_sdevio(struct proc * caller, message *m_ptr) if (first) { first= 0; - kprintf("do_sdevio: for %d, req %d\n", + printf("do_sdevio: for %d, req %d\n", m_ptr->m_source, m_ptr->DIO_REQUEST); } } @@ -86,7 +86,7 @@ PUBLIC int do_sdevio(struct proc * caller, message *m_ptr) } else { if(proc_nr != _ENDPOINT_P(caller->p_endpoint)) { - kprintf("do_sdevio: unsafe sdevio by %d in %d denied\n", + printf("do_sdevio: unsafe sdevio by %d in %d denied\n", caller->p_endpoint, proc_nr_e); return EPERM; } @@ -120,7 +120,7 @@ PUBLIC int do_sdevio(struct proc * caller, message *m_ptr) } if (i >= nr_io_range) { - kprintf( + printf( "do_sdevio: I/O port check failed for proc %d, port 0x%x\n", m_ptr->m_source, port); retval = EPERM; @@ -130,7 +130,7 @@ PUBLIC int do_sdevio(struct proc * caller, message *m_ptr) if (port & (size-1)) { - kprintf("do_devio: unaligned port 0x%x (size %d)\n", port, size); + printf("do_devio: unaligned port 0x%x (size %d)\n", port, size); retval = EPERM; goto return_error; } diff --git a/kernel/arch/i386/exception.c b/kernel/arch/i386/exception.c index 0177a2c90..4d9393abb 100644 --- a/kernel/arch/i386/exception.c +++ b/kernel/arch/i386/exception.c @@ -62,14 +62,14 @@ void pagefault( struct proc *pr, /* Page fault we can't / don't want to * handle. */ - kprintf("pagefault for process %d ('%s'), pc = 0x%x, addr = 0x%x, flags = 0x%x, is_nested %d\n", + printf("pagefault for process %d ('%s'), pc = 0x%x, addr = 0x%x, flags = 0x%x, is_nested %d\n", pr->p_endpoint, pr->p_name, pr->p_reg.pc, pagefaultcr2, frame->errcode, is_nested); proc_stacktrace(pr); if(pr->p_endpoint != SYSTEM) { proc_stacktrace(proc_addr(SYSTEM)); } - kprintf("pc of pagefault: 0x%lx\n", frame->eip); + printf("pc of pagefault: 0x%lx\n", frame->eip); minix_panic("page fault in system process", pr->p_endpoint); return; @@ -138,7 +138,7 @@ PUBLIC void exception_handler(int is_nested, struct exception_frame * frame) ep = &ex_data[frame->vector]; if (frame->vector == 2) { /* spurious NMI on some machines */ - kprintf("got spurious NMI\n"); + printf("got spurious NMI\n"); return; } @@ -182,7 +182,7 @@ PUBLIC void exception_handler(int is_nested, struct exception_frame * frame) #if 0 { - kprintf( + printf( "vec_nr= %d, trap_errno= 0x%lx, eip= 0x%lx, cs= 0x%x, eflags= 0x%lx\n", frame->vector, (unsigned long)frame->errcode, (unsigned long)frame->eip, frame->cs, @@ -202,17 +202,17 @@ PUBLIC void exception_handler(int is_nested, struct exception_frame * frame) /* Exception in system code. This is not supposed to happen. */ if (ep->msg == NIL_PTR || machine.processor < ep->minprocessor) - kprintf("\nIntel-reserved exception %d\n", frame->vector); + printf("\nIntel-reserved exception %d\n", frame->vector); else - kprintf("\n%s\n", ep->msg); - kprintf("is_nested = %d ", is_nested); + printf("\n%s\n", ep->msg); + printf("is_nested = %d ", is_nested); - kprintf("vec_nr= %d, trap_errno= 0x%x, eip= 0x%x, cs= 0x%x, eflags= 0x%x trap_esp 0x%08x\n", + printf("vec_nr= %d, trap_errno= 0x%x, eip= 0x%x, cs= 0x%x, eflags= 0x%x trap_esp 0x%08x\n", frame->vector, frame->errcode, frame->eip, frame->cs, frame->eflags, frame); /* TODO should we enable this only when compiled for some debug mode? */ if (saved_proc) { - kprintf("scheduled was: process %d (%s), ", proc_nr(saved_proc), saved_proc->p_name); - kprintf("pc = %u:0x%x\n", (unsigned) saved_proc->p_reg.cs, + printf("scheduled was: process %d (%s), ", proc_nr(saved_proc), saved_proc->p_name); + printf("pc = %u:0x%x\n", (unsigned) saved_proc->p_reg.cs, (unsigned) saved_proc->p_reg.pc); proc_stacktrace(saved_proc); @@ -236,7 +236,7 @@ PUBLIC void proc_stacktrace(struct proc *whichproc) iskernel = iskernelp(whichproc); - kprintf("%-8.8s %6d 0x%lx ", + printf("%-8.8s %6d 0x%lx ", whichproc->p_name, whichproc->p_endpoint, whichproc->p_reg.pc); while(v_bp) { @@ -246,19 +246,19 @@ PUBLIC void proc_stacktrace(struct proc *whichproc) data_copy(pr->p_endpoint, pv, KERNEL, (vir_bytes) (v), n)) if(PRCOPY(whichproc, v_bp, &v_hbp, sizeof(v_hbp)) != OK) { - kprintf("(v_bp 0x%lx ?)", v_bp); + printf("(v_bp 0x%lx ?)", v_bp); break; } if(PRCOPY(whichproc, v_bp + sizeof(v_pc), &v_pc, sizeof(v_pc)) != OK) { - kprintf("(v_pc 0x%lx ?)", v_bp + sizeof(v_pc)); + printf("(v_pc 0x%lx ?)", v_bp + sizeof(v_pc)); break; } - kprintf("0x%lx ", (unsigned long) v_pc); + printf("0x%lx ", (unsigned long) v_pc); if(v_hbp != 0 && v_hbp <= v_bp) { - kprintf("(hbp %lx ?)", v_hbp); + printf("(hbp %lx ?)", v_hbp); break; } v_bp = v_hbp; } - kprintf("\n"); + printf("\n"); } diff --git a/kernel/arch/i386/memory.c b/kernel/arch/i386/memory.c index ac029776d..095913cdd 100644 --- a/kernel/arch/i386/memory.c +++ b/kernel/arch/i386/memory.c @@ -405,11 +405,11 @@ vir_bytes bytes; /* # of bytes to be copied */ } if(!(linear = umap_local(rp, seg, vir_addr, bytes))) { - kprintf("SYSTEM:umap_virtual: umap_local failed\n"); + printf("SYSTEM:umap_virtual: umap_local failed\n"); phys = 0; } else { if(vm_lookup(rp, linear, &phys, NULL) != OK) { - kprintf("SYSTEM:umap_virtual: vm_lookup of %s: seg 0x%lx: 0x%lx failed\n", rp->p_name, seg, vir_addr); + printf("SYSTEM:umap_virtual: vm_lookup of %s: seg 0x%lx: 0x%lx failed\n", rp->p_name, seg, vir_addr); phys = 0; } if(phys == 0) @@ -418,7 +418,7 @@ vir_bytes bytes; /* # of bytes to be copied */ if(phys == 0) { - kprintf("SYSTEM:umap_virtual: lookup failed\n"); + printf("SYSTEM:umap_virtual: lookup failed\n"); return 0; } @@ -426,7 +426,7 @@ vir_bytes bytes; /* # of bytes to be copied */ * so that the umap makes sense. */ if(bytes > 0 && !vm_contiguous(rp, linear, bytes)) { - kprintf("umap_virtual: %s: %d at 0x%lx (vir 0x%lx) not contiguous\n", + printf("umap_virtual: %s: %d at 0x%lx (vir 0x%lx) not contiguous\n", rp->p_name, bytes, linear, vir_addr); return 0; } @@ -526,17 +526,17 @@ PUBLIC int vm_contiguous(struct proc *targetproc, u32_t vir_buf, size_t bytes) u32_t phys; if((r=vm_lookup(targetproc, vir_buf, &phys, NULL)) != OK) { - kprintf("vm_contiguous: vm_lookup failed, %d\n", r); - kprintf("kernel stack: "); + printf("vm_contiguous: vm_lookup failed, %d\n", r); + printf("kernel stack: "); util_stacktrace(); return 0; } if(!first) { if(prev_phys+I386_PAGE_SIZE != phys) { - kprintf("vm_contiguous: no (0x%lx, 0x%lx)\n", + printf("vm_contiguous: no (0x%lx, 0x%lx)\n", prev_phys, phys); - kprintf("kernel stack: "); + printf("kernel stack: "); util_stacktrace(); return 0; } @@ -657,13 +657,13 @@ PRIVATE void vm_pt_print(u32_t *pagetable, u32_t v) if(!(pte_v & I386_VM_PRESENT)) continue; pfa = I386_VM_PFA(pte_v); - kprintf("%4d:%08lx:%08lx %2s ", + printf("%4d:%08lx:%08lx %2s ", pte, v + I386_PAGE_SIZE*pte, pfa, (pte_v & I386_VM_WRITE) ? "rw":"RO"); col++; - if(col == 3) { kprintf("\n"); col = 0; } + if(col == 3) { printf("\n"); col = 0; } } - if(col > 0) kprintf("\n"); + if(col > 0) printf("\n"); return; } @@ -683,14 +683,14 @@ PRIVATE void vm_print(u32_t *root) if(!(pde_v & I386_VM_PRESENT)) continue; if(pde_v & I386_VM_BIGPAGE) { - kprintf("%4d: 0x%lx, flags %s\n", + printf("%4d: 0x%lx, flags %s\n", pde, I386_VM_PFA(pde_v), flagstr(pde_v, 1)); } else { pte_a = (u32_t *) I386_VM_PFA(pde_v); - kprintf("%4d: pt %08lx %s\n", + printf("%4d: pt %08lx %s\n", pde, pte_a, flagstr(pde_v, 1)); vm_pt_print(pte_a, pde * I386_VM_PT_ENTRIES * I386_PAGE_SIZE); - kprintf("\n"); + printf("\n"); } } @@ -794,7 +794,7 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */ phys_addr[i] = umap_virtual(p, seg_index, vir_addr[i]->offset, bytes); if(phys_addr[i] == 0) { - kprintf("virtual_copy: map 0x%x failed for %s seg %d, " + printf("virtual_copy: map 0x%x failed for %s seg %d, " "offset %lx, len %d, i %d\n", type, p->p_name, seg_index, vir_addr[i]->offset, bytes, i); @@ -816,13 +816,13 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */ phys_addr[i] = vir_addr[i]->offset; break; default: - kprintf("virtual_copy: strange type 0x%x\n", type); + printf("virtual_copy: strange type 0x%x\n", type); NOREC_RETURN(virtualcopy, EINVAL); } /* Check if mapping succeeded. */ if (phys_addr[i] <= 0 && vir_addr[i]->segment != PHYS_SEG) { - kprintf("virtual_copy EFAULT\n"); + printf("virtual_copy EFAULT\n"); NOREC_RETURN(virtualcopy, EFAULT); } } @@ -884,11 +884,11 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */ /* can't copy to/from process with PT without VM */ #define NOPT(p) (!(p) || !HASPT(p)) if(!NOPT(procs[_SRC_])) { - kprintf("ignoring page table src: %s / %d at 0x%lx\n", + printf("ignoring page table src: %s / %d at 0x%lx\n", procs[_SRC_]->p_name, procs[_SRC_]->p_endpoint, procs[_SRC_]->p_seg.p_cr3); } if(!NOPT(procs[_DST_])) { - kprintf("ignoring page table dst: %s / %d at 0x%lx\n", + printf("ignoring page table dst: %s / %d at 0x%lx\n", procs[_DST_]->p_name, procs[_DST_]->p_endpoint, procs[_DST_]->p_seg.p_cr3); } diff --git a/kernel/arch/i386/protect.c b/kernel/arch/i386/protect.c index 293f31dfc..4fa728518 100644 --- a/kernel/arch/i386/protect.c +++ b/kernel/arch/i386/protect.c @@ -342,28 +342,28 @@ PUBLIC void printseg(char *banner, int iscs, struct proc *pr, u32_t selector) u32_t base, limit, index, dpl; struct segdesc_s *desc; - if(banner) { kprintf("%s", banner); } + if(banner) { printf("%s", banner); } index = selector >> 3; - kprintf("RPL %d, ind %d of ", + printf("RPL %d, ind %d of ", (selector & RPL_MASK), index); if(selector & TI) { - kprintf("LDT"); + printf("LDT"); if(index >= LDT_SIZE) { - kprintf("invalid index in ldt\n"); + printf("invalid index in ldt\n"); return; } if(!pr) { - kprintf("local selector but unknown process\n"); + printf("local selector but unknown process\n"); return; } desc = &pr->p_seg.p_ldt[index]; } else { - kprintf("GDT"); + printf("GDT"); if(index >= GDT_SIZE) { - kprintf("invalid index in gdt\n"); + printf("invalid index in gdt\n"); return; } desc = &gdt[index]; @@ -380,14 +380,14 @@ PUBLIC void printseg(char *banner, int iscs, struct proc *pr, u32_t selector) ((u32_t) desc->base_middle << BASE_MIDDLE_SHIFT) | ((u32_t) desc->base_high << BASE_HIGH_SHIFT); - kprintf(" -> base 0x%08lx size 0x%08lx ", base, limit+1); + printf(" -> base 0x%08lx size 0x%08lx ", base, limit+1); if(iscs) { if(!(desc->granularity & BIG)) - kprintf("16bit "); + printf("16bit "); } else { if(!(desc->granularity & BIG)) - kprintf("not big "); + printf("not big "); } if(desc->granularity & 0x20) { /* reserved */ @@ -395,28 +395,28 @@ PUBLIC void printseg(char *banner, int iscs, struct proc *pr, u32_t selector) } if(!(desc->access & PRESENT)) - kprintf("notpresent "); + printf("notpresent "); if(!(desc->access & SEGMENT)) - kprintf("system "); + printf("system "); if(desc->access & EXECUTABLE) { - kprintf(" exec "); - if(desc->access & CONFORMING) kprintf("conforming "); - if(!(desc->access & READABLE)) kprintf("non-readable "); + printf(" exec "); + if(desc->access & CONFORMING) printf("conforming "); + if(!(desc->access & READABLE)) printf("non-readable "); } else { - kprintf("nonexec "); - if(desc->access & EXPAND_DOWN) kprintf("non-expand-down "); - if(!(desc->access & WRITEABLE)) kprintf("non-writable "); + printf("nonexec "); + if(desc->access & EXPAND_DOWN) printf("non-expand-down "); + if(!(desc->access & WRITEABLE)) printf("non-writable "); } if(!(desc->access & ACCESSED)) { - kprintf("nonacc "); + printf("nonacc "); } dpl = ((u32_t) desc->access & DPL) >> DPL_SHIFT; - kprintf("DPL %d\n", dpl); + printf("DPL %d\n", dpl); return; } @@ -431,7 +431,7 @@ PUBLIC int prot_set_kern_seg_limit(vir_bytes limit) int incr_clicks; if(limit <= kinfo.data_base) { - kprintf("prot_set_kern_seg_limit: limit bogus\n"); + printf("prot_set_kern_seg_limit: limit bogus\n"); return EINVAL; } diff --git a/kernel/arch/i386/system.c b/kernel/arch/i386/system.c index af7f4bcae..b05d00fea 100644 --- a/kernel/arch/i386/system.c +++ b/kernel/arch/i386/system.c @@ -199,10 +199,10 @@ PUBLIC void arch_init(void) #if defined(CONFIG_APIC) && !defined(CONFIG_SMP) if (config_no_apic) { - BOOT_VERBOSE(kprintf("APIC disabled, using legacy PIC\n")); + BOOT_VERBOSE(printf("APIC disabled, using legacy PIC\n")); } else if (!apic_single_cpu_init()) { - BOOT_VERBOSE(kprintf("APIC not present, using legacy PIC\n")); + BOOT_VERBOSE(printf("APIC not present, using legacy PIC\n")); } #endif @@ -266,7 +266,7 @@ PRIVATE void ser_dump_segs(void) { if (isemptyp(pp)) continue; - kprintf("%d: %s ep %d\n", proc_nr(pp), pp->p_name, pp->p_endpoint); + printf("%d: %s ep %d\n", proc_nr(pp), pp->p_name, pp->p_endpoint); printseg("cs: ", 1, pp, pp->p_reg.cs); printseg("ds: ", 0, pp, pp->p_reg.ds); if(pp->p_reg.ss != pp->p_reg.ds) { @@ -319,38 +319,38 @@ PRIVATE void printslot(struct proc *pp, int level) #define COL { int i; for(i = 0; i < level; i++) printf("> "); } if(level >= NR_PROCS) { - kprintf("loop??\n"); + printf("loop??\n"); return; } COL - kprintf("%d: %s %d prio %d/%d time %d/%d cycles 0x%x%08x cr3 0x%lx rts %s misc %s", + printf("%d: %s %d prio %d/%d time %d/%d cycles 0x%x%08x cr3 0x%lx rts %s misc %s", proc_nr(pp), pp->p_name, pp->p_endpoint, pp->p_priority, pp->p_max_priority, pp->p_user_time, pp->p_sys_time, pp->p_cycles.hi, pp->p_cycles.lo, pp->p_seg.p_cr3, rtsflagstr(pp->p_rts_flags), miscflagstr(pp->p_misc_flags)); if((dep = P_BLOCKEDON(pp)) != NONE) { - kprintf(" blocked on: "); + printf(" blocked on: "); if(dep == ANY) { - kprintf(" ANY\n"); + printf(" ANY\n"); } else { int procno; if(!isokendpt(dep, &procno)) { - kprintf(" ??? %d\n", dep); + printf(" ??? %d\n", dep); } else { depproc = proc_addr(procno); if(isemptyp(depproc)) { - kprintf(" empty slot %d???\n", procno); + printf(" empty slot %d???\n", procno); depproc = NULL; } else { - kprintf(" %s\n", depproc->p_name); + printf(" %s\n", depproc->p_name); } } } } else { - kprintf("\n"); + printf("\n"); } COL diff --git a/kernel/arch/i386/watchdog.c b/kernel/arch/i386/watchdog.c index 003c03735..a3f09ff0d 100644 --- a/kernel/arch/i386/watchdog.c +++ b/kernel/arch/i386/watchdog.c @@ -88,7 +88,7 @@ int arch_watchdog_init(void) void arch_watchdog_lockup(struct nmi_frame * frame) { - kprintf("KERNEL LOCK UP\n" + printf("KERNEL LOCK UP\n" "eax 0x%08x\n" "ecx 0x%08x\n" "edx 0x%08x\n" @@ -125,11 +125,11 @@ void i386_watchdog_start(void) { if (watchdog_enabled) { if (arch_watchdog_init()) { - kprintf("WARNING watchdog initialization " + printf("WARNING watchdog initialization " "failed! Disabled\n"); watchdog_enabled = 0; } else - BOOT_VERBOSE(kprintf("Watchdog enabled\n");); + BOOT_VERBOSE(printf("Watchdog enabled\n");); } } diff --git a/kernel/debug.c b/kernel/debug.c index 8d9d21489..60d3c1a68 100644 --- a/kernel/debug.c +++ b/kernel/debug.c @@ -24,7 +24,7 @@ check_runqueues_f(char *file, int line) FIXME("check_runqueues being done"); #define MYPANIC(msg) { \ - kprintf("check_runqueues:%s:%d: %s\n", file, line, msg); \ + printf("check_runqueues:%s:%d: %s\n", file, line, msg); \ minix_panic("check_runqueues failed", NO_NUM); \ } @@ -35,15 +35,15 @@ check_runqueues_f(char *file, int line) for (q=l=0; q < NR_SCHED_QUEUES; q++) { if (rdy_head[q] && !rdy_tail[q]) { - kprintf("head but no tail in %d\n", q); + printf("head but no tail in %d\n", q); MYPANIC("scheduling error"); } if (!rdy_head[q] && rdy_tail[q]) { - kprintf("tail but no head in %d\n", q); + printf("tail but no head in %d\n", q); MYPANIC("scheduling error"); } if (rdy_tail[q] && rdy_tail[q]->p_nextready != NIL_PROC) { - kprintf("tail and tail->next not null in %d\n", q); + printf("tail and tail->next not null in %d\n", q); MYPANIC("scheduling error"); } for(xp = rdy_head[q]; xp != NIL_PROC; xp = xp->p_nextready) { @@ -59,28 +59,28 @@ check_runqueues_f(char *file, int line) MYPANIC("magic wrong in xp"); } if (RTS_ISSET(xp, RTS_SLOT_FREE)) { - kprintf("scheduling error: dead proc q %d %d\n", + printf("scheduling error: dead proc q %d %d\n", q, xp->p_endpoint); MYPANIC("dead proc on run queue"); } if (!xp->p_ready) { - kprintf("scheduling error: unready on runq %d proc %d\n", + printf("scheduling error: unready on runq %d proc %d\n", q, xp->p_nr); MYPANIC("found unready process on run queue"); } if (xp->p_priority != q) { - kprintf("scheduling error: wrong priority q %d proc %d ep %d name %s\n", + printf("scheduling error: wrong priority q %d proc %d ep %d name %s\n", q, xp->p_nr, xp->p_endpoint, xp->p_name); MYPANIC("wrong priority"); } if (xp->p_found) { - kprintf("scheduling error: double sched q %d proc %d\n", + printf("scheduling error: double sched q %d proc %d\n", q, xp->p_nr); MYPANIC("proc more than once on scheduling queue"); } xp->p_found = 1; if (xp->p_nextready == NIL_PROC && rdy_tail[q] != xp) { - kprintf("sched err: last element not tail q %d proc %d\n", + printf("sched err: last element not tail q %d proc %d\n", q, xp->p_nr); MYPANIC("scheduling error"); } @@ -95,7 +95,7 @@ check_runqueues_f(char *file, int line) if (isemptyp(xp)) continue; if(xp->p_ready && ! xp->p_found) { - kprintf("sched error: ready proc %d not on queue\n", xp->p_nr); + printf("sched error: ready proc %d not on queue\n", xp->p_nr); MYPANIC("ready proc not on scheduling queue"); if (l++ > MAX_LOOP) { MYPANIC("loop in debug.c?"); } } diff --git a/kernel/debug.h b/kernel/debug.h index fc59d1da0..cf376434a 100644 --- a/kernel/debug.h +++ b/kernel/debug.h @@ -66,13 +66,13 @@ #endif #define NOT_REACHABLE do { \ - kprintf("NOT_REACHABLE at %s:%d\n", __FILE__, __LINE__); \ + printf("NOT_REACHABLE at %s:%d\n", __FILE__, __LINE__); \ minix_panic("execution at an unexpected location\n", NO_NUM); \ for(;;); \ } while(0) #define NOT_IMPLEMENTED do { \ - kprintf("NOT_IMPLEMENTED at %s:%d\n", __FILE__, __LINE__); \ + printf("NOT_IMPLEMENTED at %s:%d\n", __FILE__, __LINE__); \ minix_panic("NOT_IMPLEMENTED", NO_NUM); \ } while(0) @@ -84,7 +84,7 @@ #ifdef _SYSTEM #define DEBUG_PRINT(params, level) do { \ - if (verboseboot >= (level)) kprintf params; } while (0) + if (verboseboot >= (level)) printf params; } while (0) #define DEBUGBASIC(params) DEBUG_PRINT(params, VERBOSEBOOT_BASIC) #define DEBUGMAX(params) DEBUG_PRINT(params, VERBOSEBOOT_MAX) #endif diff --git a/kernel/main.c b/kernel/main.c index 0481653a2..17e99b290 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -275,13 +275,13 @@ PUBLIC void main() PRIVATE void announce(void) { /* Display the MINIX startup banner. */ - kprintf("\nMINIX %s.%s. " + printf("\nMINIX %s.%s. " #ifdef _SVN_REVISION "(" _SVN_REVISION ")\n" #endif "Copyright 2010, Vrije Universiteit, Amsterdam, The Netherlands\n", OS_RELEASE, OS_VERSION); - kprintf("MINIX is open source software, see http://www.minix3.org\n"); + printf("MINIX is open source software, see http://www.minix3.org\n"); } /*===========================================================================* @@ -297,7 +297,7 @@ int how; * do shutdown work. Set a watchog timer to call shutdown(). The timer * argument passes the shutdown status. */ - kprintf("MINIX will now be shut down ...\n"); + printf("MINIX will now be shut down ...\n"); tmr_arg(&shutdown_timer)->ta_int = how; set_timer(&shutdown_timer, get_uptime() + system_hz, minix_shutdown); } diff --git a/kernel/proc.c b/kernel/proc.c index 92d39d2b5..26d612252 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -320,7 +320,7 @@ long bit_map; /* notification event set or flags */ #if DEBUG_SCHED_CHECK if(caller_ptr->p_misc_flags & MF_DELIVERMSG) { - kprintf("sys_call: MF_DELIVERMSG on for %s / %d\n", + printf("sys_call: MF_DELIVERMSG on for %s / %d\n", caller_ptr->p_name, caller_ptr->p_endpoint); minix_panic("MF_DELIVERMSG on", NO_NUM); } @@ -330,20 +330,20 @@ long bit_map; /* notification event set or flags */ if(src_dst_e != 4 && src_dst_e != 5 && caller_ptr->p_endpoint != 4 && caller_ptr->p_endpoint != 5) { if(call_nr == SEND) - kprintf("(%d SEND to %d) ", caller_ptr->p_endpoint, src_dst_e); + printf("(%d SEND to %d) ", caller_ptr->p_endpoint, src_dst_e); else if(call_nr == RECEIVE) - kprintf("(%d RECEIVE from %d) ", caller_ptr->p_endpoint, src_dst_e); + printf("(%d RECEIVE from %d) ", caller_ptr->p_endpoint, src_dst_e); else if(call_nr == SENDREC) - kprintf("(%d SENDREC to %d) ", caller_ptr->p_endpoint, src_dst_e); + printf("(%d SENDREC to %d) ", caller_ptr->p_endpoint, src_dst_e); else - kprintf("(%d %d to/from %d) ", caller_ptr->p_endpoint, call_nr, src_dst_e); + printf("(%d %d to/from %d) ", caller_ptr->p_endpoint, call_nr, src_dst_e); } #endif #if DEBUG_SCHED_CHECK if (RTS_ISSET(caller_ptr, RTS_SLOT_FREE)) { - kprintf("called by the dead?!?\n"); + printf("called by the dead?!?\n"); return EINVAL; } #endif @@ -364,7 +364,7 @@ long bit_map; /* notification event set or flags */ if (call_nr != RECEIVE) { #if 0 - kprintf("sys_call: trap %d by %d with bad endpoint %d\n", + printf("sys_call: trap %d by %d with bad endpoint %d\n", call_nr, proc_nr(caller_ptr), src_dst_e); #endif return EINVAL; @@ -376,7 +376,7 @@ long bit_map; /* notification event set or flags */ /* Require a valid source and/or destination process. */ if(!isokendpt(src_dst_e, &src_dst_p)) { #if 0 - kprintf("sys_call: trap %d by %d with bad endpoint %d\n", + printf("sys_call: trap %d by %d with bad endpoint %d\n", call_nr, proc_nr(caller_ptr), src_dst_e); #endif return EDEADSRCDST; @@ -390,7 +390,7 @@ long bit_map; /* notification event set or flags */ { if (!may_send_to(caller_ptr, src_dst_p)) { #if DEBUG_ENABLE_IPC_WARNINGS - kprintf( + printf( "sys_call: ipc mask denied trap %d from %d to %d\n", call_nr, caller_ptr->p_endpoint, src_dst_e); #endif @@ -403,7 +403,7 @@ long bit_map; /* notification event set or flags */ if (call_nr < 0 || call_nr >= 32) { #if DEBUG_ENABLE_IPC_WARNINGS - kprintf("sys_call: trap %d not allowed, caller %d, src_dst %d\n", + printf("sys_call: trap %d not allowed, caller %d, src_dst %d\n", call_nr, proc_nr(caller_ptr), src_dst_p); #endif return(ETRAPDENIED); /* trap denied by mask or kernel */ @@ -415,7 +415,7 @@ long bit_map; /* notification event set or flags */ */ if (!(priv(caller_ptr)->s_trap_mask & (1 << call_nr))) { #if DEBUG_ENABLE_IPC_WARNINGS - kprintf("sys_call: trap %d not allowed, caller %d, src_dst %d\n", + printf("sys_call: trap %d not allowed, caller %d, src_dst %d\n", call_nr, proc_nr(caller_ptr), src_dst_p); #endif return(ETRAPDENIED); /* trap denied by mask or kernel */ @@ -426,7 +426,7 @@ long bit_map; /* notification event set or flags */ if (call_nr != SENDREC && call_nr != RECEIVE && call_nr != SENDA && iskerneln(src_dst_p)) { #if DEBUG_ENABLE_IPC_WARNINGS - kprintf("sys_call: trap %d not allowed, caller %d, src_dst %d\n", + printf("sys_call: trap %d not allowed, caller %d, src_dst %d\n", call_nr, proc_nr(caller_ptr), src_dst_e); #endif return(ETRAPDENIED); /* trap denied by mask or kernel */ @@ -543,9 +543,9 @@ proc_nr_t src_dst; /* src or dst process */ #if DEBUG_ENABLE_IPC_WARNINGS { int i; - kprintf("deadlock between these processes:\n"); + printf("deadlock between these processes:\n"); for(i = 0; i < group_size; i++) { - kprintf(" %10s ", processes[i]->p_name); + printf(" %10s ", processes[i]->p_name); proc_stacktrace(processes[i]); } } @@ -687,7 +687,7 @@ int flags; src_proc_nr = id_to_nr(src_id); /* get source proc */ #if DEBUG_ENABLE_IPC_WARNINGS if(src_proc_nr == NONE) { - kprintf("mini_receive: sending notify from NONE\n"); + printf("mini_receive: sending notify from NONE\n"); } #endif if (src_e!=ANY && src_p != src_proc_nr) continue;/* source not ok */ @@ -712,7 +712,7 @@ int flags; #if DEBUG_SCHED_CHECK if (RTS_ISSET(*xpp, RTS_SLOT_FREE) || RTS_ISSET(*xpp, RTS_NO_ENDPOINT)) { - kprintf("%d: receive from %d; found dead %d (%s)?\n", + printf("%d: receive from %d; found dead %d (%s)?\n", caller_ptr->p_endpoint, src_e, (*xpp)->p_endpoint, (*xpp)->p_name); return EINVAL; @@ -776,7 +776,7 @@ endpoint_t dst_e; /* which process to notify */ if (!isokendpt(dst_e, &dst_p)) { util_stacktrace(); - kprintf("mini_notify: bogus endpoint %d\n", dst_e); + printf("mini_notify: bogus endpoint %d\n", dst_e); return EDEADSRCDST; } @@ -810,7 +810,7 @@ endpoint_t dst_e; /* which process to notify */ } #define ASCOMPLAIN(caller, entry, field) \ - kprintf("kernel:%s:%d: asyn failed for %s in %s " \ + printf("kernel:%s:%d: asyn failed for %s in %s " \ "(%d/%d, tab 0x%lx)\n",__FILE__,__LINE__, \ field, caller->p_name, entry, priv(caller)->s_asynsize, priv(caller)->s_asyntab) @@ -848,7 +848,7 @@ PRIVATE int mini_senda(struct proc *caller_ptr, asynmsg_t *table, size_t size) privp= priv(caller_ptr); if (!(privp->s_flags & SYS_PROC)) { - kprintf( + printf( "mini_senda: warning caller has no privilege structure\n"); return EPERM; } @@ -949,7 +949,7 @@ PRIVATE int mini_senda(struct proc *caller_ptr, asynmsg_t *table, size_t size) } #if 0 - kprintf("mini_senda: entry[%d]: flags 0x%x dst %d/%d\n", + printf("mini_senda: entry[%d]: flags 0x%x dst %d/%d\n", i, tabent.flags, tabent.dst, dst_p); #endif @@ -1001,7 +1001,7 @@ PRIVATE int mini_senda(struct proc *caller_ptr, asynmsg_t *table, size_t size) } } if (do_notify) - kprintf("mini_senda: should notify caller\n"); + printf("mini_senda: should notify caller\n"); if (!done) { privp->s_asyntab= (vir_bytes)table; @@ -1090,7 +1090,7 @@ PRIVATE int try_one(struct proc *src_ptr, struct proc *dst_ptr, int *postponed) if (flags & ~(AMF_VALID|AMF_DONE|AMF_NOTIFY|AMF_NOREPLY) || !(flags & AMF_VALID)) { - kprintf("try_one: bad bits in table\n"); + printf("try_one: bad bits in table\n"); privp->s_asynsize= 0; return EINVAL; } @@ -1139,7 +1139,7 @@ PRIVATE int try_one(struct proc *src_ptr, struct proc *dst_ptr, int *postponed) if (flags & AMF_NOTIFY) { - kprintf("try_one: should notify caller\n"); + printf("try_one: should notify caller\n"); } return OK; } @@ -1451,16 +1451,16 @@ int *p, fatalflag; *p = _ENDPOINT_P(e); if(!isokprocn(*p)) { #if DEBUG_ENABLE_IPC_WARNINGS - kprintf("kernel:%s:%d: bad endpoint %d: proc %d out of range\n", + printf("kernel:%s:%d: bad endpoint %d: proc %d out of range\n", file, line, e, *p); #endif } else if(isemptyn(*p)) { #if 0 - kprintf("kernel:%s:%d: bad endpoint %d: proc %d empty\n", file, line, e, *p); + printf("kernel:%s:%d: bad endpoint %d: proc %d empty\n", file, line, e, *p); #endif } else if(proc_addr(*p)->p_endpoint != e) { #if DEBUG_ENABLE_IPC_WARNINGS - kprintf("kernel:%s:%d: bad endpoint %d: proc %d has ept %d (generation %d vs. %d)\n", file, line, + printf("kernel:%s:%d: bad endpoint %d: proc %d has ept %d (generation %d vs. %d)\n", file, line, e, *p, proc_addr(*p)->p_endpoint, _ENDPOINT_G(e), _ENDPOINT_G(proc_addr(*p)->p_endpoint)); #endif diff --git a/kernel/proto.h b/kernel/proto.h index 1d03c6f26..fc099f645 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -36,7 +36,6 @@ _PROTOTYPE( void prepare_shutdown, (int how) ); _PROTOTYPE( void minix_shutdown, (struct timer *tp) ); /* utility.c */ -_PROTOTYPE( int kprintf, (const char *fmt, ...) ); _PROTOTYPE( void minix_panic, (char *s, int n) ); /* proc.c */ diff --git a/kernel/system.c b/kernel/system.c index 653906662..1674e5897 100644 --- a/kernel/system.c +++ b/kernel/system.c @@ -79,7 +79,7 @@ PRIVATE void kernel_call_finish(struct proc * caller, message *msg, int result) msg->m_type = result; /* report status of call */ if (copy_msg_to_user(caller, msg, (message *)caller->p_delivermsg_vir)) { - kprintf("WARNING wrong user pointer 0x%08x from " + printf("WARNING wrong user pointer 0x%08x from " "process %s / %d\n", caller->p_delivermsg_vir, caller->p_name, @@ -99,7 +99,7 @@ PRIVATE int kernel_call_dispatch(struct proc * caller, message *msg) /* See if the caller made a valid request and try to handle it. */ if (call_nr < 0 || call_nr >= NR_SYS_CALLS) { /* check call number */ - kprintf("SYSTEM: illegal request %d from %d.\n", + printf("SYSTEM: illegal request %d from %d.\n", call_nr,msg->m_source); result = EBADREQUEST; /* illegal message type */ } @@ -136,7 +136,7 @@ PUBLIC void kernel_call(message *m_user, struct proc * caller) result = kernel_call_dispatch(caller, &msg); } else { - kprintf("WARNING wrong user pointer 0x%08x from process %s / %d\n", + printf("WARNING wrong user pointer 0x%08x from process %s / %d\n", m_user, caller->p_name, caller->p_endpoint); result = EBADREQUEST; } @@ -405,7 +405,7 @@ vir_bytes bytes; /* # of bytes to be copied */ else if (vir_addr >= BASE_MEM_TOP && vir_addr + bytes <= UPPER_MEM_END) return (phys_bytes) vir_addr; - kprintf("Warning, error in umap_bios, virtual address 0x%x\n", vir_addr); + printf("Warning, error in umap_bios, virtual address 0x%x\n", vir_addr); return 0; } #endif @@ -430,19 +430,19 @@ vir_bytes bytes; /* size */ */ if(verify_grant(rp->p_endpoint, ANY, grant, bytes, 0, 0, &offset, &granter) != OK) { - kprintf("SYSTEM: umap_grant: verify_grant failed\n"); + printf("SYSTEM: umap_grant: verify_grant failed\n"); return 0; } if(!isokendpt(granter, &proc_nr)) { - kprintf("SYSTEM: umap_grant: isokendpt failed\n"); + printf("SYSTEM: umap_grant: isokendpt failed\n"); return 0; } /* Do the mapping from virtual to physical. */ ret = umap_virtual(proc_addr(proc_nr), D, offset, bytes); if(!ret) { - kprintf("SYSTEM:umap_grant:umap_virtual failed; grant %s:%d -> %s: vir 0x%lx\n", + printf("SYSTEM:umap_grant:umap_virtual failed; grant %s:%d -> %s: vir 0x%lx\n", rp->p_name, grant, proc_addr(proc_nr)->p_name, offset); } @@ -466,7 +466,7 @@ register struct proc *rc; /* slot of process to clean up */ /* This test is great for debugging system processes dying, * but as this happens normally on reboot, not good permanent code. */ - kprintf("died: "); + printf("died: "); proc_stacktrace(rc); minix_panic("system process died", rc->p_endpoint); } @@ -477,7 +477,7 @@ register struct proc *rc; /* slot of process to clean up */ { if (priv(rc)->s_asynsize) { #if 0 - kprintf("clear_endpoint: clearing s_asynsize of %s / %d\n", + printf("clear_endpoint: clearing s_asynsize of %s / %d\n", rc->p_name, rc->p_endpoint); proc_stacktrace(rc); #endif @@ -497,7 +497,7 @@ register struct proc *rc; /* slot of process to clean up */ if (*xpp == rc) { /* process is on the queue */ *xpp = (*xpp)->p_q_link; /* replace by next process */ #if DEBUG_ENABLE_IPC_WARNINGS - kprintf("endpoint %d / %s removed from queue at %d\n", + printf("endpoint %d / %s removed from queue at %d\n", rc->p_endpoint, rc->p_name, rc->p_sendto_e); #endif break; /* can only be queued once */ @@ -523,10 +523,8 @@ register struct proc *rc; /* slot of process to clean up */ if (P_BLOCKEDON(rp) == rc->p_endpoint) { rp->p_reg.retreg = EDEADSRCDST; /* report source died */ RTS_UNSET(rp, (RTS_RECEIVING|RTS_SENDING)); /* no longer blocking */ -#if DEBUG_ENABLE_IPC_WARNINGS - kprintf("endpoint %d / %s blocked on dead src ep %d / %s\n", + printf("endpoint %d / %s blocked on dead src ep %d / %s\n", rp->p_endpoint, rp->p_name, rc->p_endpoint, rc->p_name); -#endif } } } diff --git a/kernel/system/do_copy.c b/kernel/system/do_copy.c index 16801370a..d4a0816d9 100644 --- a/kernel/system/do_copy.c +++ b/kernel/system/do_copy.c @@ -38,7 +38,7 @@ PUBLIC int do_copy(struct proc * caller, message * m_ptr) if (first) { first= 0; - kprintf( + printf( "do_copy: got request from %d (source %d, seg %d, destination %d, seg %d)\n", m_ptr->m_source, m_ptr->CP_SRC_ENDPT, @@ -68,7 +68,7 @@ PUBLIC int do_copy(struct proc * caller, message * m_ptr) vir_addr[i].proc_nr_e = m_ptr->m_source; if (vir_addr[i].segment != PHYS_SEG) { if(! isokendpt(vir_addr[i].proc_nr_e, &p)) { - kprintf("do_copy: %d: seg 0x%x, %d not ok endpoint\n", + printf("do_copy: %d: seg 0x%x, %d not ok endpoint\n", i, vir_addr[i].segment, vir_addr[i].proc_nr_e); return(EINVAL); } diff --git a/kernel/system/do_cprofile.c b/kernel/system/do_cprofile.c index 02c925bbf..5b2c2661d 100644 --- a/kernel/system/do_cprofile.c +++ b/kernel/system/do_cprofile.c @@ -33,15 +33,15 @@ PUBLIC int do_cprofile(struct proc * caller, message * m_ptr) cprof_ctl_inst.reset = 1; - kprintf("CPROFILE notice: resetting tables:"); + printf("CPROFILE notice: resetting tables:"); for (i=0; iPROF_MEM_SIZE; - kprintf("CPROFILE notice: getting tables:"); + printf("CPROFILE notice: getting tables:"); /* Copy control structs of profiled processes to calculate total * nr of bytes to be copied to user program and find out if any @@ -79,11 +79,11 @@ PUBLIC int do_cprofile(struct proc * caller, message * m_ptr) for (i=0; is_flags & CHECK_IO_PORT) @@ -53,7 +53,7 @@ PUBLIC int do_devio(struct proc * caller, message * m_ptr) } if (i >= nr_io_range) { - kprintf("do_devio: port 0x%x (size %d) not allowed\n", + printf("do_devio: port 0x%x (size %d) not allowed\n", m_ptr->DIO_PORT, size); return EPERM; } @@ -62,7 +62,7 @@ PUBLIC int do_devio(struct proc * caller, message * m_ptr) doit: if (m_ptr->DIO_PORT & (size-1)) { - kprintf("do_devio: unaligned port 0x%x (size %d)\n", + printf("do_devio: unaligned port 0x%x (size %d)\n", m_ptr->DIO_PORT, size); return EPERM; } diff --git a/kernel/system/do_getinfo.c b/kernel/system/do_getinfo.c index 4aea7020b..5aa6cdf65 100644 --- a/kernel/system/do_getinfo.c +++ b/kernel/system/do_getinfo.c @@ -120,7 +120,7 @@ PUBLIC int do_getinfo(struct proc * caller, message * m_ptr) int bin = m_ptr->I_VAL_LEN2_E; if(bin < 0 || bin >= RANDOM_SOURCES) { - kprintf("SYSTEM: GET_RANDOMNESS_BIN: %d out of range\n", bin); + printf("SYSTEM: GET_RANDOMNESS_BIN: %d out of range\n", bin); return EINVAL; } @@ -176,7 +176,7 @@ PUBLIC int do_getinfo(struct proc * caller, message * m_ptr) } default: - kprintf("do_getinfo: invalid request %d\n", m_ptr->I_REQUEST); + printf("do_getinfo: invalid request %d\n", m_ptr->I_REQUEST); return(EINVAL); } diff --git a/kernel/system/do_irqctl.c b/kernel/system/do_irqctl.c index c16507570..ac078b6f1 100644 --- a/kernel/system/do_irqctl.c +++ b/kernel/system/do_irqctl.c @@ -62,7 +62,7 @@ PUBLIC int do_irqctl(struct proc * caller, message * m_ptr) privp= priv(caller); if (!privp) { - kprintf("do_irqctl: no priv structure!\n"); + printf("do_irqctl: no priv structure!\n"); return EPERM; } if (privp->s_flags & CHECK_IRQ) @@ -74,7 +74,7 @@ PUBLIC int do_irqctl(struct proc * caller, message * m_ptr) } if (i >= privp->s_nr_irq) { - kprintf( + printf( "do_irqctl: IRQ check failed for proc %d, IRQ %d\n", m_ptr->m_source, irq_vec); return EPERM; diff --git a/kernel/system/do_newmap.c b/kernel/system/do_newmap.c index e36ae7c71..97f474b83 100644 --- a/kernel/system/do_newmap.c +++ b/kernel/system/do_newmap.c @@ -38,7 +38,7 @@ PUBLIC int newmap(struct proc *caller, struct proc *rp, struct mem_map *map_ptr) /* Fetch the memory map. */ if((r=data_copy(caller->p_endpoint, (vir_bytes) map_ptr, KERNEL, (vir_bytes) rp->p_memmap, sizeof(rp->p_memmap))) != OK) { - kprintf("newmap: data_copy failed! (%d)\n", r); + printf("newmap: data_copy failed! (%d)\n", r); return r; } diff --git a/kernel/system/do_privctl.c b/kernel/system/do_privctl.c index 1703eb18c..11568811d 100644 --- a/kernel/system/do_privctl.c +++ b/kernel/system/do_privctl.c @@ -86,7 +86,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr) */ if ((i=get_priv(rp, priv_id)) != OK) { - kprintf("do_privctl: unable to allocate priv_id %d: %d\n", + printf("do_privctl: unable to allocate priv_id %d: %d\n", priv_id, i); return(i); } @@ -135,7 +135,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr) { priv(rp)->s_irq_tab[i]= priv.s_irq_tab[i]; #if 0 - kprintf("do_privctl: adding IRQ %d for %d\n", + printf("do_privctl: adding IRQ %d for %d\n", priv(rp)->s_irq_tab[i], rp->p_endpoint); #endif } @@ -150,7 +150,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr) { priv(rp)->s_io_tab[i]= priv.s_io_tab[i]; #if 0 - kprintf("do_privctl: adding I/O range [%x..%x] for %d\n", + printf("do_privctl: adding I/O range [%x..%x] for %d\n", priv(rp)->s_io_tab[i].ior_base, priv(rp)->s_io_tab[i].ior_limit, rp->p_endpoint); @@ -167,7 +167,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr) { priv(rp)->s_mem_tab[i]= priv.s_mem_tab[i]; #if 0 - kprintf("do_privctl: adding mem range [%x..%x] for %d\n", + printf("do_privctl: adding mem range [%x..%x] for %d\n", priv(rp)->s_mem_tab[i].mr_base, priv(rp)->s_mem_tab[i].mr_limit, rp->p_endpoint); @@ -219,7 +219,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr) if (strcmp(rp->p_name, "fxp") == 0 || strcmp(rp->p_name, "rtl8139") == 0) { - kprintf("setting ipc_stats_target to %d\n", rp->p_endpoint); + printf("setting ipc_stats_target to %d\n", rp->p_endpoint); ipc_stats_target= rp->p_endpoint; } #endif @@ -303,7 +303,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr) return EPERM; } default: - kprintf("do_privctl: bad request %d\n", m_ptr->CTL_REQUEST); + printf("do_privctl: bad request %d\n", m_ptr->CTL_REQUEST); return EINVAL; } } diff --git a/kernel/system/do_safecopy.c b/kernel/system/do_safecopy.c index e2bfb1d09..721c8349f 100644 --- a/kernel/system/do_safecopy.c +++ b/kernel/system/do_safecopy.c @@ -54,12 +54,12 @@ endpoint_t *e_granter; /* new granter (magic grants) */ * grant id. */ if(!isokendpt(granter, &proc_nr) ) { - kprintf( + printf( "grant verify failed: invalid granter %d\n", (int) granter); return(EINVAL); } if(!GRANT_VALID(grant)) { - kprintf( + printf( "grant verify failed: invalid grant %d\n", (int) grant); return(EINVAL); } @@ -72,7 +72,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ if(!HASGRANTTABLE(granter_proc)) return EPERM; if(priv(granter_proc)->s_grant_entries <= grant) { - kprintf( + printf( "verify_grant: grant verify failed in ep %d " "proc %d: grant %d out of range " "for table size %d\n", @@ -89,7 +89,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ if((r=data_copy(granter, priv(granter_proc)->s_grant_table + sizeof(g)*grant, KERNEL, (vir_bytes) &g, sizeof(g))) != OK) { - kprintf( + printf( "verify_grant: grant verify: data_copy failed\n"); return EPERM; } @@ -97,7 +97,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ /* Check validity. */ if((g.cp_flags & (CPF_USED | CPF_VALID)) != (CPF_USED | CPF_VALID)) { - kprintf( + printf( "verify_grant: grant failed: invalid (%d flags 0x%lx)\n", grant, g.cp_flags); return EPERM; @@ -111,7 +111,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ if((g.cp_flags & CPF_INDIRECT)) { /* Stop after a few iterations. There may be a loop. */ if (depth == MAX_INDIRECT_DEPTH) { - kprintf( + printf( "verify grant: indirect grant verify " "failed: exceeded maximum depth\n"); return ELOOP; @@ -122,7 +122,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ if(g.cp_u.cp_indirect.cp_who_to != grantee && grantee != ANY && g.cp_u.cp_indirect.cp_who_to != ANY) { - kprintf( + printf( "verify_grant: indirect grant verify " "failed: bad grantee\n"); return EPERM; @@ -137,7 +137,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ /* Check access of grant. */ if(((g.cp_flags & access) != access)) { - kprintf( + printf( "verify_grant: grant verify failed: access invalid; want 0x%x, have 0x%x\n", access, g.cp_flags); return EPERM; @@ -149,7 +149,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ */ if(MEM_TOP - g.cp_u.cp_direct.cp_len < g.cp_u.cp_direct.cp_start - 1) { - kprintf( + printf( "verify_grant: direct grant verify failed: len too long\n"); return EPERM; } @@ -157,7 +157,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ /* Verify actual grantee. */ if(g.cp_u.cp_direct.cp_who_to != grantee && grantee != ANY && g.cp_u.cp_direct.cp_who_to != ANY) { - kprintf( + printf( "verify_grant: direct grant verify failed: bad grantee\n"); return EPERM; } @@ -165,7 +165,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ /* Verify actual copy range. */ if((offset_in+bytes < offset_in) || offset_in+bytes > g.cp_u.cp_direct.cp_len) { - kprintf( + printf( "verify_grant: direct grant verify failed: bad size or range. " "granted %d bytes @ 0x%lx; wanted %d bytes @ 0x%lx\n", g.cp_u.cp_direct.cp_len, @@ -182,7 +182,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ * magic grants. */ if(granter != FS_PROC_NR) { - kprintf( + printf( "verify_grant: magic grant verify failed: granter (%d) " "is not FS (%d)\n", granter, FS_PROC_NR); return EPERM; @@ -191,7 +191,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ /* Verify actual grantee. */ if(g.cp_u.cp_magic.cp_who_to != grantee && grantee != ANY && g.cp_u.cp_direct.cp_who_to != ANY) { - kprintf( + printf( "verify_grant: magic grant verify failed: bad grantee\n"); return EPERM; } @@ -199,7 +199,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ /* Verify actual copy range. */ if((offset_in+bytes < offset_in) || offset_in+bytes > g.cp_u.cp_magic.cp_len) { - kprintf( + printf( "verify_grant: magic grant verify failed: bad size or range. " "granted %d bytes @ 0x%lx; wanted %d bytes @ 0x%lx\n", g.cp_u.cp_magic.cp_len, @@ -212,7 +212,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ *offset_result = g.cp_u.cp_magic.cp_start + offset_in; *e_granter = g.cp_u.cp_magic.cp_who_from; } else { - kprintf( + printf( "verify_grant: grant verify failed: unknown grant type\n"); return EPERM; } @@ -260,7 +260,7 @@ int access; /* CPF_READ for a copy from granter to grantee, CPF_WRITE /* Verify permission exists. */ if((r=verify_grant(granter, grantee, grantid, bytes, access, g_offset, &v_offset, &new_granter)) != OK) { - kprintf( + printf( "grant %d verify to copy %d->%d by %d failed: err %d\n", grantid, *src, *dst, grantee, r); return r; @@ -394,7 +394,7 @@ PUBLIC int do_vsafecopy(struct proc * caller, message * m_ptr) access = CPF_READ; granter = vec[i].v_from; } else { - kprintf("vsafecopy: %d: element %d/%d: no SELF found\n", + printf("vsafecopy: %d: element %d/%d: no SELF found\n", caller->p_endpoint, i, els); return EINVAL; } diff --git a/kernel/system/do_safemap.c b/kernel/system/do_safemap.c index 65629968b..65555949c 100644 --- a/kernel/system/do_safemap.c +++ b/kernel/system/do_safemap.c @@ -128,14 +128,14 @@ PUBLIC int map_invoke_vm(struct proc * caller, lin_src = umap_local(src, seg_s, off_s, size); lin_dst = umap_local(dst, seg_d, off_d, size); if(lin_src == 0 || lin_dst == 0) { - kprintf("map_invoke_vm: error in umap_local.\n"); + printf("map_invoke_vm: error in umap_local.\n"); return EINVAL; } /* Make sure the linear addresses are both page aligned. */ if(lin_src % CLICK_SIZE != 0 || lin_dst % CLICK_SIZE != 0) { - kprintf("map_invoke_vm: linear addresses not page aligned.\n"); + printf("map_invoke_vm: linear addresses not page aligned.\n"); return EINVAL; } @@ -199,7 +199,7 @@ PUBLIC int do_safemap(struct proc * caller, message * m_ptr) r = verify_grant(grantor, caller->p_endpoint, gid, bytes, access, offset, &offset_result, &new_grantor); if(r != OK) { - kprintf("verify_grant for gid %d from %d to %d failed: %d\n", + printf("verify_grant for gid %d from %d to %d failed: %d\n", gid, grantor, caller->p_endpoint, r); return r; } @@ -227,7 +227,7 @@ PRIVATE int safeunmap(struct proc * caller, struct map_info_s *p) r = verify_grant(p->grantor, p->grantee, p->gid, p->bytes, CPF_MAP, p->offset, &offset_result, &new_grantor); if(r != OK) { - kprintf("safeunmap: error in verify_grant.\n"); + printf("safeunmap: error in verify_grant.\n"); return r; } @@ -237,7 +237,7 @@ PRIVATE int safeunmap(struct proc * caller, struct map_info_s *p) p->bytes, 0); clear_info(p); if(r != OK) { - kprintf("safeunmap: error in map_invoke_vm.\n"); + printf("safeunmap: error in map_invoke_vm.\n"); return r; } return OK; diff --git a/kernel/system/do_sigsend.c b/kernel/system/do_sigsend.c index 0e325be2b..d728fcf61 100644 --- a/kernel/system/do_sigsend.c +++ b/kernel/system/do_sigsend.c @@ -119,8 +119,8 @@ PUBLIC int do_sigsend(struct proc * caller, message * m_ptr) rp->p_misc_flags &= ~MF_FPU_INITIALIZED; if(!RTS_ISSET(rp, RTS_PROC_STOP)) { - kprintf("system: warning: sigsend a running process\n"); - kprintf("caller stack: "); + printf("system: warning: sigsend a running process\n"); + printf("caller stack: "); proc_stacktrace(caller); } diff --git a/kernel/system/do_sprofile.c b/kernel/system/do_sprofile.c index a0a5824a4..27646cb11 100644 --- a/kernel/system/do_sprofile.c +++ b/kernel/system/do_sprofile.c @@ -37,7 +37,7 @@ PUBLIC int do_sprofile(struct proc * caller, message * m_ptr) * Turn on profiling. */ if (sprofiling) { - kprintf("SYSTEM: start s-profiling: already started\n"); + printf("SYSTEM: start s-profiling: already started\n"); return EBUSY; } @@ -71,7 +71,7 @@ PUBLIC int do_sprofile(struct proc * caller, message * m_ptr) * Stop CMOS timer. Copy info struct to user process. */ if (!sprofiling) { - kprintf("SYSTEM: stop s-profiling: not started\n"); + printf("SYSTEM: stop s-profiling: not started\n"); return EBUSY; } diff --git a/kernel/system/do_sysctl.c b/kernel/system/do_sysctl.c index c47c52e17..f9b06b002 100644 --- a/kernel/system/do_sysctl.c +++ b/kernel/system/do_sysctl.c @@ -23,13 +23,13 @@ PUBLIC int do_sysctl(struct proc * caller, message * m_ptr) buf = (vir_bytes) m_ptr->SYSCTL_ARG1; len = (vir_bytes) m_ptr->SYSCTL_ARG2; if(len < 1 || len > DIAG_BUFSIZE) { - kprintf("do_sysctl: diag for %d: len %d out of range\n", + printf("do_sysctl: diag for %d: len %d out of range\n", caller->p_endpoint, len); return EINVAL; } if((s=data_copy_vmcheck(caller, caller->p_endpoint, buf, KERNEL, (vir_bytes) mybuf, len)) != OK) { - kprintf("do_sysctl: diag for %d: len %d: copy failed: %d\n", + printf("do_sysctl: diag for %d: len %d: copy failed: %d\n", caller->p_endpoint, len, s); return s; } @@ -43,7 +43,7 @@ PUBLIC int do_sysctl(struct proc * caller, message * m_ptr) proc_stacktrace(proc_addr(proc_nr)); return OK; default: - kprintf("do_sysctl: invalid request %d\n", m_ptr->SYSCTL_CODE); + printf("do_sysctl: invalid request %d\n", m_ptr->SYSCTL_CODE); return(EINVAL); } diff --git a/kernel/system/do_umap.c b/kernel/system/do_umap.c index 6638c2339..4ed207d39 100644 --- a/kernel/system/do_umap.c +++ b/kernel/system/do_umap.c @@ -60,14 +60,13 @@ PUBLIC int do_umap(struct proc * caller, message * m_ptr) if(verify_grant(targetpr->p_endpoint, ANY, grant, count, 0, 0, &newoffset, &newep) != OK) { - kprintf("SYSTEM: do_umap: verify_grant in %s, grant %d, bytes 0x%lx, failed, caller %s\n", - targetpr->p_name, (int) grant, count, caller->p_name); + printf("SYSTEM: do_umap: verify_grant in %s, grant %d, bytes 0x%lx, failed, caller %s\n", targetpr->p_name, offset, count, caller->p_name); proc_stacktrace(caller); return EFAULT; } if(!isokendpt(newep, &new_proc_nr)) { - kprintf("SYSTEM: do_umap: isokendpt failed\n"); + printf("SYSTEM: do_umap: isokendpt failed\n"); return EFAULT; } @@ -80,15 +79,15 @@ PUBLIC int do_umap(struct proc * caller, message * m_ptr) if(seg_index == T || seg_index == D || seg_index == S) { phys_addr = lin_addr = umap_local(targetpr, seg_index, offset, count); } else { - kprintf("SYSTEM: bogus seg type 0x%lx\n", seg_index); + printf("SYSTEM: bogus seg type 0x%lx\n", seg_index); return EFAULT; } if(!lin_addr) { - kprintf("SYSTEM:do_umap: umap_local failed\n"); + printf("SYSTEM:do_umap: umap_local failed\n"); return EFAULT; } if(vm_lookup(targetpr, lin_addr, &phys_addr, NULL) != OK) { - kprintf("SYSTEM:do_umap: vm_lookup failed\n"); + printf("SYSTEM:do_umap: vm_lookup failed\n"); return EFAULT; } if(phys_addr == 0) @@ -102,16 +101,16 @@ PUBLIC int do_umap(struct proc * caller, message * m_ptr) } if(vm_running && !vm_contiguous(targetpr, lin_addr, count)) { - kprintf("SYSTEM:do_umap: not contiguous\n"); + printf("SYSTEM:do_umap: not contiguous\n"); return EFAULT; } m_ptr->CP_DST_ADDR = phys_addr; if(naughty || phys_addr == 0) { - kprintf("kernel: umap 0x%x done by %d / %s, pc 0x%lx, 0x%lx -> 0x%lx\n", + printf("kernel: umap 0x%x done by %d / %s, pc 0x%lx, 0x%lx -> 0x%lx\n", seg_type, caller->p_endpoint, caller->p_name, caller->p_reg.pc, offset, phys_addr); - kprintf("caller stack: "); + printf("caller stack: "); proc_stacktrace(caller); } return (phys_addr == 0) ? EFAULT: OK; diff --git a/kernel/system/do_unused.c b/kernel/system/do_unused.c index 2cb6d4e9f..d174699b6 100644 --- a/kernel/system/do_unused.c +++ b/kernel/system/do_unused.c @@ -9,7 +9,7 @@ *===========================================================================*/ PUBLIC int do_unused(struct proc * caller, message * m_ptr) { - kprintf("SYSTEM: got unused request %d from %d\n", + printf("SYSTEM: got unused request %d from %d\n", m_ptr->m_type, m_ptr->m_source); return(EBADREQUEST); /* illegal message type */ } diff --git a/kernel/system/do_vdevio.c b/kernel/system/do_vdevio.c index aff71adb2..87bd52f78 100644 --- a/kernel/system/do_vdevio.c +++ b/kernel/system/do_vdevio.c @@ -92,7 +92,7 @@ PUBLIC int do_vdevio(struct proc * caller, message * m_ptr) } if (j >= nr_io_range) { - kprintf( + printf( "do_vdevio: I/O port check failed for proc %d, port 0x%x\n", m_ptr->m_source, port); return EPERM; diff --git a/kernel/system/do_vmctl.c b/kernel/system/do_vmctl.c index 479e5855c..d5955fd27 100644 --- a/kernel/system/do_vmctl.c +++ b/kernel/system/do_vmctl.c @@ -25,7 +25,7 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr) if(ep == SELF) { ep = m_ptr->m_source; } if(!isokendpt(ep, &proc_nr)) { - kprintf("do_vmctl: unexpected endpoint %d from VM\n", ep); + printf("do_vmctl: unexpected endpoint %d from VM\n", ep); return EINVAL; } @@ -113,7 +113,7 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr) vmassert(p->p_vmrequest.vmresult != VMSUSPEND); #if DEBUG_VMASSERT if(p->p_vmrequest.vmresult != OK) - kprintf("SYSTEM: VM replied %d to mem request\n", + printf("SYSTEM: VM replied %d to mem request\n", p->p_vmrequest.vmresult); printf("memreq reply: vm request sent by: %s / %d about %d; 0x%lx-0x%lx, wr %d, stack: %s ", diff --git a/kernel/utility.c b/kernel/utility.c index 8dd4f5201..3c46a2d71 100644 --- a/kernel/utility.c +++ b/kernel/utility.c @@ -1,7 +1,6 @@ /* This file contains a collection of miscellaneous procedures: * minix_panic: abort MINIX due to a fatal error - * kprintf: (from libsys/kprintf.c) - * kputc: buffered putc used by kernel kprintf + * kputc: buffered putc used by kernel printf */ #include "kernel.h" @@ -35,25 +34,19 @@ if (minix_panicing++) { } if (mess != NULL) { - kprintf("kernel panic: %s", mess); + printf("kernel panic: %s", mess); if(nr != NO_NUM) - kprintf(" %d", nr); - kprintf("\n"); + printf(" %d", nr); + printf("\n"); } - kprintf("kernel: "); + printf("kernel: "); util_stacktrace(); /* Abort MINIX. */ minix_shutdown(NULL); } - -/* Include system printf() implementation named kprintf() */ - -#define printf kprintf -#include "../lib/libsys/kprintf.c" - /*===========================================================================* * kputc * *===========================================================================*/ diff --git a/kernel/watchdog.c b/kernel/watchdog.c index d1807316d..c10b4d6d4 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -26,7 +26,7 @@ void nmi_watchdog_handler(struct nmi_frame * frame) if (last_tick_count != watchdog_local_timer_ticks) { if (no_ticks == 1) { - kprintf("watchdog : kernel unlocked\n"); + printf("watchdog : kernel unlocked\n"); no_ticks = 0; } /* we are still ticking, everything seems good */ @@ -40,7 +40,7 @@ void nmi_watchdog_handler(struct nmi_frame * frame) */ if (++no_ticks < 10) { if (no_ticks == 1) - kprintf("WARNING watchdog : possible kernel lockup\n"); + printf("WARNING watchdog : possible kernel lockup\n"); goto reset_and_continue; } -- 2.44.0