Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145634610
D54946.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D54946.diff
View Options
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -155,13 +155,6 @@
vm_paddr_t efi_systbl_phys;
static struct efi_map_header *efihdr;
-/* pagezero_* implementations are provided in support.S */
-void pagezero_simple(void *);
-void pagezero_cache(void *);
-
-/* pagezero_simple is default pagezero */
-void (*pagezero)(void *p) = pagezero_simple;
-
int (*apei_nmi)(void);
#if defined(PERTHREAD_SSP_WARNING)
@@ -720,9 +713,6 @@
/* Same as with above calculations */
dczva_line_shift = DCZID_BS_SIZE(dczid_el0);
dczva_line_size = sizeof(int) << dczva_line_shift;
-
- /* Change pagezero function */
- pagezero = pagezero_cache;
}
}
diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -147,6 +147,8 @@
#include <machine/asan.h>
#include <machine/cpu_feat.h>
+#include <machine/elf.h>
+#include <machine/ifunc.h>
#include <machine/machdep.h>
#include <machine/md_var.h>
#include <machine/pcb.h>
@@ -529,6 +531,7 @@
static void bti_free_range(void *ctx, void *node);
static int pmap_bti_copy(pmap_t dst_pmap, pmap_t src_pmap);
static void pmap_bti_deassign_all(pmap_t pmap);
+static void pagezero(void *);
/*
* These load the old table data and store the new value.
@@ -10207,3 +10210,22 @@
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_SKIP,
NULL, 0, sysctl_kmaps, "A",
"Dump kernel address layout");
+
+
+void pagezero_simple(void *);
+void pagezero_cache(void *);
+void pagezero_mops(void *);
+
+DEFINE_IFUNC(static, void, pagezero, (void *))
+{
+ uint32_t dczid_el0;
+
+ dczid_el0 = READ_SPECIALREG(dczid_el0);
+
+ if (elf_hwcap2 & HWCAP2_MOPS)
+ return (pagezero_mops);
+ else if ((dczid_el0 & DCZID_DZP) == 0)
+ return (pagezero_cache);
+ else
+ return (pagezero_simple);
+}
diff --git a/sys/arm64/arm64/support.S b/sys/arm64/arm64/support.S
--- a/sys/arm64/arm64/support.S
+++ b/sys/arm64/arm64/support.S
@@ -397,4 +397,16 @@
END(pagezero_cache)
+/*
+ * pagezero, MOPS implementation
+ */
+ENTRY(pagezero_mops)
+ mov x1, #PAGE_SIZE
+ .inst 0x19df0420 /* setp [x0]!, x1!, xzr */
+ .inst 0x19df4420 /* setm [x0]!, x1!, xzr */
+ .inst 0x19df8420 /* sete [x0]!, x1!, xzr */
+ ret
+
+END(pagezero_mops)
+
GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/include/machdep.h b/sys/arm64/include/machdep.h
--- a/sys/arm64/include/machdep.h
+++ b/sys/arm64/include/machdep.h
@@ -54,7 +54,6 @@
void parse_fdt_bootargs(void);
#endif
int memory_mapping_mode(vm_paddr_t pa);
-extern void (*pagezero)(void *);
#ifdef SOCDEV_PA
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 23, 11:08 AM (9 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28954694
Default Alt Text
D54946.diff (2 KB)
Attached To
Mode
D54946: arm64: Add MOPS implementation of pagezero()
Attached
Detach File
Event Timeline
Log In to Comment