提交 0441ba0f 创建 作者: Silas Boyd-Wickizer's avatar Silas Boyd-Wickizer

Switch from mcmodel=large to mcmodel=kernel.

上级 2a270e5c
...@@ -18,7 +18,7 @@ LD = $(TOOLPREFIX)ld ...@@ -18,7 +18,7 @@ LD = $(TOOLPREFIX)ld
OBJCOPY = $(TOOLPREFIX)objcopy OBJCOPY = $(TOOLPREFIX)objcopy
OBJDUMP = $(TOOLPREFIX)objdump OBJDUMP = $(TOOLPREFIX)objdump
CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb -m64 \ CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb -m64 \
-Werror -fms-extensions -mno-sse -Werror -fms-extensions -mno-sse -mcmodel=kernel
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector) CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
ASFLAGS = -m64 -gdwarf-2 ASFLAGS = -m64 -gdwarf-2
LDFLAGS += -m elf_x86_64 LDFLAGS += -m elf_x86_64
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# ask the loader to load the kernel at physical 2MB and then set up the # ask the loader to load the kernel at physical 2MB and then set up the
# necessary memory mapping to switch to the higher address. # necessary memory mapping to switch to the higher address.
# The value of KBASE must match the definitions in vmx.h and kernel.ld. # The value of KBASE must match the definitions in vmx.h and kernel.ld.
#define KBASE 0xffffff0000000000 /* last TB */ #define KBASE 0xFFFFFFFF80000000 /* -2GB */
# PADDR(x) is the physical memory address corresponding to x. # PADDR(x) is the physical memory address corresponding to x.
# Until we set up the memory map, fairly late in this file, we have to # Until we set up the memory map, fairly late in this file, we have to
...@@ -270,15 +270,16 @@ colorbar: ...@@ -270,15 +270,16 @@ colorbar:
.align 4096 .align 4096
pml4: pml4:
.quad PADDR(pdpt) + (1<<0) + (1<<1) // present, read/write .quad PADDR(pdpt) + (1<<0) + (1<<1) // present, read/write
.quad 0 .space 4096 - 16
.space 4096 - 2*16
.quad PADDR(pdpt) + (1<<0) + (1<<1) // present, read/write .quad PADDR(pdpt) + (1<<0) + (1<<1) // present, read/write
.quad 0
.align 4096 .align 4096
pdpt: pdpt:
.quad PADDR(pdt) + (1<<0) + (1<<1) // present, read/write .quad PADDR(pdt) + (1<<0) + (1<<1) // present, read/write
.space 4096 - 8 .quad 0
.space 4096 - 2*16
.quad PADDR(pdt) + (1<<0) + (1<<1) // present, read/write
.quad 0
.align 4096 .align 4096
pdt: pdt:
......
#include "types.h"
...@@ -4,7 +4,7 @@ ENTRY(xxx) ...@@ -4,7 +4,7 @@ ENTRY(xxx)
SECTIONS SECTIONS
{ {
. = 0xFFFFFF0000100000; . = 0xFFFFFFFF80100000;
PROVIDE(text = .); PROVIDE(text = .);
.text : AT(0x100000) { .text : AT(0x100000) {
*(.text .stub .text.* .gnu.linkonce.t.*) *(.text .stub .text.* .gnu.linkonce.t.*)
......
...@@ -32,7 +32,7 @@ void lidt(void*, int); ...@@ -32,7 +32,7 @@ void lidt(void*, int);
void ltr(int); void ltr(int);
void lgdt(void*, int); void lgdt(void*, int);
#define KBASE 0xffffff0000000000ull #define KBASE 0xFFFFFFFF80000000ull
#define KADDR(x) ((void*)(KBASE+(uintptr)(x))) #define KADDR(x) ((void*)(KBASE+(uintptr)(x)))
#define PADDR(x) ((uintptr)(x) - KBASE) #define PADDR(x) ((uintptr)(x) - KBASE)
#define PGSIZE (2*1024*1024ull) #define PGSIZE (2*1024*1024ull)
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论