diff options
author | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2006-06-26 07:57:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 13:48:18 -0400 |
commit | b79c4df714ff190f7149d3d5a86278bdc25a90ec (patch) | |
tree | e7fae9732a1d36a6e8399cdbe528e7fb1834f043 /arch/i386 | |
parent | 83f4fcce7fdd213bd570b899862c3838871f8cf7 (diff) |
[PATCH] i386/x86-64: Consolidate arch/{i386,x86_64}/boot/compressed/misc.c
Clean up arch/{i386,x86_64}/boot/compressed/misc.c a bit to reduce their
differences. Should have zero effect on code generation.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/boot/compressed/misc.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/arch/i386/boot/compressed/misc.c b/arch/i386/boot/compressed/misc.c index f19f3a7492a5..b2ccd543410d 100644 --- a/arch/i386/boot/compressed/misc.c +++ b/arch/i386/boot/compressed/misc.c | |||
@@ -24,14 +24,6 @@ | |||
24 | 24 | ||
25 | #undef memset | 25 | #undef memset |
26 | #undef memcpy | 26 | #undef memcpy |
27 | |||
28 | /* | ||
29 | * Why do we do this? Don't ask me.. | ||
30 | * | ||
31 | * Incomprehensible are the ways of bootloaders. | ||
32 | */ | ||
33 | static void* memset(void *, int, size_t); | ||
34 | static void* memcpy(void *, __const void *, size_t); | ||
35 | #define memzero(s, n) memset ((s), 0, (n)) | 27 | #define memzero(s, n) memset ((s), 0, (n)) |
36 | 28 | ||
37 | typedef unsigned char uch; | 29 | typedef unsigned char uch; |
@@ -93,7 +85,7 @@ static unsigned char *real_mode; /* Pointer to real-mode data */ | |||
93 | #endif | 85 | #endif |
94 | #define RM_SCREEN_INFO (*(struct screen_info *)(real_mode+0)) | 86 | #define RM_SCREEN_INFO (*(struct screen_info *)(real_mode+0)) |
95 | 87 | ||
96 | extern char input_data[]; | 88 | extern unsigned char input_data[]; |
97 | extern int input_len; | 89 | extern int input_len; |
98 | 90 | ||
99 | static long bytes_out = 0; | 91 | static long bytes_out = 0; |
@@ -103,6 +95,9 @@ static unsigned long output_ptr = 0; | |||
103 | static void *malloc(int size); | 95 | static void *malloc(int size); |
104 | static void free(void *where); | 96 | static void free(void *where); |
105 | 97 | ||
98 | static void *memset(void *s, int c, unsigned n); | ||
99 | static void *memcpy(void *dest, const void *src, unsigned n); | ||
100 | |||
106 | static void putstr(const char *); | 101 | static void putstr(const char *); |
107 | 102 | ||
108 | extern int end; | 103 | extern int end; |
@@ -205,7 +200,7 @@ static void putstr(const char *s) | |||
205 | outb_p(0xff & (pos >> 1), vidport+1); | 200 | outb_p(0xff & (pos >> 1), vidport+1); |
206 | } | 201 | } |
207 | 202 | ||
208 | static void* memset(void* s, int c, size_t n) | 203 | static void* memset(void* s, int c, unsigned n) |
209 | { | 204 | { |
210 | int i; | 205 | int i; |
211 | char *ss = (char*)s; | 206 | char *ss = (char*)s; |
@@ -214,14 +209,13 @@ static void* memset(void* s, int c, size_t n) | |||
214 | return s; | 209 | return s; |
215 | } | 210 | } |
216 | 211 | ||
217 | static void* memcpy(void* __dest, __const void* __src, | 212 | static void* memcpy(void* dest, const void* src, unsigned n) |
218 | size_t __n) | ||
219 | { | 213 | { |
220 | int i; | 214 | int i; |
221 | char *d = (char *)__dest, *s = (char *)__src; | 215 | char *d = (char *)dest, *s = (char *)src; |
222 | 216 | ||
223 | for (i=0;i<__n;i++) d[i] = s[i]; | 217 | for (i=0;i<n;i++) d[i] = s[i]; |
224 | return __dest; | 218 | return dest; |
225 | } | 219 | } |
226 | 220 | ||
227 | /* =========================================================================== | 221 | /* =========================================================================== |
@@ -309,7 +303,7 @@ static void setup_normal_output_buffer(void) | |||
309 | #else | 303 | #else |
310 | if ((RM_ALT_MEM_K > RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) < 1024) error("Less than 2MB of memory"); | 304 | if ((RM_ALT_MEM_K > RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) < 1024) error("Less than 2MB of memory"); |
311 | #endif | 305 | #endif |
312 | output_data = (char *)__PHYSICAL_START; /* Normally Points to 1M */ | 306 | output_data = (unsigned char *)__PHYSICAL_START; /* Normally Points to 1M */ |
313 | free_mem_end_ptr = (long)real_mode; | 307 | free_mem_end_ptr = (long)real_mode; |
314 | } | 308 | } |
315 | 309 | ||
@@ -324,11 +318,9 @@ static void setup_output_buffer_if_we_run_high(struct moveparams *mv) | |||
324 | #ifdef STANDARD_MEMORY_BIOS_CALL | 318 | #ifdef STANDARD_MEMORY_BIOS_CALL |
325 | if (RM_EXT_MEM_K < (3*1024)) error("Less than 4MB of memory"); | 319 | if (RM_EXT_MEM_K < (3*1024)) error("Less than 4MB of memory"); |
326 | #else | 320 | #else |
327 | if ((RM_ALT_MEM_K > RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) < | 321 | 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"); |
328 | (3*1024)) | ||
329 | error("Less than 4MB of memory"); | ||
330 | #endif | 322 | #endif |
331 | mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START; | 323 | mv->low_buffer_start = output_data = (unsigned char *)LOW_BUFFER_START; |
332 | low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX | 324 | low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX |
333 | ? LOW_BUFFER_MAX : (unsigned int)real_mode) & ~0xfff; | 325 | ? LOW_BUFFER_MAX : (unsigned int)real_mode) & ~0xfff; |
334 | low_buffer_size = low_buffer_end - LOW_BUFFER_START; | 326 | low_buffer_size = low_buffer_end - LOW_BUFFER_START; |