bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/9] aarch64: Add vm_param.h


From: Sergey Bugaev
Subject: [PATCH 4/9] aarch64: Add vm_param.h
Date: Mon, 15 Apr 2024 12:01:44 +0300

And make it so that the generic vm_param.h doesn't require the machine-
specific one to define PAGE_SIZE etc.  We *don't* want a PAGE_SIZE
constant to be statically exported to userland; instead userland should
initialize vm_page_size by querying vm_statistics(), and then use
vm_page_size.

We'd also like to eventually avoid exporting VM_MAX_ADDRESS, but this is
not feasible at the moment.  To make it feasible in the future, userland
should try to avoid relying on the definition where possible.
---
 aarch64/Makefrag.am                     |  1 +
 aarch64/include/mach/aarch64/vm_param.h | 34 +++++++++++++++++++++++++
 include/mach/vm_param.h                 |  6 ++---
 3 files changed, 38 insertions(+), 3 deletions(-)
 create mode 100644 aarch64/include/mach/aarch64/vm_param.h

diff --git a/aarch64/Makefrag.am b/aarch64/Makefrag.am
index 7949d7ba..3da88c18 100644
--- a/aarch64/Makefrag.am
+++ b/aarch64/Makefrag.am
@@ -32,6 +32,7 @@ include_mach_aarch64_HEADERS = \
        aarch64/include/mach/aarch64/kern_return.h \
        aarch64/include/mach/aarch64/machine_types.defs \
        aarch64/include/mach/aarch64/syscall_sw.h \
+       aarch64/include/mach/aarch64/vm_param.h \
        aarch64/include/mach/aarch64/vm_types.h
 
 endif # HOST_aarch64
diff --git a/aarch64/include/mach/aarch64/vm_param.h 
b/aarch64/include/mach/aarch64/vm_param.h
new file mode 100644
index 00000000..d7b1e281
--- /dev/null
+++ b/aarch64/include/mach/aarch64/vm_param.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2023-2024 Free Software Foundation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef        _MACH_AARCH64_VM_PARAM_H_
+#define _MACH_AARCH64_VM_PARAM_H_
+
+#include <mach/machine/vm_types.h>
+
+#define BYTE_SIZE              8       /* byte size in bits */
+
+/*
+ *     TODO: Exporting VM_MAX_ADDRESS basically locks in
+ *     VM_AARCH64_T0SZ being 48.  Consider dropping it from this
+ *     public header once userland no longer depends on it.
+ */
+#define VM_MIN_ADDRESS         (0ULL)
+#define VM_MAX_ADDRESS         (0x1000000000000ULL)
+
+#endif /* _MACH_AARCH64_VM_PARAM_H_ */
diff --git a/include/mach/vm_param.h b/include/mach/vm_param.h
index 4cbd0eca..8ddb5d99 100644
--- a/include/mach/vm_param.h
+++ b/include/mach/vm_param.h
@@ -59,9 +59,7 @@
  *     PAGE_SIZE and PAGE_MASK should also be variables
  *     so their values don't have to be constantly recomputed.)
  */
-#ifndef PAGE_SHIFT
-#error mach/machine/vm_param.h needs to define PAGE_SHIFT.
-#endif
+#ifdef PAGE_SHIFT
 
 #ifndef PAGE_SIZE
 #define PAGE_SIZE (1 << PAGE_SHIFT)
@@ -99,4 +97,6 @@
 #define        page_aligned(x) ((((vm_offset_t) (x)) & PAGE_MASK) == 0)
 #define        phys_aligned(x) ((((phys_addr_t) (x)) & PAGE_MASK) == 0)
 
+#endif /* PAGE_SHIFT */
+
 #endif /* _MACH_VM_PARAM_H_ */
-- 
2.44.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]