From c356e9997e55e257ea03187873adfc0ba618f3de Mon Sep 17 00:00:00 2001 From: Arun Thomas Date: Mon, 18 Jul 2011 19:44:17 +0200 Subject: [PATCH] kernel: fix GCC warnings --- kernel/arch/i386/apic.c | 6 ++++-- kernel/arch/i386/include/archconst.h | 2 +- kernel/arch/i386/memory.c | 20 ++++++++++---------- kernel/proc.c | 2 +- kernel/proto.h | 2 +- kernel/system/do_mcontext.c | 2 +- kernel/system/do_sigsend.c | 2 +- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/kernel/arch/i386/apic.c b/kernel/arch/i386/apic.c index 268d2d6e7..01eb9e2bd 100644 --- a/kernel/arch/i386/apic.c +++ b/kernel/arch/i386/apic.c @@ -494,7 +494,7 @@ PRIVATE void apic_calibrate_clocks(unsigned cpu) tsc_delta = sub64(tsc1, tsc0); lapic_bus_freq[cpuid] = system_hz * lapic_delta / (PROBE_TICKS - 1); - BOOT_VERBOSE(printf("APIC bus freq %lu MHz\n", + BOOT_VERBOSE(printf("APIC bus freq %u MHz\n", lapic_bus_freq[cpuid] / 1000000)); cpu_freq = mul64(div64u64(tsc_delta, PROBE_TICKS - 1), make64(system_hz, 0)); cpu_set_freq(cpuid, cpu_freq); @@ -903,7 +903,7 @@ PRIVATE int acpi_get_ioapics(struct io_apic * ioa, unsigned * nioa, unsigned max ioa[n].gsi_base = acpi_ioa->global_int_base; ioa[n].pins = ((ioapic_read(ioa[n].addr, IOAPIC_VERSION) & 0xff0000) >> 16)+1; - printf("IO APIC %d addr 0x%x paddr 0x%x pins %d\n", + printf("IO APIC %d addr 0x%lx paddr 0x%lx pins %d\n", acpi_ioa->id, ioa[n].addr, ioa[n].paddr, ioa[n].pins); @@ -920,6 +920,8 @@ PUBLIC int detect_ioapics(void) if (machine.acpi_rsdp) status = acpi_get_ioapics(io_apic, &nioapics, MAX_NR_IOAPICS); + else + status = 0; if (!status) { /* try something different like MPS */ } diff --git a/kernel/arch/i386/include/archconst.h b/kernel/arch/i386/include/archconst.h index 4975cc75f..2e124ac82 100644 --- a/kernel/arch/i386/include/archconst.h +++ b/kernel/arch/i386/include/archconst.h @@ -136,7 +136,7 @@ #define INIT_TASK_PSW 0x1200 /* initial psw for tasks (with IOPL 1) */ #define TRACEBIT 0x0100 /* OR this with psw in proc[] for tracing */ #define SETPSW(rp, new) /* permits only certain bits to be set */ \ - ((rp)->p_reg.psw = (rp)->p_reg.psw & ~0xCD5 | (new) & 0xCD5) + ((rp)->p_reg.psw = ((rp)->p_reg.psw & ~0xCD5) | ((new) & 0xCD5)) #define IF_MASK 0x00000200 #define IOPL_MASK 0x003000 diff --git a/kernel/arch/i386/memory.c b/kernel/arch/i386/memory.c index 1ae63bc69..66beddfef 100644 --- a/kernel/arch/i386/memory.c +++ b/kernel/arch/i386/memory.c @@ -350,14 +350,14 @@ vir_bytes vir_addr; /* virtual address in bytes within the seg */ vir_bytes bytes; /* # of bytes to be copied */ { vir_bytes linear; - u32_t phys = 0; + phys_bytes phys = 0; if(!(linear = umap_local(rp, seg, vir_addr, bytes))) { printf("SYSTEM:umap_virtual: umap_local failed\n"); phys = 0; } else { if(vm_lookup(rp, linear, &phys, NULL) != OK) { - printf("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%x: 0x%lx failed\n", rp->p_name, seg, vir_addr); phys = 0; } else { if(phys == 0) @@ -375,7 +375,7 @@ vir_bytes bytes; /* # of bytes to be copied */ * so that the umap makes sense. */ if(bytes > 0 && !vm_contiguous(rp, linear, bytes)) { - printf("umap_virtual: %s: %d at 0x%lx (vir 0x%lx) not contiguous\n", + printf("umap_virtual: %s: %lu at 0x%lx (vir 0x%lx) not contiguous\n", rp->p_name, bytes, linear, vir_addr); return 0; } @@ -393,7 +393,7 @@ vir_bytes bytes; /* # of bytes to be copied */ * vm_lookup * *===========================================================================*/ PUBLIC int vm_lookup(const struct proc *proc, const vir_bytes virtual, - vir_bytes *physical, u32_t *ptent) + phys_bytes *physical, u32_t *ptent) { u32_t *root, *pt; int pde, pte; @@ -451,7 +451,7 @@ PUBLIC int vm_lookup(const struct proc *proc, const vir_bytes virtual, PUBLIC int vm_contiguous(const struct proc *targetproc, vir_bytes vir_buf, size_t bytes) { int first = 1, r; - u32_t prev_phys = 0; /* Keep lints happy. */ + phys_bytes prev_phys = 0; /* Keep lints happy. */ u32_t po; assert(targetproc); @@ -472,7 +472,7 @@ PUBLIC int vm_contiguous(const struct proc *targetproc, vir_bytes vir_buf, size_ /* Keep going as long as we cross a page boundary. */ while(bytes > 0) { - u32_t phys; + phys_bytes phys; if((r=vm_lookup(targetproc, vir_buf, &phys, NULL)) != OK) { printf("vm_contiguous: vm_lookup failed, %d\n", r); @@ -540,7 +540,7 @@ PUBLIC void delivermsg(struct proc *rp) if (copy_msg_to_user(rp, &rp->p_delivermsg, (message *) rp->p_delivermsg_vir)) { - printf("WARNING wrong user pointer 0x%08x from " + printf("WARNING wrong user pointer 0x%08lx from " "process %s / %d\n", rp->p_delivermsg_vir, rp->p_name, @@ -729,7 +729,7 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */ vir_addr[i]->offset, bytes); if(phys_addr[i] == 0) { printf("virtual_copy: map 0x%x failed for %s seg %d, " - "offset %lx, len %d, i %d\n", + "offset %lx, len %lu, i %d\n", type, p->p_name, seg_index, vir_addr[i]->offset, bytes, i); } @@ -799,11 +799,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_])) { - printf("ignoring page table src: %s / %d at 0x%lx\n", + printf("ignoring page table src: %s / %d at 0x%x\n", procs[_SRC_]->p_name, procs[_SRC_]->p_endpoint, procs[_SRC_]->p_seg.p_cr3); } if(!NOPT(procs[_DST_])) { - printf("ignoring page table dst: %s / %d at 0x%lx\n", + printf("ignoring page table dst: %s / %d at 0x%x\n", procs[_DST_]->p_name, procs[_DST_]->p_endpoint, procs[_DST_]->p_seg.p_cr3); } diff --git a/kernel/proc.c b/kernel/proc.c index a126844c4..b8cf5cf99 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -506,7 +506,7 @@ PRIVATE int do_sync_ipc(struct proc * caller_ptr, /* who made the call */ if (call_nr != SENDREC && call_nr != RECEIVE && iskerneln(src_dst_p)) { #if DEBUG_ENABLE_IPC_WARNINGS - printf("sys_call: trap %d not allowed, caller %d, src_dst %d\n", + printf("sys_call: trap %s not allowed, caller %d, src_dst %d\n", callname, proc_nr(caller_ptr), src_dst_e); #endif return(ETRAPDENIED); /* trap denied by mask or kernel */ diff --git a/kernel/proto.h b/kernel/proto.h index 71a646e05..3aae90a34 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -208,7 +208,7 @@ _PROTOTYPE( int arch_umap, (const struct proc *pr, vir_bytes, vir_bytes, _PROTOTYPE( int arch_do_vmctl, (message *m_ptr, struct proc *p)); _PROTOTYPE( int vm_contiguous, (const struct proc *targetproc, vir_bytes vir_buf, size_t count)); _PROTOTYPE( void proc_stacktrace, (struct proc *proc) ); -_PROTOTYPE( int vm_lookup, (const struct proc *proc, vir_bytes virtual, vir_bytes *result, u32_t *ptent)); +_PROTOTYPE( int vm_lookup, (const struct proc *proc, vir_bytes virtual, phys_bytes *result, u32_t *ptent)); _PROTOTYPE( void delivermsg, (struct proc *target)); _PROTOTYPE( void arch_do_syscall, (struct proc *proc) ); _PROTOTYPE( int arch_phys_map, (int index, phys_bytes *addr, diff --git a/kernel/system/do_mcontext.c b/kernel/system/do_mcontext.c index ec93c86f0..c105acf5e 100644 --- a/kernel/system/do_mcontext.c +++ b/kernel/system/do_mcontext.c @@ -44,7 +44,7 @@ PUBLIC int do_getmcontext(struct proc * caller, message * m_ptr) if (proc_used_fpu(rp)) { /* make sure that the FPU context is saved into proc structure first */ save_fpu(rp); - mc.mc_fpu_flags = 0 | rp->p_misc_flags & MF_FPU_INITIALIZED; + mc.mc_fpu_flags = rp->p_misc_flags & MF_FPU_INITIALIZED; memcpy(&(mc.mc_fpu_state), rp->p_fpu_state.fpu_save_area_p, FPU_XFP_SIZE); } diff --git a/kernel/system/do_sigsend.c b/kernel/system/do_sigsend.c index 6cabc10df..3d1324344 100644 --- a/kernel/system/do_sigsend.c +++ b/kernel/system/do_sigsend.c @@ -54,7 +54,7 @@ PUBLIC int do_sigsend(struct proc * caller, message * m_ptr) /* Finish the sigcontext initialization. */ sc.sc_mask = smsg.sm_mask; - sc.sc_flags = 0 | rp->p_misc_flags & MF_FPU_INITIALIZED; + sc.sc_flags = rp->p_misc_flags & MF_FPU_INITIALIZED; /* Copy the sigcontext structure to the user's stack. */ if((r=data_copy_vmcheck(caller, KERNEL, (vir_bytes) &sc, m_ptr->SIG_ENDPT,