Skip to contentSkip to conversation

x86: loadflags cleanups

PATCH In review Alexander Kuleshov 2 participants 4 messages Jan 31, 2015 – Feb 18, 2015 x86

lore
Share & tools
lore
#0 lore raw

v2 cover x86: loadflags cleanups

There are a couple macros in the arch/x86/include/uapi/asm/bootparam.h for checking loadflags bits. Let's use it instead of shifting bits

Alexander Kuleshov (2):
x86: use already defined KEEP_SEGMENTS macro from bootparam.h x86/boot: use already defined KEEP_SEGMENTS macro in head_{32,64}.S

 arch/x86/boot/compressed/head_32.S | 5 +++--
 arch/x86/boot/compressed/head_64.S | 3 ++-
 arch/x86/kernel/head_32.S          | 7 ++++---
 3 files changed, 9 insertions(+), 6 deletions(-)
Signature · 1 line
2.3.0-rc1
#1 lore raw

PATCH v2 1/2 x86: use already defined KEEP_SEGMENTS macro from bootparam.h

There is already defined macro KEEP_SEGMENTS in the bootparam.h, let's use it instead of shifting bits

---
 arch/x86/kernel/head_32.S | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/kernel/head_32.S +4 -3
index f36bd42..fba3990 100644
@@ -22,7 +22,8 @@
 #include <asm/cpufeature.h>
 #include <asm/percpu.h>
 #include <asm/nops.h>
-
+#include <asm/bootmparam.h>
+	
 /* Physical address */
 #define pa(X) ((X) - __PAGE_OFFSET)
 
@@ -89,8 +90,8 @@ ENTRY(startup_32)
 	movl pa(stack_start),%ecx
 	
 	/* test KEEP_SEGMENTS flag to see if the bootloader is asking
-		us to not reload segments */
-	testb $(1<<6), BP_loadflags(%esi)
+	   us to not reload segments */
+	testb $KEEP_SEGMENTS, BP_loadflags(%esi)
 	jnz 2f
 
 /*
Signature · 1 line
2.3.0-rc1
#2 lore raw

PATCH v2 2/2 x86/boot: use already defined KEEP_SEGMENTS macro in head_{32,64}.S

In reply to Alexander Kuleshov

There is already defined macro KEEP_SEGMENTS in the bootparam.h, let's use it instead of shifting bits

---
 arch/x86/boot/compressed/head_32.S | 5 +++--
 arch/x86/boot/compressed/head_64.S | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)
arch/x86/boot/compressed/head_32.S +3 -2
index 1d7fbbc..11e549d 100644
@@ -29,7 +29,8 @@
 #include <asm/page_types.h>
 #include <asm/boot.h>
 #include <asm/asm-offsets.h>
-
+#include <asm/bootparam.h>
+	
 	__HEAD
 ENTRY(startup_32)
 #ifdef CONFIG_EFI_STUB
@@ -102,7 +103,7 @@ preferred_addr:
 	 * Test KEEP_SEGMENTS flag to see if the bootloader is asking
 	 * us to not reload segments
 	 */
-	testb	$(1<<6), BP_loadflags(%esi)
+	testb	$KEEP_SEGMENTS, BP_loadflags(%esi)
 	jnz	1f
 
 	cli
arch/x86/boot/compressed/head_64.S +2 -1
index 6b1766c..90c1521 100644
@@ -31,6 +31,7 @@
 #include <asm/msr.h>
 #include <asm/processor-flags.h>
 #include <asm/asm-offsets.h>
+#include <asm/bootparam.h>
 
 	__HEAD
 	.code32
@@ -46,7 +47,7 @@ ENTRY(startup_32)
 	 * Test KEEP_SEGMENTS flag to see if the bootloader is asking
 	 * us to not reload segments
 	 */
-	testb $(1<<6), BP_loadflags(%esi)
+	testb $KEEP_SEGMENTS, BP_loadflags(%esi)
 	jnz 1f
 
 	cli
Signature · 1 line
2.3.0-rc1
#3 lore raw
In reply to Alexander Kuleshov
Quoted 11 lines · Alexander Kuleshov

There are a couple macros in the arch/x86/include/uapi/asm/bootparam.h for checking loadflags bits. Let's use it instead of shifting bits

Alexander Kuleshov (2):
x86: use already defined KEEP_SEGMENTS macro from bootparam.h x86/boot: use already defined KEEP_SEGMENTS macro in head_{32,64}.S

 arch/x86/boot/compressed/head_32.S | 5 +++--
 arch/x86/boot/compressed/head_64.S | 3 ++-
 arch/x86/kernel/head_32.S          | 7 ++++---
 3 files changed, 9 insertions(+), 6 deletions(-)

I think a single patch would be perfectly fine for a cleanup that does the same thing in three files.

Thanks,

Ingo