git: bca9c87b6104 - main - stand: Create common/modinfo.h

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 16 Sep 2022 15:53:55 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=bca9c87b6104219af35ae5ea4a6af098a1631bca

commit bca9c87b6104219af35ae5ea4a6af098a1631bca
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-09-16 15:08:42 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-09-16 15:18:56 +0000

    stand: Create common/modinfo.h
    
    Move all the MOD_xxx macros to this header. Each user of this interface
    is currently required to define MOD_ALIGNMENT(l). modinfo was selected
    because it sits inbetween modules and metadata and will make it easier
    to migrate to new, shared intefaces.
    
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D36571
---
 stand/common/metadata.c              | 61 +-----------------------------
 stand/common/modinfo.h               | 72 ++++++++++++++++++++++++++++++++++++
 stand/efi/loader/bootinfo.c          | 66 +++------------------------------
 stand/i386/libi386/bootinfo32.c      | 59 ++---------------------------
 stand/i386/libi386/bootinfo64.c      | 59 ++---------------------------
 stand/userboot/userboot/bootinfo32.c | 58 +----------------------------
 stand/userboot/userboot/bootinfo64.c | 59 ++---------------------------
 7 files changed, 90 insertions(+), 344 deletions(-)

diff --git a/stand/common/metadata.c b/stand/common/metadata.c
index cb92537d1ce2..99b67cfd1060 100644
--- a/stand/common/metadata.c
+++ b/stand/common/metadata.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/metadata.h>
 
 #include "bootstrap.h"
+#include "modinfo.h"
 
 #ifdef LOADER_GELI_SUPPORT
 #include "geliboot.h"
@@ -92,68 +93,8 @@ md_copyenv(vm_offset_t addr)
     return(addr);
 }
 
-/*
- * Copy module-related data into the load area, where it can be
- * used as a directory for loaded modules.
- *
- * Module data is presented in a self-describing format.  Each datum
- * is preceded by a 32-bit identifier and a 32-bit size field.
- *
- * Currently, the following data are saved:
- *
- * MOD_NAME	(variable)		module name (string)
- * MOD_TYPE	(variable)		module type (string)
- * MOD_ARGS	(variable)		module parameters (string)
- * MOD_ADDR	sizeof(vm_offset_t)	module load address
- * MOD_SIZE	sizeof(size_t)		module size
- * MOD_METADATA	(variable)		type-specific metadata
- */
-
 static int align;
-
 #define MOD_ALIGN(l)	roundup(l, align)
-#define COPY32(v, a, c) {			\
-    uint32_t	x = (v);			\
-    if (c)					\
-        archsw.arch_copyin(&x, a, sizeof(x));	\
-    a += sizeof(x);				\
-}
-
-#define MOD_STR(t, a, s, c) {			\
-    COPY32(t, a, c);				\
-    COPY32(strlen(s) + 1, a, c)			\
-    if (c)					\
-        archsw.arch_copyin(s, a, strlen(s) + 1);\
-    a += MOD_ALIGN(strlen(s) + 1);		\
-}
-
-#define MOD_NAME(a, s, c)	MOD_STR(MODINFO_NAME, a, s, c)
-#define MOD_TYPE(a, s, c)	MOD_STR(MODINFO_TYPE, a, s, c)
-#define MOD_ARGS(a, s, c)	MOD_STR(MODINFO_ARGS, a, s, c)
-
-#define MOD_VAR(t, a, s, c) {			\
-    COPY32(t, a, c);				\
-    COPY32(sizeof(s), a, c);			\
-    if (c)					\
-        archsw.arch_copyin(&s, a, sizeof(s));	\
-    a += MOD_ALIGN(sizeof(s));			\
-}
-
-#define MOD_ADDR(a, s, c)	MOD_VAR(MODINFO_ADDR, a, s, c)
-#define MOD_SIZE(a, s, c)	MOD_VAR(MODINFO_SIZE, a, s, c)
-
-#define MOD_METADATA(a, mm, c) {		\
-    COPY32(MODINFO_METADATA | mm->md_type, a, c);\
-    COPY32(mm->md_size, a, c);			\
-    if (c)					\
-        archsw.arch_copyin(mm->md_data, a, mm->md_size);\
-    a += MOD_ALIGN(mm->md_size);		\
-}
-
-#define MOD_END(a, c) {				\
-    COPY32(MODINFO_END, a, c);			\
-    COPY32(0, a, c);				\
-}
 
 static vm_offset_t
 md_copymodules(vm_offset_t addr, int kern64)
diff --git a/stand/common/modinfo.h b/stand/common/modinfo.h
new file mode 100644
index 000000000000..245784ccb2ed
--- /dev/null
+++ b/stand/common/modinfo.h
@@ -0,0 +1,72 @@
+/*-
+ * Copyright (c) 2022, Netflix, Inc.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+#ifndef COMMON_MODINFO_H
+#define COMMON_MODINFO_H
+
+/*
+ * Copy module-related data into the load area, where it can be
+ * used as a directory for loaded modules.
+ *
+ * Module data is presented in a self-describing format.  Each datum
+ * is preceded by a 32-bit identifier and a 32-bit size field.
+ *
+ * Currently, the following data are saved:
+ *
+ * MOD_NAME	(variable)		module name (string)
+ * MOD_TYPE	(variable)		module type (string)
+ * MOD_ARGS	(variable)		module parameters (string)
+ * MOD_ADDR	sizeof(vm_offset_t)	module load address
+ * MOD_SIZE	sizeof(size_t)		module size
+ * MOD_METADATA	(variable)		type-specific metadata
+ *
+ * Clients are required to define a MOD_ALIGN(l) macro which rounds the passed
+ * in length to the required alignment for the kernel being booted.
+ */
+
+#define COPY32(v, a, c) {			\
+    uint32_t	x = (v);			\
+    if (c)					\
+        archsw.arch_copyin(&x, a, sizeof(x));	\
+    a += sizeof(x);				\
+}
+
+#define MOD_STR(t, a, s, c) {			\
+    COPY32(t, a, c);				\
+    COPY32(strlen(s) + 1, a, c)			\
+    if (c)					\
+        archsw.arch_copyin(s, a, strlen(s) + 1);\
+    a += MOD_ALIGN(strlen(s) + 1);		\
+}
+
+#define MOD_NAME(a, s, c)	MOD_STR(MODINFO_NAME, a, s, c)
+#define MOD_TYPE(a, s, c)	MOD_STR(MODINFO_TYPE, a, s, c)
+#define MOD_ARGS(a, s, c)	MOD_STR(MODINFO_ARGS, a, s, c)
+
+#define MOD_VAR(t, a, s, c) {			\
+    COPY32(t, a, c);				\
+    COPY32(sizeof(s), a, c);			\
+    if (c)					\
+        archsw.arch_copyin(&s, a, sizeof(s));	\
+    a += MOD_ALIGN(sizeof(s));			\
+}
+
+#define MOD_ADDR(a, s, c)	MOD_VAR(MODINFO_ADDR, a, s, c)
+#define MOD_SIZE(a, s, c)	MOD_VAR(MODINFO_SIZE, a, s, c)
+
+#define MOD_METADATA(a, mm, c) {		\
+    COPY32(MODINFO_METADATA | mm->md_type, a, c);\
+    COPY32(mm->md_size, a, c);			\
+    if (c)					\
+        archsw.arch_copyin(mm->md_data, a, mm->md_size);\
+    a += MOD_ALIGN(mm->md_size);		\
+}
+
+#define MOD_END(a, c) {				\
+    COPY32(MODINFO_END, a, c);			\
+    COPY32(0, a, c);				\
+}
+
+#endif /* COMMON_MODINFO_H */
diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c
index c3184a1e84d5..08ed518d9cff 100644
--- a/stand/efi/loader/bootinfo.c
+++ b/stand/efi/loader/bootinfo.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include <efilib.h>
 
 #include "bootstrap.h"
+#include "modinfo.h"
 #include "loader_efi.h"
 
 #if defined(__amd64__)
@@ -60,6 +61,11 @@ __FBSDID("$FreeBSD$");
 #include "geliboot.h"
 #endif
 
+/*
+ * Align to a pointer / long
+ */
+#define MOD_ALIGN(l)	roundup(l, sizeof(u_long))
+
 int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,
     bool exit_bs);
 
@@ -164,66 +170,6 @@ bi_copyenv(vm_offset_t start)
 	return(last);
 }
 
-/*
- * Copy module-related data into the load area, where it can be
- * used as a directory for loaded modules.
- *
- * Module data is presented in a self-describing format.  Each datum
- * is preceded by a 32-bit identifier and a 32-bit size field.
- *
- * Currently, the following data are saved:
- *
- * MOD_NAME	(variable)		module name (string)
- * MOD_TYPE	(variable)		module type (string)
- * MOD_ARGS	(variable)		module parameters (string)
- * MOD_ADDR	sizeof(vm_offset_t)	module load address
- * MOD_SIZE	sizeof(size_t)		module size
- * MOD_METADATA	(variable)		type-specific metadata
- */
-#define MOD_ALIGN(l)	roundup(l, sizeof(u_long))
-#define	COPY32(v, a, c) {					\
-	uint32_t x = (v);					\
-	if (c)							\
-		archsw.arch_copyin(&x, a, sizeof(x));		\
-	a += sizeof(x);						\
-}
-
-#define	MOD_STR(t, a, s, c) {					\
-	COPY32(t, a, c);					\
-	COPY32(strlen(s) + 1, a, c);				\
-	if (c)							\
-		archsw.arch_copyin(s, a, strlen(s) + 1);	\
-	a += MOD_ALIGN(strlen(s) + 1);				\
-}
-
-#define	MOD_NAME(a, s, c)	MOD_STR(MODINFO_NAME, a, s, c)
-#define	MOD_TYPE(a, s, c)	MOD_STR(MODINFO_TYPE, a, s, c)
-#define	MOD_ARGS(a, s, c)	MOD_STR(MODINFO_ARGS, a, s, c)
-
-#define	MOD_VAR(t, a, s, c) {					\
-	COPY32(t, a, c);					\
-	COPY32(sizeof(s), a, c);				\
-	if (c)							\
-		archsw.arch_copyin(&s, a, sizeof(s));		\
-	a += MOD_ALIGN(sizeof(s));				\
-}
-
-#define	MOD_ADDR(a, s, c)	MOD_VAR(MODINFO_ADDR, a, s, c)
-#define	MOD_SIZE(a, s, c)	MOD_VAR(MODINFO_SIZE, a, s, c)
-
-#define	MOD_METADATA(a, mm, c) {				\
-	COPY32(MODINFO_METADATA | mm->md_type, a, c);		\
-	COPY32(mm->md_size, a, c);				\
-	if (c)							\
-		archsw.arch_copyin(mm->md_data, a, mm->md_size); \
-	a += MOD_ALIGN(mm->md_size);				\
-}
-
-#define	MOD_END(a, c) {						\
-	COPY32(MODINFO_END, a, c);				\
-	COPY32(0, a, c);					\
-}
-
 static vm_offset_t
 bi_copymodules(vm_offset_t addr)
 {
diff --git a/stand/i386/libi386/bootinfo32.c b/stand/i386/libi386/bootinfo32.c
index 207fe9a3fde8..f00c692a3993 100644
--- a/stand/i386/libi386/bootinfo32.c
+++ b/stand/i386/libi386/bootinfo32.c
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/bootinfo.h>
 #include <machine/metadata.h>
 #include "bootstrap.h"
+#include "modinfo.h"
 #include "libi386.h"
 #include "btxv86.h"
 
@@ -44,64 +45,10 @@ __FBSDID("$FreeBSD$");
 static struct bootinfo  bi;
 
 /*
- * Copy module-related data into the load area, where it can be
- * used as a directory for loaded modules.
- *
- * Module data is presented in a self-describing format.  Each datum
- * is preceded by a 32-bit identifier and a 32-bit size field.
- *
- * Currently, the following data are saved:
- *
- * MOD_NAME	(variable)		module name (string)
- * MOD_TYPE	(variable)		module type (string)
- * MOD_ARGS	(variable)		module parameters (string)
- * MOD_ADDR	sizeof(vm_offset_t)	module load address
- * MOD_SIZE	sizeof(size_t)		module size
- * MOD_METADATA	(variable)		type-specific metadata
+ * We have 4 byte alignment for 32-bit targets. This code is compiled as 32-bit
+ * code...
  */
 #define MOD_ALIGN(l) roundup(l, sizeof(u_long))
-#define COPY32(v, a, c) {			\
-    uint32_t	x = (v);			\
-    if (c)					\
-	archsw.arch_copyin(&x, a, sizeof(x));	\
-    a += sizeof(x);				\
-}
-
-#define MOD_STR(t, a, s, c) {			\
-    COPY32(t, a, c);				\
-    COPY32(strlen(s) + 1, a, c);		\
-    if (c)					\
-	archsw.arch_copyin(s, a, strlen(s) + 1); \
-    a += MOD_ALIGN(strlen(s) + 1);		\
-}
-
-#define MOD_NAME(a, s, c)	MOD_STR(MODINFO_NAME, a, s, c)
-#define MOD_TYPE(a, s, c)	MOD_STR(MODINFO_TYPE, a, s, c)
-#define MOD_ARGS(a, s, c)	MOD_STR(MODINFO_ARGS, a, s, c)
-
-#define MOD_VAR(t, a, s, c) {			\
-    COPY32(t, a, c);				\
-    COPY32(sizeof(s), a, c);			\
-    if (c)					\
-	archsw.arch_copyin(&s, a, sizeof(s));	\
-    a += MOD_ALIGN(sizeof(s));			\
-}
-
-#define MOD_ADDR(a, s, c)	MOD_VAR(MODINFO_ADDR, a, s, c)
-#define MOD_SIZE(a, s, c)	MOD_VAR(MODINFO_SIZE, a, s, c)
-
-#define MOD_METADATA(a, mm, c) {		\
-    COPY32(MODINFO_METADATA | mm->md_type, a, c); \
-    COPY32(mm->md_size, a, c);			\
-    if (c)					\
-	archsw.arch_copyin(mm->md_data, a, mm->md_size); \
-    a += MOD_ALIGN(mm->md_size);		\
-}
-
-#define MOD_END(a, c) {				\
-    COPY32(MODINFO_END, a, c);			\
-    COPY32(0, a, c);				\
-}
 
 static vm_offset_t
 bi_copymodules32(vm_offset_t addr)
diff --git a/stand/i386/libi386/bootinfo64.c b/stand/i386/libi386/bootinfo64.c
index e088c27347be..18ed4af3e27f 100644
--- a/stand/i386/libi386/bootinfo64.c
+++ b/stand/i386/libi386/bootinfo64.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/psl.h>
 #include <machine/specialreg.h>
 #include "bootstrap.h"
+#include "modinfo.h"
 #include "libi386.h"
 #include "btxv86.h"
 
@@ -45,64 +46,10 @@ __FBSDID("$FreeBSD$");
 #endif
 
 /*
- * Copy module-related data into the load area, where it can be
- * used as a directory for loaded modules.
- *
- * Module data is presented in a self-describing format.  Each datum
- * is preceded by a 32-bit identifier and a 32-bit size field.
- *
- * Currently, the following data are saved:
- *
- * MOD_NAME	(variable)		module name (string)
- * MOD_TYPE	(variable)		module type (string)
- * MOD_ARGS	(variable)		module parameters (string)
- * MOD_ADDR	sizeof(vm_offset_t)	module load address
- * MOD_SIZE	sizeof(size_t)		module size
- * MOD_METADATA	(variable)		type-specific metadata
+ * We have 8 byte alignment for 64-bit targets. This code is compiled as 64-bit
+ * code...
  */
 #define MOD_ALIGN(l)	roundup(l, sizeof(uint64_t))
-#define COPY32(v, a, c) {			\
-    uint32_t	x = (v);			\
-    if (c)					\
-	archsw.arch_copyin(&x, a, sizeof(x));	\
-    a += sizeof(x);				\
-}
-
-#define MOD_STR(t, a, s, c) {			\
-    COPY32(t, a, c);				\
-    COPY32(strlen(s) + 1, a, c);		\
-    if (c)					\
-	archsw.arch_copyin(s, a, strlen(s) + 1); \
-    a += MOD_ALIGN(strlen(s) + 1);		\
-}
-
-#define MOD_NAME(a, s, c)	MOD_STR(MODINFO_NAME, a, s, c)
-#define MOD_TYPE(a, s, c)	MOD_STR(MODINFO_TYPE, a, s, c)
-#define MOD_ARGS(a, s, c)	MOD_STR(MODINFO_ARGS, a, s, c)
-
-#define MOD_VAR(t, a, s, c) {			\
-    COPY32(t, a, c);				\
-    COPY32(sizeof(s), a, c);			\
-    if (c)					\
-	archsw.arch_copyin(&s, a, sizeof(s));	\
-    a += MOD_ALIGN(sizeof(s));			\
-}
-
-#define MOD_ADDR(a, s, c)	MOD_VAR(MODINFO_ADDR, a, s, c)
-#define MOD_SIZE(a, s, c)	MOD_VAR(MODINFO_SIZE, a, s, c)
-
-#define MOD_METADATA(a, mm, c) {		\
-    COPY32(MODINFO_METADATA | mm->md_type, a, c); \
-    COPY32(mm->md_size, a, c);			\
-    if (c)					\
-	archsw.arch_copyin(mm->md_data, a, mm->md_size); \
-    a += MOD_ALIGN(mm->md_size);		\
-}
-
-#define MOD_END(a, c) {				\
-    COPY32(MODINFO_END, a, c);			\
-    COPY32(0, a, c);				\
-}
 
 static vm_offset_t
 bi_copymodules64(vm_offset_t addr)
diff --git a/stand/userboot/userboot/bootinfo32.c b/stand/userboot/userboot/bootinfo32.c
index bd2729927349..a717f4ad1f5a 100644
--- a/stand/userboot/userboot/bootinfo32.c
+++ b/stand/userboot/userboot/bootinfo32.c
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include <i386/include/bootinfo.h>
 
 #include "bootstrap.h"
+#include "modinfo.h"
 #include "libuserboot.h"
 
 #ifdef LOADER_GELI_SUPPORT
@@ -43,64 +44,9 @@ __FBSDID("$FreeBSD$");
 static struct bootinfo  bi;
 
 /*
- * Copy module-related data into the load area, where it can be
- * used as a directory for loaded modules.
- *
- * Module data is presented in a self-describing format.  Each datum
- * is preceded by a 32-bit identifier and a 32-bit size field.
- *
- * Currently, the following data are saved:
- *
- * MOD_NAME	(variable)		module name (string)
- * MOD_TYPE	(variable)		module type (string)
- * MOD_ARGS	(variable)		module parameters (string)
- * MOD_ADDR	sizeof(vm_offset_t)	module load address
- * MOD_SIZE	sizeof(size_t)		module size
- * MOD_METADATA	(variable)		type-specific metadata
+ * We have 4 byte alignment for 32-bit targets.
  */
 #define MOD_ALIGN(l)	roundup(l, sizeof(uint32_t))
-#define COPY32(v, a, c) {			\
-    uint32_t	x = (v);			\
-    if (c)					\
-        archsw.arch_copyin(&x, a, sizeof(x));	\
-    a += sizeof(x);				\
-}
-
-#define MOD_STR(t, a, s, c) {			\
-    COPY32(t, a, c);				\
-    COPY32(strlen(s) + 1, a, c);		\
-    if (c)					\
-        archsw.arch_copyin(s, a, strlen(s) + 1);\
-    a += MOD_ALIGN(strlen(s) + 1);		\
-}
-
-#define MOD_NAME(a, s, c)	MOD_STR(MODINFO_NAME, a, s, c)
-#define MOD_TYPE(a, s, c)	MOD_STR(MODINFO_TYPE, a, s, c)
-#define MOD_ARGS(a, s, c)	MOD_STR(MODINFO_ARGS, a, s, c)
-
-#define MOD_VAR(t, a, s, c) {			\
-    COPY32(t, a, c);				\
-    COPY32(sizeof(s), a, c);			\
-    if (c)					\
-        archsw.arch_copyin(&s, a, sizeof(s));	\
-    a += MOD_ALIGN(sizeof(s));			\
-}
-
-#define MOD_ADDR(a, s, c)	MOD_VAR(MODINFO_ADDR, a, s, c)
-#define MOD_SIZE(a, s, c)	MOD_VAR(MODINFO_SIZE, a, s, c)
-
-#define MOD_METADATA(a, mm, c) {		\
-    COPY32(MODINFO_METADATA | mm->md_type, a, c); \
-    COPY32(mm->md_size, a, c);			\
-    if (c)					\
-        archsw.arch_copyin(mm->md_data, a, mm->md_size);\
-    a += MOD_ALIGN(mm->md_size);		\
-}
-
-#define MOD_END(a, c) {				\
-    COPY32(MODINFO_END, a, c);			\
-    COPY32(0, a, c);				\
-}
 
 static vm_offset_t
 bi_copymodules32(vm_offset_t addr)
diff --git a/stand/userboot/userboot/bootinfo64.c b/stand/userboot/userboot/bootinfo64.c
index 5fffb04d8d75..773f59474bf4 100644
--- a/stand/userboot/userboot/bootinfo64.c
+++ b/stand/userboot/userboot/bootinfo64.c
@@ -37,67 +37,14 @@ __FBSDID("$FreeBSD$");
 #include <machine/specialreg.h>
 
 #include "bootstrap.h"
+#include "modinfo.h"
 #include "libuserboot.h"
 
 /*
- * Copy module-related data into the load area, where it can be
- * used as a directory for loaded modules.
- *
- * Module data is presented in a self-describing format.  Each datum
- * is preceded by a 32-bit identifier and a 32-bit size field.
- *
- * Currently, the following data are saved:
- *
- * MOD_NAME	(variable)		module name (string)
- * MOD_TYPE	(variable)		module type (string)
- * MOD_ARGS	(variable)		module parameters (string)
- * MOD_ADDR	sizeof(vm_offset_t)	module load address
- * MOD_SIZE	sizeof(size_t)		module size
- * MOD_METADATA	(variable)		type-specific metadata
+ * We have 8 byte alignment for 64-bit targets. This code is compiled as 32-bit
+ * code...
  */
 #define MOD_ALIGN(l)	roundup(l, sizeof(uint64_t))
-#define COPY32(v, a, c) {			\
-    uint32_t	x = (v);			\
-    if (c)					\
-        archsw.arch_copyin(&x, a, sizeof(x));	\
-    a += sizeof(x);				\
-}
-
-#define MOD_STR(t, a, s, c) {			\
-    COPY32(t, a, c);				\
-    COPY32(strlen(s) + 1, a, c);		\
-    if (c)					\
-        archsw.arch_copyin(s, a, strlen(s) + 1);\
-    a += MOD_ALIGN(strlen(s) + 1);		\
-}
-
-#define MOD_NAME(a, s, c)	MOD_STR(MODINFO_NAME, a, s, c)
-#define MOD_TYPE(a, s, c)	MOD_STR(MODINFO_TYPE, a, s, c)
-#define MOD_ARGS(a, s, c)	MOD_STR(MODINFO_ARGS, a, s, c)
-
-#define MOD_VAR(t, a, s, c) {			\
-    COPY32(t, a, c);				\
-    COPY32(sizeof(s), a, c);			\
-    if (c)					\
-        archsw.arch_copyin(&s, a, sizeof(s));	\
-    a += MOD_ALIGN(sizeof(s));			\
-}
-
-#define MOD_ADDR(a, s, c)	MOD_VAR(MODINFO_ADDR, a, s, c)
-#define MOD_SIZE(a, s, c)	MOD_VAR(MODINFO_SIZE, a, s, c)
-
-#define MOD_METADATA(a, mm, c) {		\
-    COPY32(MODINFO_METADATA | mm->md_type, a, c); \
-    COPY32(mm->md_size, a, c);			\
-    if (c)					\
-        archsw.arch_copyin(mm->md_data, a, mm->md_size);\
-    a += MOD_ALIGN(mm->md_size);		\
-}
-
-#define MOD_END(a, c) {				\
-    COPY32(MODINFO_END, a, c);			\
-    COPY32(0, a, c);				\
-}
 
 static vm_offset_t
 bi_copymodules64(vm_offset_t addr)