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

[xen master] x86/mkelf32: use xen/macros.h



commit f9af83450e51b37c659322d2297623dcf309b1e7
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Apr 22 09:00:28 2026 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Apr 22 09:00:28 2026 +0200

    x86/mkelf32: use xen/macros.h
    
    Avoid open-coding macros we have readily available. Being able to use MB()
    there might have avoided the flaw corrected by 5416c455f656 ("x86/mkelf32:
    Actually pad load segment to 2 MiB boundary").
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/boot/mkelf32.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 469d1ba0af..ac5695c0e6 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -17,7 +17,9 @@
 #include <unistd.h>
 #include <inttypes.h>
 
+#include "../../../include/xen/const.h"
 #include "../../../include/xen/elfstructs.h"
+#include "../../../include/xen/macros.h"
 
 #define DYNAMICALLY_FILLED   0
 #define RAW_OFFSET         128
@@ -345,7 +347,7 @@ int main(int argc, char **argv)
      * the Xen image using 2M pages.  To avoid running into adjacent non-RAM
      * regions, pad the segment to the next 2M boundary.
      */
-    mem_siz = ((uint32_t)in64_phdr.p_memsz + (1U << 21) - 1) & (-1U << 21);
+    mem_siz = ROUNDUP((uint32_t)in64_phdr.p_memsz, MB(2));
 
     note_sz = note_base = offset = 0;
     if ( num_phdrs > 1 )
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.