preserve a magic number used by Windows NT.
This commit is contained in:
parent
16cbb2b422
commit
f1c162c0c6
9 changed files with 53 additions and 17 deletions
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
||||||
|
2000-08-27 OKUJI Yoshinori <okuji@gnu.org>
|
||||||
|
|
||||||
|
Preserve a magic number used by Windows NT in a MBR. Shit!
|
||||||
|
Reported by Khimenko Victor.
|
||||||
|
|
||||||
|
* stage1/stage1.h (STAGE1_WINDOWS_NT_MAGIC): New macro.
|
||||||
|
* stage1/stage1.S (copy_buffer): Use pusha and popa, instead of
|
||||||
|
pushing/poping %cx and %si separately, to reduce the code size.
|
||||||
|
(nt_magic): New label. Set the offset to _start plus
|
||||||
|
STAGE1_WINDOWS_NT_MAGIC
|
||||||
|
(part_start): New label.
|
||||||
|
* stage2/builtins.c (install_func): If DEST_DRIVE is a hard
|
||||||
|
disk, copy the possible partition table and Windows NT magic to
|
||||||
|
STAGE1_BUFFER from OLD_SECT.
|
||||||
|
|
||||||
|
2000-08-26 OKUJI Yoshinori <okuji@gnu.org>
|
||||||
|
|
||||||
|
* stage2/char_io.c (translate_keycode) [SUPPORT_SERIAL]: Don't
|
||||||
|
drain the input buffer, since that was irritating.
|
||||||
|
|
||||||
2000-08-26 OKUJI Yoshinori <okuji@gnu.org>
|
2000-08-26 OKUJI Yoshinori <okuji@gnu.org>
|
||||||
|
|
||||||
Don't save/restore fragile registers unnecessarily.
|
Don't save/restore fragile registers unnecessarily.
|
||||||
|
|
1
NEWS
1
NEWS
|
@ -24,6 +24,7 @@ New in 0.5.96 - XXXX-XX-XX:
|
||||||
a new option `--enable-serial'. If it is specified, you can use two
|
a new option `--enable-serial'. If it is specified, you can use two
|
||||||
new commands, "serial" and "terminal" in the command-line and the
|
new commands, "serial" and "terminal" in the command-line and the
|
||||||
menu. See the manual, for more details.
|
menu. See the manual, for more details.
|
||||||
|
* Preserve the possible magic number used by Windows NT in a MBR.
|
||||||
|
|
||||||
New in 0.5.95 - 2000-06-27:
|
New in 0.5.95 - 2000-06-27:
|
||||||
* NetBSD ELF kernel support is added. You have to specify the new option
|
* NetBSD ELF kernel support is added. You have to specify the new option
|
||||||
|
|
|
@ -344,9 +344,8 @@ copy_buffer:
|
||||||
* We need to save %cx and %si because the startup code in
|
* We need to save %cx and %si because the startup code in
|
||||||
* stage2 uses them without initializing them.
|
* stage2 uses them without initializing them.
|
||||||
*/
|
*/
|
||||||
pushw %cx
|
pusha
|
||||||
pushw %ds
|
pushw %ds
|
||||||
pushw %si
|
|
||||||
|
|
||||||
movw $0x100, %cx
|
movw $0x100, %cx
|
||||||
movw %bx, %ds
|
movw %bx, %ds
|
||||||
|
@ -358,9 +357,8 @@ copy_buffer:
|
||||||
rep
|
rep
|
||||||
movsw
|
movsw
|
||||||
|
|
||||||
popw %si
|
|
||||||
popw %ds
|
popw %ds
|
||||||
popw %cx
|
popa
|
||||||
|
|
||||||
/* boot stage2 */
|
/* boot stage2 */
|
||||||
jmp *(stage2_address)
|
jmp *(stage2_address)
|
||||||
|
@ -420,12 +418,21 @@ message:
|
||||||
jne 1b /* if not end of string, jmp to display */
|
jne 1b /* if not end of string, jmp to display */
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Windows NT breaks the compatibility by embedding a magic
|
||||||
|
* number here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
nt_magic:
|
||||||
|
. = _start + STAGE1_WINDOWS_NT_MAGIC
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is where an MBR would go if on a hard disk. The code
|
* This is where an MBR would go if on a hard disk. The code
|
||||||
* here isn't even referenced unless we're on a floppy. Kinda
|
* here isn't even referenced unless we're on a floppy. Kinda
|
||||||
* sneaky, huh?
|
* sneaky, huh?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
part_start:
|
||||||
. = _start + STAGE1_PARTSTART
|
. = _start + STAGE1_PARTSTART
|
||||||
|
|
||||||
probe_values:
|
probe_values:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 1999 Free Software Foundation, Inc.
|
* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -51,6 +51,9 @@
|
||||||
/* The offset of STAGE2_SEGMENT. */
|
/* The offset of STAGE2_SEGMENT. */
|
||||||
#define STAGE1_STAGE2_SEGMENT 0x48
|
#define STAGE1_STAGE2_SEGMENT 0x48
|
||||||
|
|
||||||
|
/* The offset of a magic number used by Windows NT. */
|
||||||
|
#define STAGE1_WINDOWS_NT_MAGIC 0x1b8
|
||||||
|
|
||||||
/* The offset of the start of the partition table. */
|
/* The offset of the start of the partition table. */
|
||||||
#define STAGE1_PARTSTART 0x1be
|
#define STAGE1_PARTSTART 0x1be
|
||||||
|
|
||||||
|
|
|
@ -1625,10 +1625,10 @@ install_func (char *arg, int flags)
|
||||||
BOOTSEC_BPB_LENGTH);
|
BOOTSEC_BPB_LENGTH);
|
||||||
|
|
||||||
/* If for a hard disk, copy the possible MBR/extended part table. */
|
/* If for a hard disk, copy the possible MBR/extended part table. */
|
||||||
if ((dest_drive & 0x80) && current_partition == 0xFFFFFF)
|
if (dest_drive & 0x80)
|
||||||
grub_memmove (stage1_buffer + BOOTSEC_PART_OFFSET,
|
grub_memmove (stage1_buffer + STAGE1_WINDOWS_NT_MAGIC,
|
||||||
old_sect + BOOTSEC_PART_OFFSET,
|
old_sect + STAGE1_WINDOWS_NT_MAGIC,
|
||||||
BOOTSEC_PART_LENGTH);
|
STAGE1_PARTEND - STAGE1_WINDOWS_NT_MAGIC);
|
||||||
|
|
||||||
/* Check for the version and the signature of Stage 1. */
|
/* Check for the version and the signature of Stage 1. */
|
||||||
if (*((short *)(stage1_buffer + STAGE1_VER_MAJ_OFFS)) != COMPAT_VERSION
|
if (*((short *)(stage1_buffer + STAGE1_VER_MAJ_OFFS)) != COMPAT_VERSION
|
||||||
|
|
|
@ -668,12 +668,6 @@ translate_keycode (int c)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Drain the input buffer, because so-called VT100-compatible
|
|
||||||
terminals could send key codes which aren't handled in the
|
|
||||||
code above. */
|
|
||||||
while (checkkey () != -1)
|
|
||||||
(void) getkey ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -45,6 +45,10 @@ static struct divisor divisor_tab[] =
|
||||||
{ 115200, 0x0001 }
|
{ 115200, 0x0001 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* The position of the cursor. */
|
||||||
|
int serial_x;
|
||||||
|
int serial_y;
|
||||||
|
|
||||||
|
|
||||||
/* Read a byte from a port. */
|
/* Read a byte from a port. */
|
||||||
static inline unsigned char
|
static inline unsigned char
|
||||||
|
|
|
@ -65,6 +65,13 @@
|
||||||
/* Turn on DTR, RTS, and OUT2. */
|
/* Turn on DTR, RTS, and OUT2. */
|
||||||
#define UART_ENABLE_MODEM 0x0B
|
#define UART_ENABLE_MODEM 0x0B
|
||||||
|
|
||||||
|
|
||||||
|
/* Variable prototypes. */
|
||||||
|
|
||||||
|
/* In the serial terminal, trace the cursor in GRUB itself. */
|
||||||
|
extern int serial_x;
|
||||||
|
extern int serial_y;
|
||||||
|
|
||||||
|
|
||||||
/* Function prototypes. */
|
/* Function prototypes. */
|
||||||
|
|
||||||
|
|
|
@ -122,9 +122,9 @@ print_border (int y, int size)
|
||||||
|
|
||||||
#ifndef GRUB_UTIL
|
#ifndef GRUB_UTIL
|
||||||
/* Color the menu. The menu is 75 * 14 characters. */
|
/* Color the menu. The menu is 75 * 14 characters. */
|
||||||
#ifdef SUPPORT_SERIAL
|
# ifdef SUPPORT_SERIAL
|
||||||
if (terminal & TERMINAL_CONSOLE)
|
if (terminal & TERMINAL_CONSOLE)
|
||||||
#endif
|
# endif
|
||||||
{
|
{
|
||||||
for (i = 0; i < 14; i++)
|
for (i = 0; i < 14; i++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue