Compare commits
2 Commits
4768d5fc12
...
0f5910add7
Author | SHA1 | Date | |
---|---|---|---|
0f5910add7 | |||
baa71b09cc |
@ -4,7 +4,7 @@ MOON_OBJ := $(MOON_DIR)/lib
|
||||
MOON_BIN := $(MOON_DIR)/bin
|
||||
|
||||
CFLAGS ?= -Os
|
||||
CFLAGS := ${CFLAGS} -pedantic -Wall -Wextra -Werror -Wfloat-equal -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Wswitch-default -Wcast-qual -Wundef -Wcast-align -Wwrite-strings -Wlogical-op -Wredundant-decls -Wshadow -Wconversion -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 := ${CFLAGS} -pedantic -Wall -Wextra -Werror -Wfloat-equal -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Wswitch-default -Wcast-qual -Wundef -Wcast-align -Wwrite-strings -Wlogical-op -Wredundant-decls -Wshadow -Wconversion -ffreestanding -fstack-protector-strong -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 -Wsign-promo -Wstrict-null-sentinel -Wctor-dtor-privacy
|
||||
ASMFLAGS := -felf64
|
||||
LDFLAGS := -T$(MOON_DIR)/moon.ld -nostdlib -lgcc -Wl,--build-id=none -z max-page-size=0x1000 -mno-red-zone -mcmodel=kernel
|
||||
|
@ -8,4 +8,6 @@ namespace Utilities
|
||||
|
||||
uint64_t get_rflags();
|
||||
uint64_t get_top_of_stack(uint64_t bottom, uint64_t stack_pages);
|
||||
uint64_t round_down_to_nearest_page(uint64_t addr);
|
||||
uint64_t round_up_to_nearest_page(uint64_t addr);
|
||||
}
|
@ -19,3 +19,14 @@ uint64_t Utilities::get_top_of_stack(uint64_t bottom, uint64_t stack_pages)
|
||||
{
|
||||
return bottom + (stack_pages * PAGE_SIZE) - sizeof(uintptr_t);
|
||||
}
|
||||
|
||||
uint64_t Utilities::round_down_to_nearest_page(uint64_t addr)
|
||||
{
|
||||
return addr - (addr % PAGE_SIZE);
|
||||
}
|
||||
|
||||
uint64_t Utilities::round_up_to_nearest_page(uint64_t addr)
|
||||
{
|
||||
if (addr % PAGE_SIZE) return addr + (PAGE_SIZE - (addr % PAGE_SIZE));
|
||||
return addr;
|
||||
}
|
Loading…
Reference in New Issue
Block a user