Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/Kernel/Arch/i386/Boot/boot.S b/Kernel/Arch/i386/Boot/boot.S
- index 5ae068c7..2e334825 100644
- --- a/Kernel/Arch/i386/Boot/boot.S
- +++ b/Kernel/Arch/i386/Boot/boot.S
- @@ -5,7 +5,7 @@
- .set multiboot_flags, MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_VIDEO_MODE
- .set multiboot_checksum, -(MULTIBOOT_MAGIC + multiboot_flags)
- -.section .multiboot
- +.section .multiboot, "", @progbits
- .align 4
- .long MULTIBOOT_MAGIC
- @@ -36,7 +36,7 @@ stack_top:
- page_tables_start:
- .skip 4096*9
- -.section .text
- +.section .text.startup
- .global start
- .type start, @function
- diff --git a/Kernel/Makefile b/Kernel/Makefile
- index 6bee3dd5..5875f6d2 100644
- --- a/Kernel/Makefile
- +++ b/Kernel/Makefile
- @@ -117,13 +117,14 @@ EXTRA_OBJS = Arch/i386/Boot/boot.ao
- KERNEL = 1
- PROGRAM = kernel
- -
- -SUBPROJECT_CXXFLAGS += -pie -fPIE -ffreestanding -mno-80387 -mno-mmx -mno-sse -mno-sse2 -fno-asynchronous-unwind-tables
- +VERBOSE = 1
- +SUBPROJECT_CXXFLAGS += -fPIC -ffreestanding -mno-80387 -mno-mmx -mno-sse -mno-sse2 -fno-asynchronous-unwind-tables
- SUBPROJECT_CXXFLAGS += -nostdlib -nostdinc -nostdinc++ -g3
- SUBPROJECT_CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/9.2.0/
- SUBPROJECT_CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/9.2.0/i686-pc-serenity/
- -LDFLAGS += -Ttext 0x100000 -Wl,-T linker.ld -nostdlib -lgcc -lstdc++ -g3
- +LDFLAGS += -Wl,-e,start -nostdlib -lgcc -lstdc++ -g3 -pie -shared
- +#LDFLAGS += -Wl,-T linker.ld
- all: $(PROGRAM) $(MODULE_OBJS) kernel.map
- diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp
- index c764a4c1..4e6a4ce7 100644
- --- a/Kernel/VM/MemoryManager.cpp
- +++ b/Kernel/VM/MemoryManager.cpp
- @@ -76,20 +76,20 @@ void MemoryManager::initialize_paging()
- }
- // Disable writing to the kernel text and rodata segments.
- - extern u32 start_of_kernel_text;
- - extern u32 start_of_kernel_data;
- - for (size_t i = (u32)&start_of_kernel_text; i < (u32)&start_of_kernel_data; i += PAGE_SIZE) {
- - auto& pte = ensure_pte(kernel_page_directory(), VirtualAddress(i));
- - pte.set_writable(false);
- - }
- + //extern u32 start_of_kernel_text;
- + //extern u32 start_of_kernel_data;
- + //for (size_t i = (u32)&start_of_kernel_text; i < (u32)&start_of_kernel_data; i += PAGE_SIZE) {
- + // auto& pte = ensure_pte(kernel_page_directory(), VirtualAddress(i));
- + // pte.set_writable(false);
- + //}
- if (g_cpu_supports_nx) {
- // Disable execution of the kernel data and bss segments.
- - extern u32 end_of_kernel_bss;
- - for (size_t i = (u32)&start_of_kernel_data; i < (u32)&end_of_kernel_bss; i += PAGE_SIZE) {
- - auto& pte = ensure_pte(kernel_page_directory(), VirtualAddress(i));
- - pte.set_execute_disabled(true);
- - }
- + //extern u32 end_of_kernel_bss;
- + //for (size_t i = (u32)&start_of_kernel_data; i < (u32)&end_of_kernel_bss; i += PAGE_SIZE) {
- + // auto& pte = ensure_pte(kernel_page_directory(), VirtualAddress(i));
- + // pte.set_execute_disabled(true);
- + //}
- }
- // FIXME: We should move everything kernel-related above the 0xc0000000 virtual mark.
- diff --git a/Kernel/init.cpp b/Kernel/init.cpp
- index 7b3c0ee7..14f45ec1 100644
- --- a/Kernel/init.cpp
- +++ b/Kernel/init.cpp
- @@ -320,8 +320,8 @@ extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables)
- idt_init();
- // call global constructors after gtd and itd init
- - for (ctor_func_t* ctor = &start_ctors; ctor < &end_ctors; ctor++)
- - (*ctor)();
- + //for (ctor_func_t* ctor = &start_ctors; ctor < &end_ctors; ctor++)
- + // (*ctor)();
- keyboard = new KeyboardDevice;
- ps2mouse = new PS2MouseDevice;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement