kernel: fix GCC warnings

This commit is contained in:
Arun Thomas 2011-07-18 19:44:17 +02:00
parent 51e66a47d8
commit c356e9997e
7 changed files with 19 additions and 17 deletions

View file

@ -494,7 +494,7 @@ PRIVATE void apic_calibrate_clocks(unsigned cpu)
tsc_delta = sub64(tsc1, tsc0); tsc_delta = sub64(tsc1, tsc0);
lapic_bus_freq[cpuid] = system_hz * lapic_delta / (PROBE_TICKS - 1); 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)); lapic_bus_freq[cpuid] / 1000000));
cpu_freq = mul64(div64u64(tsc_delta, PROBE_TICKS - 1), make64(system_hz, 0)); cpu_freq = mul64(div64u64(tsc_delta, PROBE_TICKS - 1), make64(system_hz, 0));
cpu_set_freq(cpuid, cpu_freq); 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].gsi_base = acpi_ioa->global_int_base;
ioa[n].pins = ((ioapic_read(ioa[n].addr, ioa[n].pins = ((ioapic_read(ioa[n].addr,
IOAPIC_VERSION) & 0xff0000) >> 16)+1; 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, acpi_ioa->id, ioa[n].addr, ioa[n].paddr,
ioa[n].pins); ioa[n].pins);
@ -920,6 +920,8 @@ PUBLIC int detect_ioapics(void)
if (machine.acpi_rsdp) if (machine.acpi_rsdp)
status = acpi_get_ioapics(io_apic, &nioapics, MAX_NR_IOAPICS); status = acpi_get_ioapics(io_apic, &nioapics, MAX_NR_IOAPICS);
else
status = 0;
if (!status) { if (!status) {
/* try something different like MPS */ /* try something different like MPS */
} }

View file

@ -136,7 +136,7 @@
#define INIT_TASK_PSW 0x1200 /* initial psw for tasks (with IOPL 1) */ #define INIT_TASK_PSW 0x1200 /* initial psw for tasks (with IOPL 1) */
#define TRACEBIT 0x0100 /* OR this with psw in proc[] for tracing */ #define TRACEBIT 0x0100 /* OR this with psw in proc[] for tracing */
#define SETPSW(rp, new) /* permits only certain bits to be set */ \ #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 IF_MASK 0x00000200
#define IOPL_MASK 0x003000 #define IOPL_MASK 0x003000

View file

@ -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 bytes; /* # of bytes to be copied */
{ {
vir_bytes linear; vir_bytes linear;
u32_t phys = 0; phys_bytes phys = 0;
if(!(linear = umap_local(rp, seg, vir_addr, bytes))) { if(!(linear = umap_local(rp, seg, vir_addr, bytes))) {
printf("SYSTEM:umap_virtual: umap_local failed\n"); printf("SYSTEM:umap_virtual: umap_local failed\n");
phys = 0; phys = 0;
} else { } else {
if(vm_lookup(rp, linear, &phys, NULL) != OK) { 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; phys = 0;
} else { } else {
if(phys == 0) if(phys == 0)
@ -375,7 +375,7 @@ vir_bytes bytes; /* # of bytes to be copied */
* so that the umap makes sense. * so that the umap makes sense.
*/ */
if(bytes > 0 && !vm_contiguous(rp, linear, bytes)) { 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); rp->p_name, bytes, linear, vir_addr);
return 0; return 0;
} }
@ -393,7 +393,7 @@ vir_bytes bytes; /* # of bytes to be copied */
* vm_lookup * * vm_lookup *
*===========================================================================*/ *===========================================================================*/
PUBLIC int vm_lookup(const struct proc *proc, const vir_bytes virtual, 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; u32_t *root, *pt;
int pde, pte; 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) PUBLIC int vm_contiguous(const struct proc *targetproc, vir_bytes vir_buf, size_t bytes)
{ {
int first = 1, r; int first = 1, r;
u32_t prev_phys = 0; /* Keep lints happy. */ phys_bytes prev_phys = 0; /* Keep lints happy. */
u32_t po; u32_t po;
assert(targetproc); 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. */ /* Keep going as long as we cross a page boundary. */
while(bytes > 0) { while(bytes > 0) {
u32_t phys; phys_bytes phys;
if((r=vm_lookup(targetproc, vir_buf, &phys, NULL)) != OK) { if((r=vm_lookup(targetproc, vir_buf, &phys, NULL)) != OK) {
printf("vm_contiguous: vm_lookup failed, %d\n", r); 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, if (copy_msg_to_user(rp, &rp->p_delivermsg,
(message *) rp->p_delivermsg_vir)) { (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", "process %s / %d\n",
rp->p_delivermsg_vir, rp->p_delivermsg_vir,
rp->p_name, rp->p_name,
@ -729,7 +729,7 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */
vir_addr[i]->offset, bytes); vir_addr[i]->offset, bytes);
if(phys_addr[i] == 0) { if(phys_addr[i] == 0) {
printf("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", "offset %lx, len %lu, i %d\n",
type, p->p_name, seg_index, vir_addr[i]->offset, type, p->p_name, seg_index, vir_addr[i]->offset,
bytes, i); bytes, i);
} }
@ -799,11 +799,11 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */
/* can't copy to/from process with PT without VM */ /* can't copy to/from process with PT without VM */
#define NOPT(p) (!(p) || !HASPT(p)) #define NOPT(p) (!(p) || !HASPT(p))
if(!NOPT(procs[_SRC_])) { 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); procs[_SRC_]->p_name, procs[_SRC_]->p_endpoint, procs[_SRC_]->p_seg.p_cr3);
} }
if(!NOPT(procs[_DST_])) { 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_name, procs[_DST_]->p_endpoint,
procs[_DST_]->p_seg.p_cr3); procs[_DST_]->p_seg.p_cr3);
} }

View file

@ -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 (call_nr != SENDREC && call_nr != RECEIVE && iskerneln(src_dst_p)) {
#if DEBUG_ENABLE_IPC_WARNINGS #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); callname, proc_nr(caller_ptr), src_dst_e);
#endif #endif
return(ETRAPDENIED); /* trap denied by mask or kernel */ return(ETRAPDENIED); /* trap denied by mask or kernel */

View file

@ -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 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( int vm_contiguous, (const struct proc *targetproc, vir_bytes vir_buf, size_t count));
_PROTOTYPE( void proc_stacktrace, (struct proc *proc) ); _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 delivermsg, (struct proc *target));
_PROTOTYPE( void arch_do_syscall, (struct proc *proc) ); _PROTOTYPE( void arch_do_syscall, (struct proc *proc) );
_PROTOTYPE( int arch_phys_map, (int index, phys_bytes *addr, _PROTOTYPE( int arch_phys_map, (int index, phys_bytes *addr,

View file

@ -44,7 +44,7 @@ PUBLIC int do_getmcontext(struct proc * caller, message * m_ptr)
if (proc_used_fpu(rp)) { if (proc_used_fpu(rp)) {
/* make sure that the FPU context is saved into proc structure first */ /* make sure that the FPU context is saved into proc structure first */
save_fpu(rp); 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, memcpy(&(mc.mc_fpu_state), rp->p_fpu_state.fpu_save_area_p,
FPU_XFP_SIZE); FPU_XFP_SIZE);
} }

View file

@ -54,7 +54,7 @@ PUBLIC int do_sigsend(struct proc * caller, message * m_ptr)
/* Finish the sigcontext initialization. */ /* Finish the sigcontext initialization. */
sc.sc_mask = smsg.sm_mask; 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. */ /* Copy the sigcontext structure to the user's stack. */
if((r=data_copy_vmcheck(caller, KERNEL, (vir_bytes) &sc, m_ptr->SIG_ENDPT, if((r=data_copy_vmcheck(caller, KERNEL, (vir_bytes) &sc, m_ptr->SIG_ENDPT,