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>
This commit is contained in:
committed by
H. Peter Anvin
parent
c7d624d1ee
commit
23968f71b2
@@ -30,6 +30,7 @@
|
|||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/page.h>
|
#include <asm/page.h>
|
||||||
#include <asm/boot.h>
|
#include <asm/boot.h>
|
||||||
|
#include <asm/bootparam.h>
|
||||||
|
|
||||||
/* WARNING!!
|
/* WARNING!!
|
||||||
* This code is compiled with -fPIC and it is relocated dynamically
|
* This code is compiled with -fPIC and it is relocated dynamically
|
||||||
@@ -187,13 +188,7 @@ static void gzip_release(void **);
|
|||||||
/*
|
/*
|
||||||
* This is set up by the setup-routine at boot-time
|
* This is set up by the setup-routine at boot-time
|
||||||
*/
|
*/
|
||||||
static unsigned char *real_mode; /* Pointer to real-mode data */
|
static struct boot_params *real_mode; /* Pointer to real-mode data */
|
||||||
|
|
||||||
#define RM_EXT_MEM_K (*(unsigned short *)(real_mode + 0x2))
|
|
||||||
#ifndef STANDARD_MEMORY_BIOS_CALL
|
|
||||||
#define RM_ALT_MEM_K (*(unsigned long *)(real_mode + 0x1e0))
|
|
||||||
#endif
|
|
||||||
#define RM_SCREEN_INFO (*(struct screen_info *)(real_mode+0))
|
|
||||||
|
|
||||||
extern unsigned char input_data[];
|
extern unsigned char input_data[];
|
||||||
extern int input_len;
|
extern int input_len;
|
||||||
@@ -276,12 +271,13 @@ static void putstr(const char *s)
|
|||||||
char c;
|
char c;
|
||||||
|
|
||||||
#ifdef CONFIG_X86_32
|
#ifdef CONFIG_X86_32
|
||||||
if (RM_SCREEN_INFO.orig_video_mode == 0 && lines == 0 && cols == 0)
|
if (real_mode->screen_info.orig_video_mode == 0 &&
|
||||||
|
lines == 0 && cols == 0)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
x = RM_SCREEN_INFO.orig_x;
|
x = real_mode->screen_info.orig_x;
|
||||||
y = RM_SCREEN_INFO.orig_y;
|
y = real_mode->screen_info.orig_y;
|
||||||
|
|
||||||
while ((c = *s++) != '\0') {
|
while ((c = *s++) != '\0') {
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
@@ -302,8 +298,8 @@ static void putstr(const char *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RM_SCREEN_INFO.orig_x = x;
|
real_mode->screen_info.orig_x = x;
|
||||||
RM_SCREEN_INFO.orig_y = y;
|
real_mode->screen_info.orig_y = y;
|
||||||
|
|
||||||
pos = (x + cols * y) * 2; /* Update cursor position */
|
pos = (x + cols * y) * 2; /* Update cursor position */
|
||||||
outb(14, vidport);
|
outb(14, vidport);
|
||||||
@@ -430,7 +426,7 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
|
|||||||
{
|
{
|
||||||
real_mode = rmode;
|
real_mode = rmode;
|
||||||
|
|
||||||
if (RM_SCREEN_INFO.orig_video_mode == 7) {
|
if (real_mode->screen_info.orig_video_mode == 7) {
|
||||||
vidmem = (char *) 0xb0000;
|
vidmem = (char *) 0xb0000;
|
||||||
vidport = 0x3b4;
|
vidport = 0x3b4;
|
||||||
} else {
|
} else {
|
||||||
@@ -438,8 +434,8 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
|
|||||||
vidport = 0x3d4;
|
vidport = 0x3d4;
|
||||||
}
|
}
|
||||||
|
|
||||||
lines = RM_SCREEN_INFO.orig_video_lines;
|
lines = real_mode->screen_info.orig_video_lines;
|
||||||
cols = RM_SCREEN_INFO.orig_video_cols;
|
cols = real_mode->screen_info.orig_video_cols;
|
||||||
|
|
||||||
window = output; /* Output buffer (Normally at 1M) */
|
window = output; /* Output buffer (Normally at 1M) */
|
||||||
free_mem_ptr = heap; /* Heap */
|
free_mem_ptr = heap; /* Heap */
|
||||||
|
Reference in New Issue
Block a user