Skip to contentSkip to conversation

: for better readability in clearing BSS

PATCH In review Denis Cheng 2 participants 3 messages Aug 25, 2007 – Aug 26, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : for better readability in clearing BSS

there are three different linker scripts with different usages,

	arch/i386/boot/setup.ld
	arch/i386/boot/compressed/vmlinux.lds
	arch/i386/kernel/vmlinux.lds

accompanlying with three different sections of clearing BSS,

	arch/i386/boot/header.S
	arch/i386/boot/compressed/head.S
	arch/i386/kernel/head.S

but their label names in .bss section are different, when reading these files, they are apt to confuse,

this patch kept them in the same style of clearing.

---
 arch/i386/boot/compressed/head.S |    2 +-
 arch/i386/boot/header.S          |    2 +-
 arch/i386/boot/setup.ld          |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
arch/i386/boot/compressed/head.S +1 -1
index f35ea22..e499db0 100644
@@ -113,7 +113,7 @@ relocated:
  * Clear BSS
  */
 	xorl %eax,%eax
-	leal _edata(%ebx),%edi
+	leal _bss(%ebx),%edi
 	leal _end(%ebx), %ecx
 	subl %edi,%ecx
 	cld
arch/i386/boot/header.S +1 -1
index 7f4a2c5..cd074c1 100644
@@ -254,7 +254,7 @@ setup2:
 
 # Zero the bss
 	movw	$__bss_start, %di
-	movw	$_end+3, %cx
+	movw	$__bss_end, %cx
 	xorl	%eax, %eax
 	subw	%di, %cx
 	shrw	$2, %cx
arch/i386/boot/setup.ld +2 -2
index df9234b..f9d6897 100644
@@ -36,15 +36,15 @@ SECTIONS
 		LONG(0x5a5aaa55)
 	}
 
-
 	. = ALIGN(16);
 	.bss		:
 	{
 		__bss_start = .;
 		*(.bss)
+		. = ALIGN(16);
 		__bss_end = .;
 	}
-	. = ALIGN(16);
+
 	_end = .;
 
 	/DISCARD/ : { *(.note*) }
Signature · 1 line
1.5.3.rc4
#1 lore raw
Quoted 6 lines · Denis Cheng

but their label names in .bss section are different, when reading these files, they are apt to confuse,

this patch kept them in the same style of clearing.

Bullsh*t.

arch/i386/boot/compressed/head.S relocated: · line 119

Quoted 13 lines
arch/i386/boot/compressed/head.S +1 -1
index f35ea22..e499db0 100644
@@ -113,7 +113,7 @@ relocated:
  * Clear BSS
  */
 	xorl %eax,%eax
-	leal _edata(%ebx),%edi
+	leal _bss(%ebx),%edi
 	leal _end(%ebx), %ecx
 	subl %edi,%ecx
 	cld

Here you change _edata.._end into _bss.._end.

arch/i386/boot/header.S setup2: · line 260

Quoted 13 lines
arch/i386/boot/header.S +1 -1
index 7f4a2c5..cd074c1 100644
@@ -254,7 +254,7 @@ setup2:
 
 # Zero the bss
 	movw	$__bss_start, %di
-	movw	$_end+3, %cx
+	movw	$__bss_end, %cx
 	xorl	%eax, %eax
 	subw	%di, %cx
 	shrw	$2, %cx

Here you change __bss_start..to __bss_end, and have to change the linker script for it not to break.

There is no consistency improvement, and as such, it's just churn.

-hpa

#2 lore raw
In reply to Denis Cheng
Quoted 6 lines · Denis Cheng

but their label names in .bss section are different, when reading these files, they are apt to confuse,

this patch kept them in the same style of clearing.

Bullsh*t.

arch/i386/boot/compressed/head.S relocated: · line 119

Quoted 13 lines
arch/i386/boot/compressed/head.S +1 -1
index f35ea22..e499db0 100644
@@ -113,7 +113,7 @@ relocated:
  * Clear BSS
  */
 	xorl %eax,%eax
-	leal _edata(%ebx),%edi
+	leal _bss(%ebx),%edi
 	leal _end(%ebx), %ecx
 	subl %edi,%ecx
 	cld

Here you change _edata.._end into _bss.._end.

arch/i386/boot/header.S setup2: · line 260

Quoted 13 lines
arch/i386/boot/header.S +1 -1
index 7f4a2c5..cd074c1 100644
@@ -254,7 +254,7 @@ setup2:
 
 # Zero the bss
 	movw	$__bss_start, %di
-	movw	$_end+3, %cx
+	movw	$__bss_end, %cx
 	xorl	%eax, %eax
 	subw	%di, %cx
 	shrw	$2, %cx

Here you change __bss_start.._end to __bss_start..__bss_end, and have to change the linker script for it not to break.

There is no consistency improvement, and as such, it's just churn.

-hpa