aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/boot/compressed/misc.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2008-05-29 18:31:14 -0400
committerH. Peter Anvin <hpa@zytor.com>2008-05-30 20:00:34 -0400
commit23968f71b26ece45ed52895d41b0208b90a516e7 (patch)
tree542d30c736329e335fab8e22b0c140685a3e9e91 /arch/x86/boot/compressed/misc.c
parentc7d624d1ee7b77622305bd638755394e4d3f2d2f (diff)
x86: Use structs instead of hardcoded offsets in x86 boot decompressor.
Replace hardcoded offsets embedded in macros in arch/x86/boot/compressed with proper structure references. Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/boot/compressed/misc.c')
-rw-r--r--arch/x86/boot/compressed/misc.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 90456cee47c3..74ed3c075ee6 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -30,6 +30,7 @@
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/page.h> 31#include <asm/page.h>
32#include <asm/boot.h> 32#include <asm/boot.h>
33#include <asm/bootparam.h>
33 34
34/* WARNING!! 35/* WARNING!!
35 * This code is compiled with -fPIC and it is relocated dynamically 36 * This code is compiled with -fPIC and it is relocated dynamically
@@ -187,13 +188,7 @@ static void gzip_release(void **);
187/* 188/*
188 * This is set up by the setup-routine at boot-time 189 * This is set up by the setup-routine at boot-time
189 */ 190 */
190static unsigned char *real_mode; /* Pointer to real-mode data */ 191static struct boot_params *real_mode; /* Pointer to real-mode data */
191
192#define RM_EXT_MEM_K (*(unsigned short *)(real_mode + 0x2))
193#ifndef STANDARD_MEMORY_BIOS_CALL
194#define RM_ALT_MEM_K (*(unsigned long *)(real_mode + 0x1e0))
195#endif
196#define RM_SCREEN_INFO (*(struct screen_info *)(real_mode+0))
197 192
198extern unsigned char input_data[]; 193extern unsigned char input_data[];
199extern int input_len; 194extern int input_len;
@@ -276,12 +271,13 @@ static void putstr(const char *s)
276 char c; 271 char c;
277 272
278#ifdef CONFIG_X86_32 273#ifdef CONFIG_X86_32
279 if (RM_SCREEN_INFO.orig_video_mode == 0 && lines == 0 && cols == 0) 274 if (real_mode->screen_info.orig_video_mode == 0 &&
275 lines == 0 && cols == 0)
280 return; 276 return;
281#endif 277#endif
282 278
283 x = RM_SCREEN_INFO.orig_x; 279 x = real_mode->screen_info.orig_x;
284 y = RM_SCREEN_INFO.orig_y; 280 y = real_mode->screen_info.orig_y;
285 281
286 while ((c = *s++) != '\0') { 282 while ((c = *s++) != '\0') {
287 if (c == '\n') { 283 if (c == '\n') {
@@ -302,8 +298,8 @@ static void putstr(const char *s)
302 } 298 }
303 } 299 }
304 300
305 RM_SCREEN_INFO.orig_x = x; 301 real_mode->screen_info.orig_x = x;
306 RM_SCREEN_INFO.orig_y = y; 302 real_mode->screen_info.orig_y = y;
307 303
308 pos = (x + cols * y) * 2; /* Update cursor position */ 304 pos = (x + cols * y) * 2; /* Update cursor position */
309 outb(14, vidport); 305 outb(14, vidport);
@@ -430,7 +426,7 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
430{ 426{
431 real_mode = rmode; 427 real_mode = rmode;
432 428
433 if (RM_SCREEN_INFO.orig_video_mode == 7) { 429 if (real_mode->screen_info.orig_video_mode == 7) {
434 vidmem = (char *) 0xb0000; 430 vidmem = (char *) 0xb0000;
435 vidport = 0x3b4; 431 vidport = 0x3b4;
436 } else { 432 } else {
@@ -438,8 +434,8 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
438 vidport = 0x3d4; 434 vidport = 0x3d4;
439 } 435 }
440 436
441 lines = RM_SCREEN_INFO.orig_video_lines; 437 lines = real_mode->screen_info.orig_video_lines;
442 cols = RM_SCREEN_INFO.orig_video_cols; 438 cols = real_mode->screen_info.orig_video_cols;
443 439
444 window = output; /* Output buffer (Normally at 1M) */ 440 window = output; /* Output buffer (Normally at 1M) */
445 free_mem_ptr = heap; /* Heap */ 441 free_mem_ptr = heap; /* Heap */