diff --git a/arch/x86/pagetables.c b/arch/x86/pagetables.c index babf7eb3..a526a5aa 100644 --- a/arch/x86/pagetables.c +++ b/arch/x86/pagetables.c @@ -78,7 +78,7 @@ static inline void dump_page_table(void *table, int level) { dump_pte_flags(flags, sizeof(flags), pt[i]); paddr_t paddr = mfn_to_paddr(pt[i].mfn); - printk("[%p] %*s%d[%03u] paddr: 0x%016lx flags: %s\n", virt_to_paddr(pt), + printk("[%p] %*s%d[%03u] paddr: 0x%016lx flags: %s\n", _ptr(virt_to_paddr(pt)), (4 - level) * 2, "L", level, i, paddr, flags); if (level == 2 && ((pde_t *) pt)[i].PS) @@ -109,11 +109,11 @@ static void *init_map_mfn(mfn_t mfn) { return _tmp; } -static mfn_t get_cr3_mfn(cr3_t *cr3) { - if (mfn_invalid(cr3->mfn)) - cr3->mfn = get_free_frame(); +static mfn_t get_cr3_mfn(cr3_t *cr3_entry) { + if (mfn_invalid(cr3_entry->mfn)) + cr3_entry->mfn = get_free_frame(); - return cr3->mfn; + return cr3_entry->mfn; } static mfn_t get_pgentry_mfn(mfn_t tab_mfn, pt_index_t index, unsigned long flags) { diff --git a/arch/x86/traps.c b/arch/x86/traps.c index f58cb47c..ceaf02bd 100644 --- a/arch/x86/traps.c +++ b/arch/x86/traps.c @@ -174,10 +174,10 @@ static void dump_control_regs(const struct cpu_regs *regs) { static void dump_segment_regs(const struct cpu_regs *regs) { printk("CURRENT:\n" - "CS=0x%04x DS=0x%04x SS=0x%04x\n" - "ES=0x%04x FS=0x%04x GS=0x%04x\n" + "CS=0x%04lx DS=0x%04lx SS=0x%04lx\n" + "ES=0x%04lx FS=0x%04lx GS=0x%04lx\n" "EXCEPTION:\n" - "CS=0x%04x SS=0x%04x\n\n", + "CS=0x%04lx SS=0x%04lx\n\n", read_cs(), read_ds(), read_ss(), read_es(), read_fs(), read_gs(), regs->cs, regs->ss); } @@ -192,7 +192,7 @@ static void dump_stack(const struct cpu_regs *regs, unsigned words) { printk("STACK[0x%016p]:", sp); for (unsigned i = 0; i == 0 || (_ul(&sp[i]) % PAGE_SIZE_2M); i++) { if ((i % words) == 0) - printk("\n0x%04x: ", i * (sizeof(unsigned long))); + printk("\n0x%04lx: ", i * (sizeof(unsigned long))); printk("%016lx ", sp[i]); } printk("\n\n"); diff --git a/common/acpi.c b/common/acpi.c index c9bb3b5b..4ca4e6e1 100644 --- a/common/acpi.c +++ b/common/acpi.c @@ -80,8 +80,8 @@ static inline void *find_rsdp(void *from, void *to) { rsdp_rev1_t *rsdp = addr; if (validate_rsdp(rsdp)) { - printk("ACPI: RSDP [%p] v%02x %.*s\n", virt_to_paddr(rsdp), rsdp->rev, - sizeof(rsdp->oem_id), rsdp->oem_id); + printk("ACPI: RSDP [%p] v%02x %.*s\n", _ptr(virt_to_paddr(rsdp)), rsdp->rev, + _int(sizeof(rsdp->oem_id)), rsdp->oem_id); return rsdp; } } @@ -147,9 +147,10 @@ static void acpi_dump_tables(void) { acpi_table_hdr_t *hdr = &tab->header; printk("ACPI: %.*s [%p] %04x (v%04x %.*s %04x %.*s %08x)\n", - sizeof(hdr->signature), &hdr->signature, tab, hdr->length, hdr->rev, - sizeof(hdr->oem_id), hdr->oem_id, hdr->oem_rev, - sizeof(hdr->asl_compiler_id), hdr->asl_compiler_id, hdr->asl_compiler_rev); + _int(sizeof(hdr->signature)), (char *) &hdr->signature, tab, hdr->length, + hdr->rev, _int(sizeof(hdr->oem_id)), hdr->oem_id, hdr->oem_rev, + _int(sizeof(hdr->asl_compiler_id)), hdr->asl_compiler_id, + hdr->asl_compiler_rev); } } @@ -157,7 +158,8 @@ static unsigned process_madt_entries(void) { acpi_madt_t *madt = (acpi_madt_t *) acpi_find_table(MADT_SIGNATURE); acpi_madt_entry_t *entry; - printk("ACPI: [MADT] LAPIC Addr: %p, Flags: %08x\n", madt->lapic_addr, madt->flags); + printk("ACPI: [MADT] LAPIC Addr: %p, Flags: %08x\n", _ptr(madt->lapic_addr), + madt->flags); for (void *addr = madt->entry; addr < (_ptr(madt) + madt->header.length); addr += entry->len) { diff --git a/include/compiler.h b/include/compiler.h index e035da0f..91b333cb 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -47,6 +47,7 @@ #ifndef __ASSEMBLY__ #define _ptr(val) ((void *) (unsigned long) (val)) #define _ul(val) ((unsigned long) (val)) +#define _int(val) ((int) (val)) #endif #define __aligned(x) __attribute__((__aligned__(x))) diff --git a/mm/pmm.c b/mm/pmm.c index 146c05fa..0f375af6 100644 --- a/mm/pmm.c +++ b/mm/pmm.c @@ -89,7 +89,8 @@ void display_memory_map(void) { for_each_memory_range (r) { printk("%11s: VA: [0x%016lx - 0x%016lx] PA: [0x%08lx - 0x%08lx]\n", r->name, - r->start, r->end, r->start - r->base, r->end - r->base); + _ul(r->start), _ul(r->end), _ul(r->start - r->base), + _ul(r->end - r->base)); } } diff --git a/mm/slab.c b/mm/slab.c index 45cdc3a1..f6418613 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -143,7 +143,7 @@ void *ktf_alloc(unsigned int size) { */ order_index -= 4; - printk("Alloc size %lu, powerof 2 size %lu, order %lu\n", size, size_power2, + printk("Alloc size %u, powerof 2 size %u, order %u\n", size, size_power2, order_index); /* Go through list of meta_slab_t and try to allocate a free slab */ list_for_each_entry (slab, &meta_slab_list[order_index], list) { diff --git a/smp/mptables.c b/smp/mptables.c index 572737ec..c5897ff8 100644 --- a/smp/mptables.c +++ b/smp/mptables.c @@ -129,7 +129,7 @@ static void dump_mpf(mpf_t *ptr) { static void dump_mpc_hdr(mpc_hdr_t *ptr) { printk("\nMP Configuration Table Header at %p:\n", ptr); - printk(" Signature: %.4s\n", &ptr->signature); + printk(" Signature: %.4s\n", (char *) &ptr->signature); printk(" Length: 0x%02x\n", ptr->length); printk(" Spec revision: 0x%02x\n", ptr->spec_rev); printk(" Checksum: 0x%02x\n", ptr->checksum); @@ -138,7 +138,7 @@ static void dump_mpc_hdr(mpc_hdr_t *ptr) { printk(" OEM Table Ptr: %p\n", _ptr(ptr->oem_tlb_ptr)); printk(" OEM Table Size: %x\n", ptr->oem_tlb_size); printk(" Entry count: %x\n", ptr->entry_count); - printk(" LAPIC base address: %p\n", ptr->lapic_base); + printk(" LAPIC base address: %p\n", _ptr(ptr->lapic_base)); printk(" Extended Table Length: %x\n", ptr->ext_length); printk(" Extended Table Checksum: %x\n", ptr->ext_checksum); } @@ -156,7 +156,7 @@ static inline void dump_mpc_bus_entry(const mpc_bus_entry_t *e) { static inline void dump_mpc_ioapic_entry(const mpc_ioapic_entry_t *e) { printk(" IOAPIC: ID=%x, Version=%x, Enabled=%x, Address: %p\n", e->id, e->version, - e->en, e->base_addr); + e->en, _ptr(e->base_addr)); } static const char *mpc_interrupt_type_names[] = {