LQ Newbie
Registered: Feb 2004
Posts: 1
Rep:
|
int 13 doesnt work after linux switch to real mode
I have a idea for fast reboot.
Everytime we use linux for reboot the PC, when linux switch to real mode, read the MBR to 7c00, and jump to there.
This may eliminate the warm reboot time.
I had make two version of floppy linux(one use SYSLINUX, another use LILO) for test,
BUT every time when linux reboot, the PC is halt (It seem the BIOS interrup INT 13 doesnt work).
Would you give me some comment, thank you!
I modified the linux 2.4.22/arch/i386/kernel/process.c:
static unsigned char jump_to_bios [] =
{
- 0xea, 0x00, 0x00, 0xff, 0xff
+ 0xea, 0x05, 0x90, 0x00, 0x00, /* ljmp $0x0000, $0x1005 */
+ 0x33, 0xc0, /* xorw ax, ax */
+ 0x8e, 0xd0, /* movw ax, ss */
+ 0xbc, 0x00, 0x7b, /* movw $0x7b00, sp (ss:sp->0:7b00) */
+ 0xfb, /* sti */
+ 0x50, /* pushw ax */
+ 0x07, /* popw es */
+ 0x50, /* pushw ax */
+ 0x1f, /* popw ds -> ax=es=ds=0 */
+ 0xb8, 0x01, 0x02, /* movw $0x0201, ax */
+ 0xbb, 0x00, 0x7c, /* movw $0x7c00, bx (es:bx->0:7c00) */
+ 0xb9, 0x01, 0x00, /* movw $0x0001, cx */
+ 0xba, 0x80, 0x00, /* movw $0x0080, dx */
+ 0xcd, 0x13, /* int 13 */
+ 0xea, 0x00, 0x7c, 0x00, 0x00 /* ljmp $0x0000, $0x7c00 */
};
void machine_real_restart(unsigned char *code, int length)
{
......
- memcpy ((void *) (0x1000 - sizeof (real_mode_switch) - 100),
- real_mode_switch, sizeof (real_mode_switch));
- memcpy ((void *) (0x1000 - 100), code, length);
+ memcpy ((void *) (0x9000 - sizeof (real_mode_switch)),
+ real_mode_switch, sizeof (real_mode_switch));
+ memcpy ((void *) 0x9000, code, length);
.......
- __asm__ __volatile__ ("ljmp $0x0008,%0"
- :
- : "i" ((void *) (0x1000 - sizeof (real_mode_switch) - 100)));
+ __asm__ __volatile__ ("ljmp $0x0008,%0"
+ :
+ : "i" ((void *) (0x9000 - sizeof (real_mode_switch))));
}
|