Enable more C warnings and fix a few instances of those warnings.

This commit is contained in:
Ali Mashtizadeh 2014-09-29 13:46:38 -07:00
parent dac51c8166
commit 3610f34c63
5 changed files with 28 additions and 26 deletions

View File

@ -49,8 +49,7 @@ if os.environ.has_key('LDFLAGS'):
#env.Append(CPPFLAGS = [ "-Wall", "-Wformat=2", "-Wextra", "-Wwrite-strings",
# "-Wno-unused-parameter", "-Wmissing-format-attribute",
# "-Werror" ])
#env.Append(CFLAGS = [ "-Wmissing-prototypes", "-Wmissing-declarations",
# "-Wshadow", "-Wbad-function-cast", "-Werror" ])
env.Append(CFLAGS = [ "-Wshadow", "-Wno-typedef-redefinition" ])
#env.Append(CXXFLAGS = [ "-Wno-non-template-friend", "-Woverloaded-virtual",
# "-Wcast-qual", "-Wcast-align", "-Wconversion",
# "-Weffc++", "-std=c++0x", "-Werror" ])

View File

@ -226,8 +226,8 @@ PMap_Unmap(AS *as, uint64_t va, uint64_t pages)
PageEntry *entry;
for (i = 0; i < pages; i++) {
uint64_t va = va + PGSIZE * i;
PMapLookupEntry(as, va, &entry, PGSIZE);
uint64_t vai = va + PGSIZE * i;
PMapLookupEntry(as, vai, &entry, PGSIZE);
if (!entry) {
kprintf("Unmap tried to allocate memory!\n");
return false;
@ -319,32 +319,32 @@ PMap_Dump(AS *space)
kprintf("Level 1: %016llx\n", (uint64_t)pte);
for (j = 0; j < PAGETABLE_ENTRIES; j++) {
PageEntry pte = l1->entries[j];
PageTable *l2 = (PageTable *)DMPA2VA(pte & 0xFFFFFFFFFFFFF000);
PageEntry pte2 = l1->entries[j];
PageTable *l2 = (PageTable *)DMPA2VA(pte2 & 0xFFFFFFFFFFFFF000);
if (!(pte & PTE_P))
if (!(pte2 & PTE_P))
continue;
kprintf("Level 2: %016llx\n", (uint64_t)pte);
kprintf("Level 2: %016llx\n", (uint64_t)pte2);
for (k = 0; k < PAGETABLE_ENTRIES; k++) {
PageEntry pte = l2->entries[k];
PageTable *l3 = (PageTable *)DMPA2VA(pte & 0xFFFFFFFFFFFFF000);
PageEntry pte3 = l2->entries[k];
PageTable *l3 = (PageTable *)DMPA2VA(pte3 & 0xFFFFFFFFFFFFF000);
if (!(pte & PTE_P))
if (!(pte3 & PTE_P))
continue;
kprintf("Level 3: %016llx:%016llx\n",
AddrFromIJKL(i, j, k, l),
(uint64_t)pte);
(uint64_t)pte3);
if ((pte & PTE_PS) == 0) {
if ((pte3 & PTE_PS) == 0) {
for (l = 0; l < PAGETABLE_ENTRIES; l++) {
PageEntry pte = l3->entries[l];
PageEntry pte4 = l3->entries[l];
kprintf("Level 4: %016llx:%016llx\n",
AddrFromIJKL(i, j, k, l),
(uint64_t)pte);
(uint64_t)pte4);
}
l = 0;
}

View File

@ -4,6 +4,7 @@
#include <string.h>
#include <sys/kassert.h>
#include <sys/kdebug.h>
#include <sys/kmem.h>
#include <sys/pci.h>
#include <sys/sga.h>
@ -387,8 +388,8 @@ AHCI_Reset(AHCI *ahci)
AHCI_Dump(ahci);
// Reset controller
uint32_t caps = hc->cap;
uint32_t pi = hc->pi;
//uint32_t caps = hc->cap;
//uint32_t pi = hc->pi;
hc->ghc |= AHCI_GHC_AE;
hc->ghc |= AHCI_GHC_HR;

View File

@ -12,6 +12,8 @@ typedef struct DebugCommand {
__attribute__((section(".kdbgcmd"))) \
DebugCommand cmd_##_NAME = { #_NAME, _DESC, _FUNC }
void Debug_PrintHex(const char *data, size_t length, off_t off, size_t limit);
// Platform Functions
uintptr_t db_disasm(uintptr_t loc, bool altfmt);

View File

@ -38,35 +38,35 @@ Debug_PrintHex(const char *data, size_t length, off_t off, size_t limit)
if (ix >= limit || ix >= length)
return;
kprintf("%08lx ", row * row_size);
kprintf("%08lx ", ix);
size_t col;
for (col = 0; col < row_size; col++) {
size_t ix = row * row_size + col;
if ((limit != 0 && ix >= limit) || ix >= length) {
size_t ixc = ix + col;
if ((limit != 0 && ixc >= limit) || ixc >= length) {
stop = true;
for (; col < row_size; col++) {
kprintf(" ");
}
break;
}
ix += off;
ixc += off;
kprintf("%02X ", (unsigned char)data[ix]);
kprintf("%02X ", (unsigned char)data[ixc]);
}
kprintf(" |");
for (col = 0; col < row_size; col++) {
size_t ix = row * row_size + col;
if ((limit != 0 && ix >= limit) || ix >= length) {
size_t ixc = ix + col;
if ((limit != 0 && ixc >= limit) || ixc >= length) {
stop = true;
for (; col < row_size; col++) {
kprintf(" ");
}
break;
}
ix += off;
ixc += off;
unsigned char c = (unsigned char)data[ix];
unsigned char c = (unsigned char)data[ixc];
if (c >= 0x20 && c < 0x7F)
kprintf("%c", c);
else