From: "Aboo Valappil" <aboo@aboosplanet.com>
To: <linux-kernel@vger.kernel.org>
Subject: Switch back to Real mode and then boot strap
Date: Tue, 28 Sep 2004 20:11:59 +1000 [thread overview]
Message-ID: <NAYASmLAztxc1o8yfog00000008@naya.ABOOSPLANET.COM> (raw)
In-Reply-To: <41592C64.3030409@yahoo.com.au>
Hi All,
I am new to this mailing list ... Need some help, PLEASE :)
I am running redhat Linux with kernel 2.4.21-4.EL.
Basically I have a requirement of re-booting ( Without really rebooting )
the OS from the hard disk ( even if a floppy is present or a bootable CD-ROM
is present). Update CMOS to change the boot sequence is not an option for
my requirement.
My idea is to read the MBR off the hard disk and then jump to the memory
location of the MBR after switching to real mode. The thing I do not want to
do is to jump to real address FFFF:0000 because it is going to select the
boot device ( Where this selection, I do not have any control when I
rebooted )
I found a function in process.c ( arch/i386/kernel/ ) called
machine_real_restart(code,length) where you could give the address of a real
mode routine. If I call this function (ofcource from a kernel module) with
address pointed to a piece of code which has ljmp $0xffff,$0x0, the system
reboots fine. I WAS VERY EXCITED TO SEE THIS.
Proceeding to my next step, I generated an array of machine code (.code16),
where I use INT 13h to read the first sector off the hard drive to
0000:7c00, and then ljmp to 0000:7c000. I used the above kernel function to
call this. I am was so disappointed to see the SYSTEM JUST HANGS :( .
Here is the routine I am using ...
.code16
xorw %ax,%ax
movw %ax,%ds
movw %ax,%ss
movw %ax,%es
movw $0xffff, %sp
movw $0x201,%ax
movw $0x01,%cx
movw $0x7c00, %bx
movw $0x80,%dx
int $0x13
movb $0x0e,%ah
movb $0x5A,%al
int $0x10
ljmp $0x0000,$0x7c00
Here the code for device IOCTL for my character device.
int device_ioctl( struct inode *inode, struct file *file, unsigned int i_n,
unsigned long i_p )
{
static unsigned char jbios [] = {
0x31 ,0xc0 ,0x8e ,0xd8 ,0x8e ,0xd0 ,0x8e ,0xc0 ,0xbc ,0xff ,0xff ,0xb8
,0x01 ,0x02 ,0xb9 ,0x01 ,0x00 ,0xbb ,0x00 ,0x7c ,0xba ,0x80 ,0x00 ,0xcd
,0x13 ,0xb4 ,0x0e ,0xb0 ,0x5a ,0xcd ,0x10 ,0xea ,0x00 ,0x7c ,0x00 ,0x00 };
if ( i_n == 999 ) {
machine_real_restart(jbios,36);
}
}
When I call the ioctl, it just hangs. If I replace the code with only a ljmp
$0xffff,0x0 instruction it reboots the computer as it should.
Any ideas, what I am doing wrong here ?
Thanks
Aboo
next prev parent reply other threads:[~2004-09-28 10:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-27 18:02 [Patch] i386: Xbox support Ed Schouten
2004-09-28 0:03 ` Nick Piggin
2004-09-28 2:35 ` Will Dyson
2004-09-28 4:46 ` Ed Schouten
2004-09-28 7:42 ` Nick Piggin
2004-09-28 8:46 ` Ed Schouten
2004-09-29 18:21 ` Tonnerre
2004-09-29 22:16 ` Ed Schouten
2004-09-28 9:06 ` Pavel Machek
2004-09-28 9:18 ` Nick Piggin
2004-09-28 10:11 ` Aboo Valappil [this message]
2004-09-28 10:21 ` Switch back to Real mode and then boot strap Alex Riesen
2004-09-28 10:46 ` Aboo Valappil
2004-09-28 10:57 ` Alex Riesen
2004-09-28 21:26 ` Aboo Valappil
2004-09-28 21:45 ` [Patch] i386: Xbox support Rahul Karnik
2004-09-28 22:06 ` Ed Schouten
2004-09-28 10:11 ` David Weinehall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=NAYASmLAztxc1o8yfog00000008@naya.ABOOSPLANET.COM \
--to=aboo@aboosplanet.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®