summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2020-02-19 16:55:05 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2020-02-19 16:55:05 +0000
commita12e4d3f53a5ebead43b66e7ced661ad9360b96f (patch)
tree5f3d922db3609ee8b81b54dc72cafe2ab0431b1c /sys
parent309f5b1fb2c7f0ee8fe7491b2c3373507a4eea51 (diff)
Make sure the first 2MB page of the kernel is actually mapped RO in the
direct map by using a properly aligned address. To prevent further confusion, remove __kernel_base_phys from the linker script and rename __kernel_end_phys into __kernel_phys_end. Hinted at by Maxime Villard. ok millert@, deraadt@, mpi@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/locore0.S6
-rw-r--r--sys/arch/amd64/conf/ld.script8
2 files changed, 7 insertions, 7 deletions
diff --git a/sys/arch/amd64/amd64/locore0.S b/sys/arch/amd64/amd64/locore0.S
index 62d31e89917..9699385dbf2 100644
--- a/sys/arch/amd64/amd64/locore0.S
+++ b/sys/arch/amd64/amd64/locore0.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore0.S,v 1.18 2020/01/24 05:27:31 kettenis Exp $ */
+/* $OpenBSD: locore0.S,v 1.19 2020/02/19 16:55:04 kettenis Exp $ */
/* $NetBSD: locore.S,v 1.13 2004/03/25 18:33:17 drochner Exp $ */
/*
@@ -511,9 +511,9 @@ map_tables:
movl $(NDML2_ENTRIES * NPDPG), %ecx
1: orl $(PG_V|PG_KW|PG_PS), %eax
orl RELOC(pg_g_kern), %eax
- cmpl $__kernel_base_phys, %eax
+ cmpl $__kernel_phys_base, %eax
jl store_pte
- cmpl $__kernel_end_phys, %eax
+ cmpl $__kernel_phys_end, %eax
jg store_pte
andl $(~PG_KW), %eax
store_pte:
diff --git a/sys/arch/amd64/conf/ld.script b/sys/arch/amd64/conf/ld.script
index 418eb5ba533..bc7ce33756e 100644
--- a/sys/arch/amd64/conf/ld.script
+++ b/sys/arch/amd64/conf/ld.script
@@ -1,4 +1,4 @@
-/* $OpenBSD: ld.script,v 1.15 2019/11/09 20:07:00 guenther Exp $ */
+/* $OpenBSD: ld.script,v 1.16 2020/02/19 16:55:04 kettenis Exp $ */
/*
* Copyright (c) 2009 Tobias Weingartner <weingart@tepid.org>
@@ -40,13 +40,13 @@ __ALIGN_SIZE = 0x1000;
__kernel_base = 0xffffffff80000000;
__kernel_virt_base = __kernel_base + 0x1000000;
__kernel_phys_base = 0x1000000;
-__kernel_base_phys = __kernel_phys_base + SIZEOF_HEADERS;
__kernel_virt_to_phys = __kernel_phys_base - __kernel_virt_base;
ENTRY(start)
SECTIONS
{
- .text (__kernel_virt_base + SIZEOF_HEADERS) : AT (__kernel_base_phys)
+ .text (__kernel_virt_base + SIZEOF_HEADERS) :
+ AT (__kernel_phys_base + SIZEOF_HEADERS)
{
start = .;
locore0.o(.text)
@@ -148,7 +148,7 @@ SECTIONS
. = ALIGN(0x200000);
_end = .;
PROVIDE (end = .);
- __kernel_end_phys = . + __kernel_virt_to_phys;
+ __kernel_phys_end = . + __kernel_virt_to_phys;
/* XXX - hack alert, since we are not C++, nuke these */
/DISCARD/ :