Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107935335
D36570.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D36570.diff
View Options
diff --git a/stand/common/metadata.c b/stand/common/metadata.c
--- a/stand/common/metadata.c
+++ b/stand/common/metadata.c
@@ -111,6 +111,7 @@
static int align;
+#define MOD_ALIGN(l) roundup(l, align)
#define COPY32(v, a, c) { \
uint32_t x = (v); \
if (c) \
@@ -123,7 +124,7 @@
COPY32(strlen(s) + 1, a, c) \
if (c) \
archsw.arch_copyin(s, a, strlen(s) + 1);\
- a += roundup(strlen(s) + 1, align); \
+ a += MOD_ALIGN(strlen(s) + 1); \
}
#define MOD_NAME(a, s, c) MOD_STR(MODINFO_NAME, a, s, c)
@@ -135,7 +136,7 @@
COPY32(sizeof(s), a, c); \
if (c) \
archsw.arch_copyin(&s, a, sizeof(s)); \
- a += roundup(sizeof(s), align); \
+ a += MOD_ALIGN(sizeof(s)); \
}
#define MOD_ADDR(a, s, c) MOD_VAR(MODINFO_ADDR, a, s, c)
@@ -146,7 +147,7 @@
COPY32(mm->md_size, a, c); \
if (c) \
archsw.arch_copyin(mm->md_data, a, mm->md_size);\
- a += roundup(mm->md_size, align); \
+ a += MOD_ALIGN(mm->md_size); \
}
#define MOD_END(a, c) { \
diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c
--- a/stand/efi/loader/bootinfo.c
+++ b/stand/efi/loader/bootinfo.c
@@ -180,6 +180,7 @@
* 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) \
@@ -192,7 +193,7 @@
COPY32(strlen(s) + 1, a, c); \
if (c) \
archsw.arch_copyin(s, a, strlen(s) + 1); \
- a += roundup(strlen(s) + 1, sizeof(u_long)); \
+ a += MOD_ALIGN(strlen(s) + 1); \
}
#define MOD_NAME(a, s, c) MOD_STR(MODINFO_NAME, a, s, c)
@@ -204,7 +205,7 @@
COPY32(sizeof(s), a, c); \
if (c) \
archsw.arch_copyin(&s, a, sizeof(s)); \
- a += roundup(sizeof(s), sizeof(u_long)); \
+ a += MOD_ALIGN(sizeof(s)); \
}
#define MOD_ADDR(a, s, c) MOD_VAR(MODINFO_ADDR, a, s, c)
@@ -214,8 +215,8 @@
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 += roundup(mm->md_size, sizeof(u_long)); \
+ archsw.arch_copyin(mm->md_data, a, mm->md_size); \
+ a += MOD_ALIGN(mm->md_size); \
}
#define MOD_END(a, c) { \
diff --git a/stand/i386/libi386/bootinfo32.c b/stand/i386/libi386/bootinfo32.c
--- a/stand/i386/libi386/bootinfo32.c
+++ b/stand/i386/libi386/bootinfo32.c
@@ -59,6 +59,7 @@
* 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) \
@@ -71,7 +72,7 @@
COPY32(strlen(s) + 1, a, c); \
if (c) \
archsw.arch_copyin(s, a, strlen(s) + 1); \
- a += roundup(strlen(s) + 1, sizeof(u_long));\
+ a += MOD_ALIGN(strlen(s) + 1); \
}
#define MOD_NAME(a, s, c) MOD_STR(MODINFO_NAME, a, s, c)
@@ -83,7 +84,7 @@
COPY32(sizeof(s), a, c); \
if (c) \
archsw.arch_copyin(&s, a, sizeof(s)); \
- a += roundup(sizeof(s), sizeof(u_long)); \
+ a += MOD_ALIGN(sizeof(s)); \
}
#define MOD_ADDR(a, s, c) MOD_VAR(MODINFO_ADDR, a, s, c)
@@ -94,7 +95,7 @@
COPY32(mm->md_size, a, c); \
if (c) \
archsw.arch_copyin(mm->md_data, a, mm->md_size); \
- a += roundup(mm->md_size, sizeof(u_long));\
+ a += MOD_ALIGN(mm->md_size); \
}
#define MOD_END(a, c) { \
diff --git a/stand/i386/libi386/bootinfo64.c b/stand/i386/libi386/bootinfo64.c
--- a/stand/i386/libi386/bootinfo64.c
+++ b/stand/i386/libi386/bootinfo64.c
@@ -60,6 +60,7 @@
* MOD_SIZE sizeof(size_t) module size
* MOD_METADATA (variable) type-specific metadata
*/
+#define MOD_ALIGN(l) roundup(l, sizeof(uint64_t))
#define COPY32(v, a, c) { \
uint32_t x = (v); \
if (c) \
@@ -72,7 +73,7 @@
COPY32(strlen(s) + 1, a, c); \
if (c) \
archsw.arch_copyin(s, a, strlen(s) + 1); \
- a += roundup(strlen(s) + 1, sizeof(uint64_t));\
+ a += MOD_ALIGN(strlen(s) + 1); \
}
#define MOD_NAME(a, s, c) MOD_STR(MODINFO_NAME, a, s, c)
@@ -84,7 +85,7 @@
COPY32(sizeof(s), a, c); \
if (c) \
archsw.arch_copyin(&s, a, sizeof(s)); \
- a += roundup(sizeof(s), sizeof(uint64_t)); \
+ a += MOD_ALIGN(sizeof(s)); \
}
#define MOD_ADDR(a, s, c) MOD_VAR(MODINFO_ADDR, a, s, c)
@@ -95,7 +96,7 @@
COPY32(mm->md_size, a, c); \
if (c) \
archsw.arch_copyin(mm->md_data, a, mm->md_size); \
- a += roundup(mm->md_size, sizeof(uint64_t));\
+ a += MOD_ALIGN(mm->md_size); \
}
#define MOD_END(a, c) { \
diff --git a/stand/userboot/userboot/bootinfo32.c b/stand/userboot/userboot/bootinfo32.c
--- a/stand/userboot/userboot/bootinfo32.c
+++ b/stand/userboot/userboot/bootinfo32.c
@@ -58,6 +58,7 @@
* MOD_SIZE sizeof(size_t) module size
* MOD_METADATA (variable) type-specific metadata
*/
+#define MOD_ALIGN(l) roundup(l, sizeof(uint32_t))
#define COPY32(v, a, c) { \
uint32_t x = (v); \
if (c) \
@@ -70,7 +71,7 @@
COPY32(strlen(s) + 1, a, c); \
if (c) \
archsw.arch_copyin(s, a, strlen(s) + 1);\
- a += roundup(strlen(s) + 1, sizeof(uint32_t));\
+ a += MOD_ALIGN(strlen(s) + 1); \
}
#define MOD_NAME(a, s, c) MOD_STR(MODINFO_NAME, a, s, c)
@@ -82,7 +83,7 @@
COPY32(sizeof(s), a, c); \
if (c) \
archsw.arch_copyin(&s, a, sizeof(s)); \
- a += roundup(sizeof(s), sizeof(uint32_t)); \
+ a += MOD_ALIGN(sizeof(s)); \
}
#define MOD_ADDR(a, s, c) MOD_VAR(MODINFO_ADDR, a, s, c)
@@ -93,7 +94,7 @@
COPY32(mm->md_size, a, c); \
if (c) \
archsw.arch_copyin(mm->md_data, a, mm->md_size);\
- a += roundup(mm->md_size, sizeof(uint32_t));\
+ a += MOD_ALIGN(mm->md_size); \
}
#define MOD_END(a, c) { \
diff --git a/stand/userboot/userboot/bootinfo64.c b/stand/userboot/userboot/bootinfo64.c
--- a/stand/userboot/userboot/bootinfo64.c
+++ b/stand/userboot/userboot/bootinfo64.c
@@ -55,6 +55,7 @@
* MOD_SIZE sizeof(size_t) module size
* MOD_METADATA (variable) type-specific metadata
*/
+#define MOD_ALIGN(l) roundup(l, sizeof(uint64_t))
#define COPY32(v, a, c) { \
uint32_t x = (v); \
if (c) \
@@ -67,7 +68,7 @@
COPY32(strlen(s) + 1, a, c); \
if (c) \
archsw.arch_copyin(s, a, strlen(s) + 1);\
- a += roundup(strlen(s) + 1, sizeof(uint64_t));\
+ a += MOD_ALIGN(strlen(s) + 1); \
}
#define MOD_NAME(a, s, c) MOD_STR(MODINFO_NAME, a, s, c)
@@ -79,7 +80,7 @@
COPY32(sizeof(s), a, c); \
if (c) \
archsw.arch_copyin(&s, a, sizeof(s)); \
- a += roundup(sizeof(s), sizeof(uint64_t)); \
+ a += MOD_ALIGN(sizeof(s)); \
}
#define MOD_ADDR(a, s, c) MOD_VAR(MODINFO_ADDR, a, s, c)
@@ -90,7 +91,7 @@
COPY32(mm->md_size, a, c); \
if (c) \
archsw.arch_copyin(mm->md_data, a, mm->md_size);\
- a += roundup(mm->md_size, sizeof(uint64_t));\
+ a += MOD_ALIGN(mm->md_size); \
}
#define MOD_END(a, c) { \
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 20, 4:52 PM (21 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15979882
Default Alt Text
D36570.diff (6 KB)
Attached To
Mode
D36570: stand: Create MOD_ALIGN macro and use it everywhere
Attached
Detach File
Event Timeline
Log In to Comment