Be more strict with warnings
This commit is contained in:
parent
560b0a1705
commit
952d8fa294
@ -3,7 +3,7 @@ MOON_SRC := $(MOON_DIR)/src
|
|||||||
MOON_OBJ := $(MOON_DIR)/lib
|
MOON_OBJ := $(MOON_DIR)/lib
|
||||||
MOON_BIN := $(MOON_DIR)/bin
|
MOON_BIN := $(MOON_DIR)/bin
|
||||||
|
|
||||||
CFLAGS := -Wall -Wextra -Werror -Os -ffreestanding -fstack-protector-all -fno-omit-frame-pointer -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -fshort-wchar -mcmodel=kernel -I$(MOON_DIR)/include -isystem $(MOON_DIR)/include/std
|
CFLAGS := -pedantic -Wall -Wextra -Werror -Wfloat-equal -Wundef -Wcast-align -Wwrite-strings -Wlogical-op -Wredundant-decls -Wshadow -Os -ffreestanding -fstack-protector-all -fno-omit-frame-pointer -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -fshort-wchar -mcmodel=kernel -I$(MOON_DIR)/include -isystem $(MOON_DIR)/include/std
|
||||||
CXXFLAGS := -fno-rtti -fno-exceptions
|
CXXFLAGS := -fno-rtti -fno-exceptions
|
||||||
ASMFLAGS := -felf64
|
ASMFLAGS := -felf64
|
||||||
LDFLAGS := -T$(MOON_DIR)/moon.ld -nostdlib -lgcc -Wl,--build-id=none -z max-page-size=0x1000
|
LDFLAGS := -T$(MOON_DIR)/moon.ld -nostdlib -lgcc -Wl,--build-id=none -z max-page-size=0x1000
|
||||||
|
@ -13,7 +13,7 @@ namespace Paging
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(); // fetch page table from cr3
|
void init(); // fetch page table from cr3
|
||||||
void init(PageTable* PML4);
|
void init(PageTable* cr3);
|
||||||
|
|
||||||
void map(uint64_t virtualAddress, uint64_t physicalAddress, int flags);
|
void map(uint64_t virtualAddress, uint64_t physicalAddress, int flags);
|
||||||
void remap(uint64_t virtualAddress, int flags);
|
void remap(uint64_t virtualAddress, int flags);
|
||||||
|
@ -62,7 +62,7 @@ void PMM::init()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
free_mem += MMapEnt_Size(ptr);
|
free_mem += MMapEnt_Size(ptr);
|
||||||
for (uint64_t i = 0; i < (MMapEnt_Size(ptr) / 4096); i++) { bitmap_set(index + i, false); }
|
for (uint64_t j = 0; j < (MMapEnt_Size(ptr) / 4096); j++) { bitmap_set(index + j, false); }
|
||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,9 @@ namespace Paging
|
|||||||
asm volatile("mov %%cr3, %0" : "=r"(PML4));
|
asm volatile("mov %%cr3, %0" : "=r"(PML4));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualMemoryManager::init(PageTable* PML4)
|
void VirtualMemoryManager::init(PageTable* cr3)
|
||||||
{
|
{
|
||||||
this->PML4 = PML4;
|
PML4 = cr3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualMemoryManager::unmap(uint64_t virtualAddress)
|
void VirtualMemoryManager::unmap(uint64_t virtualAddress)
|
||||||
|
@ -24,22 +24,22 @@
|
|||||||
#define ALIGN(ptr) \
|
#define ALIGN(ptr) \
|
||||||
if (ALIGNMENT > 1) \
|
if (ALIGNMENT > 1) \
|
||||||
{ \
|
{ \
|
||||||
uintptr_t diff; \
|
uintptr_t align_diff; \
|
||||||
ptr = (void*)((uintptr_t)ptr + ALIGN_INFO); \
|
ptr = (void*)((uintptr_t)ptr + ALIGN_INFO); \
|
||||||
diff = (uintptr_t)ptr & (ALIGNMENT - 1); \
|
align_diff = (uintptr_t)ptr & (ALIGNMENT - 1); \
|
||||||
if (diff != 0) \
|
if (align_diff != 0) \
|
||||||
{ \
|
{ \
|
||||||
diff = ALIGNMENT - diff; \
|
align_diff = ALIGNMENT - align_diff; \
|
||||||
ptr = (void*)((uintptr_t)ptr + diff); \
|
ptr = (void*)((uintptr_t)ptr + align_diff); \
|
||||||
} \
|
} \
|
||||||
*((ALIGN_TYPE*)((uintptr_t)ptr - ALIGN_INFO)) = diff + ALIGN_INFO; \
|
*((ALIGN_TYPE*)((uintptr_t)ptr - ALIGN_INFO)) = align_diff + ALIGN_INFO; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define UNALIGN(ptr) \
|
#define UNALIGN(ptr) \
|
||||||
if (ALIGNMENT > 1) \
|
if (ALIGNMENT > 1) \
|
||||||
{ \
|
{ \
|
||||||
uintptr_t diff = *((ALIGN_TYPE*)((uintptr_t)ptr - ALIGN_INFO)); \
|
uintptr_t align_diff = *((ALIGN_TYPE*)((uintptr_t)ptr - ALIGN_INFO)); \
|
||||||
if (diff < (ALIGNMENT + ALIGN_INFO)) { ptr = (void*)((uintptr_t)ptr - diff); } \
|
if (align_diff < (ALIGNMENT + ALIGN_INFO)) { ptr = (void*)((uintptr_t)ptr - align_diff); } \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LIBALLOC_MAGIC 0xc001c0de
|
#define LIBALLOC_MAGIC 0xc001c0de
|
||||||
|
@ -5,7 +5,7 @@ LIBC_BIN := $(LIBC_DIR)/bin
|
|||||||
|
|
||||||
DESTDIR ?= $(LUNA_BASE)/usr/lib
|
DESTDIR ?= $(LUNA_BASE)/usr/lib
|
||||||
|
|
||||||
CFLAGS := -Wall -Wextra -Werror -Os -nostdlib -fno-omit-frame-pointer
|
CFLAGS := -Wall -Wextra -Werror -Os -nostdlib -fno-omit-frame-pointer -pedantic -Wfloat-equal -Wundef -Wcast-align -Wwrite-strings -Wlogical-op -Wredundant-decls -Wshadow
|
||||||
CXXFLAGS := -fno-rtti -fno-exceptions
|
CXXFLAGS := -fno-rtti -fno-exceptions
|
||||||
ASMFLAGS := -felf64
|
ASMFLAGS := -felf64
|
||||||
|
|
||||||
|
@ -25,22 +25,22 @@
|
|||||||
#define ALIGN(ptr) \
|
#define ALIGN(ptr) \
|
||||||
if (ALIGNMENT > 1) \
|
if (ALIGNMENT > 1) \
|
||||||
{ \
|
{ \
|
||||||
uintptr_t diff; \
|
uintptr_t align_diff; \
|
||||||
ptr = (void*)((uintptr_t)ptr + ALIGN_INFO); \
|
ptr = (void*)((uintptr_t)ptr + ALIGN_INFO); \
|
||||||
diff = (uintptr_t)ptr & (ALIGNMENT - 1); \
|
align_diff = (uintptr_t)ptr & (ALIGNMENT - 1); \
|
||||||
if (diff != 0) \
|
if (align_diff != 0) \
|
||||||
{ \
|
{ \
|
||||||
diff = ALIGNMENT - diff; \
|
align_diff = ALIGNMENT - align_diff; \
|
||||||
ptr = (void*)((uintptr_t)ptr + diff); \
|
ptr = (void*)((uintptr_t)ptr + align_diff); \
|
||||||
} \
|
} \
|
||||||
*((ALIGN_TYPE*)((uintptr_t)ptr - ALIGN_INFO)) = diff + ALIGN_INFO; \
|
*((ALIGN_TYPE*)((uintptr_t)ptr - ALIGN_INFO)) = align_diff + ALIGN_INFO; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define UNALIGN(ptr) \
|
#define UNALIGN(ptr) \
|
||||||
if (ALIGNMENT > 1) \
|
if (ALIGNMENT > 1) \
|
||||||
{ \
|
{ \
|
||||||
uintptr_t diff = *((ALIGN_TYPE*)((uintptr_t)ptr - ALIGN_INFO)); \
|
uintptr_t align_diff = *((ALIGN_TYPE*)((uintptr_t)ptr - ALIGN_INFO)); \
|
||||||
if (diff < (ALIGNMENT + ALIGN_INFO)) { ptr = (void*)((uintptr_t)ptr - diff); } \
|
if (align_diff < (ALIGNMENT + ALIGN_INFO)) { ptr = (void*)((uintptr_t)ptr - align_diff); } \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LIBALLOC_MAGIC 0xc001c0de
|
#define LIBALLOC_MAGIC 0xc001c0de
|
||||||
|
Loading…
Reference in New Issue
Block a user