Skip to contentSkip to conversation

Consoldidate arch/{i386,x86_64}/boot

RFC Applied Carl-Daniel Hailfinger 2 participants 5 messages May 22, 2006 – May 23, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

there are many differences between the files in arch/{i386,x86_64}/boot, but it seems most (if not all) of them have no effect on the generated code and are purely cosmetical.

I have a patch which increases similarity between these subtrees, while still generating identical code. After that, only very few differences remain in

compressed/misc.c
video.S
tools/build.c

and it should be possible to unify them and kill one copy of each.

Would a series of incremental patches to consolidate these two subtrees get accepted?

Regards,
Carl-Daniel

Signature · 1 line
http://www.hailfinger.org/
#1 lore raw
Quoted 3 lines

Would a series of incremental patches to consolidate these two subtrees get accepted?

Yes.

I have some plans to change the 64bit boot up though - the uncompression should already run as 64bit - but that shouldnt' affect these files.

-Andi

#2 lore raw

PATCH 1/1 Consoldidate arch/{i386,x86_64}/boot/compressed/misc.c

Quoted 9 lines · Andi Kleen
Quoted 3 lines

Would a series of incremental patches to consolidate these two subtrees get accepted?

Yes.

I have some plans to change the 64bit boot up though - the uncompression should already run as 64bit - but that shouldnt' affect these files.

Clean up arch/{i386,x86_64}/boot/compressed/misc.c a bit to reduce their differences. Should have zero effect on code generation.

Regards,
Carl-Daniel

arch/i386/boot/compressed/misc.c renamed from arch/i386/boot/compressed/misc.c.old +12 -20
@@ -24,14 +24,6 @@
 
 #undef memset
 #undef memcpy
-
-/*
- * Why do we do this? Don't ask me..
- *
- * Incomprehensible are the ways of bootloaders.
- */
-static void* memset(void *, int, size_t);
-static void* memcpy(void *, __const void *, size_t);
 #define memzero(s, n)     memset ((s), 0, (n))
 
 typedef unsigned char  uch;
@@ -93,7 +85,7 @@
 #endif
 #define RM_SCREEN_INFO (*(struct screen_info *)(real_mode+0))
 
-extern char input_data[];
+extern unsigned char input_data[];
 extern int input_len;
 
 static long bytes_out = 0;
@@ -103,6 +95,9 @@
 static void *malloc(int size);
 static void free(void *where);
 
+static void *memset(void *s, int c, unsigned n);
+static void *memcpy(void *dest, const void *src, unsigned n);
+
 static void putstr(const char *);
 
 extern int end;
@@ -205,7 +200,7 @@
 	outb_p(0xff & (pos >> 1), vidport+1);
 }
 
-static void* memset(void* s, int c, size_t n)
+static void* memset(void* s, int c, unsigned n)
 {
 	int i;
 	char *ss = (char*)s;
@@ -214,14 +209,13 @@
 	return s;
 }
 
-static void* memcpy(void* __dest, __const void* __src,
-			    size_t __n)
+static void* memcpy(void* dest, const void* src, unsigned n)
 {
 	int i;
-	char *d = (char *)__dest, *s = (char *)__src;
+	char *d = (char *)dest, *s = (char *)src;
 
-	for (i=0;i<__n;i++) d[i] = s[i];
-	return __dest;
+	for (i=0;i<n;i++) d[i] = s[i];
+	return dest;
 }
 
 /* ===========================================================================
@@ -309,7 +303,7 @@
 #else
 	if ((RM_ALT_MEM_K > RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) < 1024) error("Less than 2MB of memory");
 #endif
-	output_data = (char *)__PHYSICAL_START; /* Normally Points to 1M */
+	output_data = (unsigned char *)__PHYSICAL_START; /* Normally Points to 1M */
 	free_mem_end_ptr = (long)real_mode;
 }
 
@@ -324,11 +318,9 @@
 #ifdef STANDARD_MEMORY_BIOS_CALL
 	if (RM_EXT_MEM_K < (3*1024)) error("Less than 4MB of memory");
 #else
-	if ((RM_ALT_MEM_K > RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) <
-			(3*1024))
-		error("Less than 4MB of memory");
+	if ((RM_ALT_MEM_K > RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory");
 #endif	
-	mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START;
+	mv->low_buffer_start = output_data = (unsigned char *)LOW_BUFFER_START;
 	low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX
 	  ? LOW_BUFFER_MAX : (unsigned int)real_mode) & ~0xfff;
 	low_buffer_size = low_buffer_end - LOW_BUFFER_START;
arch/x86_64/boot/compressed/misc.c renamed from arch/x86_64/boot/compressed/misc.c.old +23 -23

123 lines not on this page · raw message

Signature · 1 line
http://www.hailfinger.org/
Applied
#3 lore raw

Re: [PATCH] Consoldidate arch/{i386,x86_64}/boot/compressed/misc.c

Quoted 6 lines · Carl-Daniel Hailfinger
Quoted 4 lines · Andi Kleen
Quoted 3 lines

Would a series of incremental patches to consolidate these two subtrees get accepted?

Quoted 8 lines
Quoted 5 lines

Yes.

I have some plans to change the 64bit boot up though - the uncompression should already run as 64bit - but that shouldnt' affect these files.

Clean up arch/{i386,x86_64}/boot/compressed/misc.c a bit to reduce their differences. Should have zero effect on code generation.

Applied.

-Andi

#4 lore raw

Re: [PATCH] Consoldidate arch/{i386,x86_64}/boot/compressed/misc.c

Quoted 8 lines · Andi Kleen
Quoted 7 lines · Carl-Daniel Hailfinger
Quoted 5 lines · Andi Kleen
Quoted 3 lines

Would a series of incremental patches to consolidate these two subtrees get accepted?

Yes.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I have some plans to change the 64bit boot up though - the uncompression should already run as 64bit - but that shouldnt' affect these files.

Clean up arch/{i386,x86_64}/boot/compressed/misc.c a bit to reduce their differences. Should have zero effect on code generation.

Applied.

Thanks!

Could you have a look at the remaining differences and tell me what else can be nuked?
* For the CONFIG_X86_NUMAQ stuff there were some patches flying around, but it seems they never got applied.
* The hand-coded stack is probably a bootloader thing, but I don't yet understand why it's only in i386.
* The "uncompressing" messages differ. Any reason for that?
* The list of includes differs. Probably related to NUMAQ and stack.
* decompress_kernel is asmlinkage only on i386.

arch/x86_64/boot/compressed/misc.c 2006-05-22 20:56:30.000000000 +0200 renamed from arch/i386/boot/compressed/misc.c 2006-05-22 20:56:09.000000000 +0200 +3 -18
@@ -9,8 +9,6 @@
  * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
  */
 
-#include <linux/linkage.h>
-#include <linux/vmalloc.h>
 #include <linux/screen_info.h>
 #include <asm/io.h>
 #include <asm/page.h>
@@ -116,10 +114,6 @@
 static int vidport;
 static int lines, cols;
 
-#ifdef CONFIG_X86_NUMAQ
-static void * xquad_portio = NULL;
-#endif
-
 #include "../../../../lib/inflate.c"
 
 static void *malloc(int size)
@@ -287,15 +281,6 @@
        while(1);       /* Halt */
 }
 
-#define STACK_SIZE (4096)
-
-long user_stack [STACK_SIZE];
-
-struct {
-       long * a;
-       short b;
-       } stack_start = { & user_stack [STACK_SIZE] , __BOOT_DS };
-
 static void setup_normal_output_buffer(void)
 {
 #ifdef STANDARD_MEMORY_BIOS_CALL
@@ -346,7 +331,7 @@
        }
 }
 
-asmlinkage int decompress_kernel(struct moveparams *mv, void *rmode)
+int decompress_kernel(struct moveparams *mv, void *rmode)
 {
        real_mode = rmode;
 
@@ -365,9 +350,9 @@
        else setup_output_buffer_if_we_run_high(mv);
 
        makecrc();
-       putstr("Uncompressing Linux... ");
+       putstr(".\nDecompressing Linux...");
        gunzip();
-       putstr("Ok, booting the kernel.\n");
+       putstr("done.\nBooting the kernel.\n");
        if (high_loaded) close_output_buffer_if_we_run_high(mv);
        return high_loaded;
 }

Regards,
Carl-Daniel

Signature · 1 line
http://www.hailfinger.org/