* [Patch] i386: Xbox support
@ 2004-09-27 18:02 Ed Schouten
2004-09-28 0:03 ` Nick Piggin
0 siblings, 1 reply; 18+ messages in thread
From: Ed Schouten @ 2004-09-27 18:02 UTC (permalink / raw)
To: linux-kernel; +Cc: alan
Added support for Microsoft Xbox gaming consoles by adding the config
option 'CONFIG_X86_XBOX'. This patch is very minimalistic and should give
the fellows at xbox-linux.org a starting point.
---
CREDITS | 8 +++++++
arch/i386/Kconfig | 16 ++++++++++++--
arch/i386/Makefile | 3 ++
arch/i386/boot/compressed/Makefile | 7 ++++++
arch/i386/mach-xbox/Makefile | 5 ++++
arch/i386/mach-xbox/reboot.c | 41
+++++++++++++++++++++++++++++++++++++
arch/i386/pci/direct.c | 15 +++++++++++++
include/asm-i386/timex.h | 2 +
include/asm-i386/xbox.h | 17 +++++++++++++++
include/linux/pci_ids.h | 1
10 files changed, 113 insertions(+), 2 deletions(-)
diff -u -r --new-file linux-2.6.9-rc2/CREDITS linux-2.6.9-rc2-xbox/CREDITS
--- linux-2.6.9-rc2/CREDITS 2004-09-27 14:38:55.874666000 +0200
+++ linux-2.6.9-rc2-xbox/CREDITS 2004-09-27 19:34:06.201661000 +0200
@@ -2944,6 +2944,14 @@
E:
D: Macintosh IDE Driver
+N: Ed Schouten
+E: ed@il.fontys.nl
+W: http://g-rave.nl/
+D: Imported Xbox workarounds
+S: Klinkerstraat 20
+S: 5361 GW Grave
+S: The Netherlands
+
N: Peter De Schrijver
E: stud11@cc4.kuleuven.ac.be
D: Mitsumi CD-ROM driver patches March version
diff -u -r --new-file linux-2.6.9-rc2/arch/i386/Kconfig
linux-2.6.9-rc2-xbox/arch/i386/Kconfig
--- linux-2.6.9-rc2/arch/i386/Kconfig 2004-09-27 14:38:58.438666000 +0200
+++ linux-2.6.9-rc2-xbox/arch/i386/Kconfig 2004-09-27 09:40:28.881666000
+0200
@@ -51,6 +51,18 @@
If unsure, choose "PC-compatible" instead.
+config X86_XBOX
+ bool "Microsoft Xbox"
+ help
+ This option is needed to make Linux boot on a Microsoft Xbox.
+
+ If you are not planning on running this kernel on a Microsoft Xbox,
+ say N here, otherwise the kernel you build will not be bootable.
+
+ For more information about Xbox Linux, visit:
+
+ http://www.xbox-linux.org/
+
config X86_VOYAGER
bool "Voyager (NCR)"
help
@@ -1139,7 +1151,7 @@
config MCA
bool "MCA support"
- depends on !(X86_VISWS || X86_VOYAGER)
+ depends on !(X86_VISWS || X86_VOYAGER || X86_XBOX)
help
MicroChannel Architecture is found in some IBM PS/2 machines and
laptops. It is a bus system similar to PCI or ISA. See
@@ -1202,7 +1214,7 @@
config X86_BIOS_REBOOT
bool
- depends on !(X86_VISWS || X86_VOYAGER)
+ depends on !(X86_VISWS || X86_VOYAGER || X86_XBOX)
default y
config X86_TRAMPOLINE
diff -u -r --new-file linux-2.6.9-rc2/arch/i386/Makefile
linux-2.6.9-rc2-xbox/arch/i386/Makefile
--- linux-2.6.9-rc2/arch/i386/Makefile 2004-09-27 14:38:58.443666000 +0200
+++ linux-2.6.9-rc2-xbox/arch/i386/Makefile 2004-09-27 15:23:26.244666000
+0200
@@ -69,6 +69,9 @@
mflags-$(CONFIG_X86_VOYAGER) := -Iinclude/asm-i386/mach-voyager
mcore-$(CONFIG_X86_VOYAGER) := mach-voyager
+# Xbox subarch support
+core-$(CONFIG_X86_XBOX) += arch/i386/mach-xbox/
+
# VISWS subarch support
mflags-$(CONFIG_X86_VISWS) := -Iinclude/asm-i386/mach-visws
mcore-$(CONFIG_X86_VISWS) := mach-visws
diff -u -r --new-file linux-2.6.9-rc2/arch/i386/boot/compressed/Makefile
linux-2.6.9-rc2-xbox/arch/i386/boot/compressed/Makefile
--- linux-2.6.9-rc2/arch/i386/boot/compressed/Makefile 2004-08-14
12:55:48.000000000 +0200
+++ linux-2.6.9-rc2-xbox/arch/i386/boot/compressed/Makefile 2004-09-27
09:40:28.917666000 +0200
@@ -7,6 +7,13 @@
targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
EXTRA_AFLAGS := -traditional
+# Microsoft Xbox workaround:
+# Xbox v1.1+ crashes while decompressing the kernel when paging is off.
+# By disabling optimization we can fix this.
+ifeq ($(CONFIG_X86_XBOX),y)
+ CFLAGS_misc.o := -O0
+endif
+
LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32
$(obj)/vmlinux: $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE
diff -u -r --new-file linux-2.6.9-rc2/arch/i386/mach-xbox/Makefile
linux-2.6.9-rc2-xbox/arch/i386/mach-xbox/Makefile
--- linux-2.6.9-rc2/arch/i386/mach-xbox/Makefile 1970-01-01
01:00:00.000000000 +0100
+++ linux-2.6.9-rc2-xbox/arch/i386/mach-xbox/Makefile 2004-09-27
14:52:20.504666000 +0200
@@ -0,0 +1,5 @@
+#
+# Makefile for the linux kernel.
+#
+
+obj-$(CONFIG_X86_XBOX) := reboot.o
diff -u -r --new-file linux-2.6.9-rc2/arch/i386/mach-xbox/reboot.c
linux-2.6.9-rc2-xbox/arch/i386/mach-xbox/reboot.c
--- linux-2.6.9-rc2/arch/i386/mach-xbox/reboot.c 1970-01-01
01:00:00.000000000 +0100
+++ linux-2.6.9-rc2-xbox/arch/i386/mach-xbox/reboot.c 2004-09-27
19:30:30.836661000 +0200
@@ -0,0 +1,41 @@
+/*
+ * arch/i386/mach-xbox/reboot.c
+ * Ed Schouten <ed@il.fontys.nl>
+ *
+ * Originally done by:
+ * Olivier Fauchon <olivier.fauchon@free.fr>
+ * Anders Gustafsson <andersg@0x63.nu>
+ *
+ */
+
+#include <asm/io.h>
+#include <asm-i386/xbox.h>
+
+/* we don't use any of those, but dmi_scan.c needs 'em */
+void (*pm_power_off)(void);
+int reboot_thru_bios;
+
+static void xbox_pic_cmd(u8 command)
+{
+ outw_p(((XBOX_PIC_ADDRESS) << 1), XBOX_SMB_HOST_ADDRESS);
+ outb_p(SMC_CMD_POWER, XBOX_SMB_HOST_COMMAND);
+ outw_p(command, XBOX_SMB_HOST_DATA);
+ outw_p(inw(XBOX_SMB_IO_BASE), XBOX_SMB_IO_BASE);
+ outb_p(0x0a, XBOX_SMB_GLOBAL_ENABLE);
+}
+
+void machine_restart(char * __unused)
+{
+ printk(KERN_INFO "Sending POWER_CYCLE to XBOX-PIC.\n");
+ xbox_pic_cmd(SMC_SUBCMD_POWER_CYCLE);
+}
+
+void machine_power_off(void)
+{
+ printk(KERN_INFO "Sending POWER_OFF to XBOX-PIC.\n");
+ xbox_pic_cmd(SMC_SUBCMD_POWER_OFF);
+}
+
+void machine_halt(void)
+{
+}
diff -u -r --new-file linux-2.6.9-rc2/arch/i386/pci/direct.c
linux-2.6.9-rc2-xbox/arch/i386/pci/direct.c
--- linux-2.6.9-rc2/arch/i386/pci/direct.c 2004-08-14 12:54:51.000000000
+0200
+++ linux-2.6.9-rc2-xbox/arch/i386/pci/direct.c 2004-09-27
09:40:28.962666000 +0200
@@ -20,6 +20,21 @@
if (!value || (bus > 255) || (devfn > 255) || (reg > 255))
return -EINVAL;
+#ifdef CONFIG_X86_XBOX
+ /*
+ * Workaround for the Microsoft Xbox:
+ * Prevent it from tampering with some devices.
+ */
+ if ((bus == 0) && !PCI_SLOT(devfn) && ((PCI_FUNC(devfn) == 1) ||
(PCI_FUNC(devfn) == 2)))
+ return -EINVAL;
+
+ if ((bus == 1) && (PCI_SLOT(devfn) || PCI_FUNC(devfn)))
+ return -EINVAL;
+
+ if (bus >= 2)
+ return -EINVAL;
+#endif
+
spin_lock_irqsave(&pci_config_lock, flags);
outl(PCI_CONF1_ADDRESS(bus, devfn, reg), 0xCF8);
diff -u -r --new-file linux-2.6.9-rc2/include/asm-i386/timex.h
linux-2.6.9-rc2-xbox/include/asm-i386/timex.h
--- linux-2.6.9-rc2/include/asm-i386/timex.h 2004-09-27 14:39:32.304666000
+0200
+++ linux-2.6.9-rc2-xbox/include/asm-i386/timex.h 2004-09-27
09:40:28.974666000 +0200
@@ -11,6 +11,8 @@
#ifdef CONFIG_X86_ELAN
# define CLOCK_TICK_RATE 1189200 /* AMD Elan has different frequency! */
+#elif CONFIG_X86_XBOX
+# define CLOCK_TICK_RATE 1125000 /* Microsoft Xbox */
#else
# define CLOCK_TICK_RATE 1193182 /* Underlying HZ */
#endif
diff -u -r --new-file linux-2.6.9-rc2/include/asm-i386/xbox.h
linux-2.6.9-rc2-xbox/include/asm-i386/xbox.h
--- linux-2.6.9-rc2/include/asm-i386/xbox.h 1970-01-01 01:00:00.000000000
+0100
+++ linux-2.6.9-rc2-xbox/include/asm-i386/xbox.h 2004-09-27
09:40:28.976666000 +0200
@@ -0,0 +1,17 @@
+/*
+ * include/asm-i386/xbox.h
+ * Ed Schouten <ed@il.fontys.nl>
+ */
+
+#define XBOX_SMB_IO_BASE 0xC000
+#define XBOX_SMB_HOST_ADDRESS (0x4 + XBOX_SMB_IO_BASE)
+#define XBOX_SMB_HOST_COMMAND (0x8 + XBOX_SMB_IO_BASE)
+#define XBOX_SMB_HOST_DATA (0x6 + XBOX_SMB_IO_BASE)
+#define XBOX_SMB_GLOBAL_ENABLE (0x2 + XBOX_SMB_IO_BASE)
+
+#define XBOX_PIC_ADDRESS 0x10
+
+#define SMC_CMD_POWER 0x02
+#define SMC_SUBCMD_POWER_RESET 0x01
+#define SMC_SUBCMD_POWER_CYCLE 0x40
+#define SMC_SUBCMD_POWER_OFF 0x80
diff -u -r --new-file linux-2.6.9-rc2/include/linux/pci_ids.h
linux-2.6.9-rc2-xbox/include/linux/pci_ids.h
--- linux-2.6.9-rc2/include/linux/pci_ids.h 2004-09-27 14:39:37.453666000
+0200
+++ linux-2.6.9-rc2-xbox/include/linux/pci_ids.h 2004-09-27
09:40:28.981666000 +0200
@@ -1137,6 +1137,7 @@
#define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL 0x0258
#define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL 0x0259
#define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL 0x025B
+#define PCI_DEVICE_ID_NVIDIA_GEFORCE3_XBOX 0x02A0
#define PCI_VENDOR_ID_IMS 0x10e0
#define PCI_DEVICE_ID_IMS_8849 0x8849
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Patch] i386: Xbox support 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 0 siblings, 2 replies; 18+ messages in thread From: Nick Piggin @ 2004-09-28 0:03 UTC (permalink / raw) To: Ed Schouten; +Cc: linux-kernel, alan Ed Schouten wrote: > Added support for Microsoft Xbox gaming consoles by adding the config > option 'CONFIG_X86_XBOX'. This patch is very minimalistic and should give > the fellows at xbox-linux.org a starting point. Any real point to merging this? (I honestly don't know, I don't follow the xbox hacking scene). ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch] i386: Xbox support 2004-09-28 0:03 ` Nick Piggin @ 2004-09-28 2:35 ` Will Dyson 2004-09-28 4:46 ` Ed Schouten 1 sibling, 0 replies; 18+ messages in thread From: Will Dyson @ 2004-09-28 2:35 UTC (permalink / raw) To: Nick Piggin; +Cc: Ed Schouten, linux-kernel, alan On Tue, 28 Sep 2004 10:03:39 +1000, Nick Piggin <nickpiggin@yahoo.com.au> wrote: > Ed Schouten wrote: > > Added support for Microsoft Xbox gaming consoles by adding the config > > option 'CONFIG_X86_XBOX'. This patch is very minimalistic and should give > > the fellows at xbox-linux.org a starting point. > > Any real point to merging this? (I honestly don't know, I don't follow the > xbox hacking scene). As someone who owns a modchipped xbox (used mainly for media center stuff), I would appreciate having fewer out of tree patches to apply in order to run a new kernel. I can't vouch for any kind of critical mass of users, however. -- Will Dyson ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch] i386: Xbox support 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 1 sibling, 1 reply; 18+ messages in thread From: Ed Schouten @ 2004-09-28 4:46 UTC (permalink / raw) To: Nick Piggin, linux-kernel Hello Nick, On Tue, 28 Sep 2004 10:03:39 +1000, Nick Piggin <nickpiggin@yahoo.com.au> wrote: > Any real point to merging this? (I honestly don't know, I don't follow the > xbox hacking scene). Yes, it does (in my opinion). This small 7 KB patch allows you to run a vanilla kernel on the machine (with exception of the video driver). I also noticed my previous mailclient (Squirrelmail) did some linebreaking. Please notice: + if ((bus == 0) && !PCI_SLOT(devfn) && ((PCI_FUNC(devfn) == 1) || (PCI_FUNC(devfn) == 2))) should be one line ;-) Yours sincerely, -- Ed Schouten <edschouten@gmail.com> Website: http://g-rave.nl/ ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch] i386: Xbox support 2004-09-28 4:46 ` Ed Schouten @ 2004-09-28 7:42 ` Nick Piggin 2004-09-28 8:46 ` Ed Schouten ` (2 more replies) 0 siblings, 3 replies; 18+ messages in thread From: Nick Piggin @ 2004-09-28 7:42 UTC (permalink / raw) To: Ed Schouten; +Cc: linux-kernel Ed Schouten wrote: > Hello Nick, > > On Tue, 28 Sep 2004 10:03:39 +1000, Nick Piggin <nickpiggin@yahoo.com.au> wrote: > >>Any real point to merging this? (I honestly don't know, I don't follow the >>xbox hacking scene). > > > Yes, it does (in my opinion). This small 7 KB patch allows you to run > a vanilla kernel on the machine (with exception of the video driver). > > I also noticed my previous mailclient (Squirrelmail) did some > linebreaking. Please notice: > > + if ((bus == 0) && !PCI_SLOT(devfn) && ((PCI_FUNC(devfn) == 1) || > (PCI_FUNC(devfn) == 2))) > > should be one line ;-) > > Yours sincerely, Well, I ask because there is probably quite a large number of embedded type devices devices that you could "just add a small patch for" to get it working. The added fact that you have to "hack" the hardware (I think?) to even get it to run Linux makes it probably a bit more questionable (it is great that we can run on xbox, but maybe not too harmful to keep it as an external patch). Anyway I've otherwise got no objections ;) if you can convince Andrew and/or Linus to merge it, then fine. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch] i386: Xbox support 2004-09-28 7:42 ` Nick Piggin @ 2004-09-28 8:46 ` Ed Schouten 2004-09-29 18:21 ` Tonnerre 2004-09-28 9:06 ` Pavel Machek 2004-09-28 10:11 ` David Weinehall 2 siblings, 1 reply; 18+ messages in thread From: Ed Schouten @ 2004-09-28 8:46 UTC (permalink / raw) To: linux-kernel; +Cc: nickpiggin On Tue, 28 Sep 2004 17:42:40 +1000, Nick Piggin <nickpiggin@yahoo.com.au> wrote: > Well, I ask because there is probably quite a large number of embedded type > devices devices that you could "just add a small patch for" to get it working. > > The added fact that you have to "hack" the hardware (I think?) to even get > it to run Linux makes it probably a bit more questionable (it is great that > we can run on xbox, but maybe not too harmful to keep it as an external patch). Yes, you have multiple options to get Linux on it (flash the BIOS with cromwell, grub-based bootloader, alter some of its current software, etc). The reason why the Xbox-Linux folks and I think it should belong in the main tree is adoption. Xbox Linux has been around since 2001 if I remember correctly and there are almost no distributions around that really support the Xbox. The people at Debian for example will only add Xbox support if it is available in the main tree. Yours, -- Ed Schouten <edschouten@gmail.com> Website: http://g-rave.nl/ ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch] i386: Xbox support 2004-09-28 8:46 ` Ed Schouten @ 2004-09-29 18:21 ` Tonnerre 2004-09-29 22:16 ` Ed Schouten 0 siblings, 1 reply; 18+ messages in thread From: Tonnerre @ 2004-09-29 18:21 UTC (permalink / raw) To: Ed Schouten; +Cc: linux-kernel, nickpiggin [-- Attachment #1: Type: text/plain, Size: 331 bytes --] Salut, On Tue, Sep 28, 2004 at 10:46:56AM +0200, Ed Schouten wrote: > Xbox Linux has been around since 2001 if I remember correctly and > there are almost no distributions around that really support the > Xbox. Didn't Andy Green mention that there was Mandrake 9 for the X-Box, way back in december 2002? Tonnerre [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch] i386: Xbox support 2004-09-29 18:21 ` Tonnerre @ 2004-09-29 22:16 ` Ed Schouten 0 siblings, 0 replies; 18+ messages in thread From: Ed Schouten @ 2004-09-29 22:16 UTC (permalink / raw) To: Tonnerre; +Cc: linux-kernel, nickpiggin On Wed, 29 Sep 2004 20:21:43 +0200, Tonnerre <tonnerre@thundrix.ch> wrote: > Didn't Andy Green mention that there was Mandrake 9 for the X-Box, way > back in december 2002? That was a 'hackjob' in cooperation with the Mandrake devvers, as far as I know. But that doesn't make it any better, because that version of Mandrake is outdated and it still uses the 2.4 kernel. Yours, -- Ed Schouten <edschouten@gmail.com> Website: http://g-rave.nl/ ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch] i386: Xbox support 2004-09-28 7:42 ` Nick Piggin 2004-09-28 8:46 ` Ed Schouten @ 2004-09-28 9:06 ` Pavel Machek 2004-09-28 9:18 ` Nick Piggin 2004-09-28 10:11 ` David Weinehall 2 siblings, 1 reply; 18+ messages in thread From: Pavel Machek @ 2004-09-28 9:06 UTC (permalink / raw) To: Nick Piggin; +Cc: Ed Schouten, linux-kernel Hi! > >>Any real point to merging this? (I honestly don't know, I don't follow the > >>xbox hacking scene). > > > > > >Yes, it does (in my opinion). This small 7 KB patch allows you to run > >a vanilla kernel on the machine (with exception of the video driver). > > > >I also noticed my previous mailclient (Squirrelmail) did some > >linebreaking. Please notice: > > > >+ if ((bus == 0) && !PCI_SLOT(devfn) && ((PCI_FUNC(devfn) == 1) || > >(PCI_FUNC(devfn) == 2))) > > > >should be one line ;-) > > > >Yours sincerely, > > Well, I ask because there is probably quite a large number of embedded type > devices devices that you could "just add a small patch for" to get it > working. Yes, and we support most of them :-). This is not really different from all the arm platforms etc. Pavel -- People were complaining that M$ turns users into beta-testers... ...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl! ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch] i386: Xbox support 2004-09-28 9:06 ` Pavel Machek @ 2004-09-28 9:18 ` Nick Piggin 2004-09-28 10:11 ` Switch back to Real mode and then boot strap Aboo Valappil 2004-09-28 21:45 ` [Patch] i386: Xbox support Rahul Karnik 0 siblings, 2 replies; 18+ messages in thread From: Nick Piggin @ 2004-09-28 9:18 UTC (permalink / raw) To: Pavel Machek; +Cc: Ed Schouten, linux-kernel Pavel Machek wrote: >>Well, I ask because there is probably quite a large number of embedded type >>devices devices that you could "just add a small patch for" to get it >>working. > > > Yes, and we support most of them :-). This is not really different > from all the arm platforms etc. Yeah OK. I don't want to turn this into an argument, but the difference is AFAIK, that many of them are made *for* running Linux (or at least as a supported configuration). While the xbox requires you to circumvent the hardware. But on the other hand, "why not?" :) As I said, so long as Linus or Andrew is happy with it, I don't care. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Switch back to Real mode and then boot strap 2004-09-28 9:18 ` Nick Piggin @ 2004-09-28 10:11 ` Aboo Valappil 2004-09-28 10:21 ` Alex Riesen 2004-09-28 21:26 ` Aboo Valappil 2004-09-28 21:45 ` [Patch] i386: Xbox support Rahul Karnik 1 sibling, 2 replies; 18+ messages in thread From: Aboo Valappil @ 2004-09-28 10:11 UTC (permalink / raw) To: linux-kernel 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 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Switch back to Real mode and then boot strap 2004-09-28 10:11 ` Switch back to Real mode and then boot strap Aboo Valappil @ 2004-09-28 10:21 ` Alex Riesen 2004-09-28 10:46 ` Aboo Valappil 2004-09-28 21:26 ` Aboo Valappil 1 sibling, 1 reply; 18+ messages in thread From: Alex Riesen @ 2004-09-28 10:21 UTC (permalink / raw) To: Aboo Valappil; +Cc: linux-kernel On Tue, 28 Sep 2004 20:11:59 +1000, Aboo Valappil <aboo@aboosplanet.com> wrote: > 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. You probably want to look at kexec. I.e. there: http://lwn.net/Articles/15468/ ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: Switch back to Real mode and then boot strap 2004-09-28 10:21 ` Alex Riesen @ 2004-09-28 10:46 ` Aboo Valappil 2004-09-28 10:57 ` Alex Riesen 0 siblings, 1 reply; 18+ messages in thread From: Aboo Valappil @ 2004-09-28 10:46 UTC (permalink / raw) To: 'Alex Riesen'; +Cc: linux-kernel Alex, Thanks for your reply, it is really good if I have to load another kernel. But in my case the OS on the hard disk could be Windows, Linux or x86 Solaris. A reboot is required from Linux booted from floppy/ramdisk after the hard disk has been imaged with requested operating system by a user. Because of the automated behavior of this, changing the boot sequence is not an option. That is why I am after executing real mode BIOS interrupts to load the MBR and then pass control to it. Any help will be appreciated :) Thanks Aboo -----Original Message----- From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Alex Riesen Sent: Tuesday, September 28, 2004 8:22 PM To: Aboo Valappil Cc: linux-kernel@vger.kernel.org Subject: Re: Switch back to Real mode and then boot strap On Tue, 28 Sep 2004 20:11:59 +1000, Aboo Valappil <aboo@aboosplanet.com> wrote: > 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. You probably want to look at kexec. I.e. there: http://lwn.net/Articles/15468/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Switch back to Real mode and then boot strap 2004-09-28 10:46 ` Aboo Valappil @ 2004-09-28 10:57 ` Alex Riesen 0 siblings, 0 replies; 18+ messages in thread From: Alex Riesen @ 2004-09-28 10:57 UTC (permalink / raw) To: Aboo Valappil; +Cc: linux-kernel On Tue, 28 Sep 2004 20:46:40 +1000, Aboo Valappil <aboo@aboosplanet.com> wrote: > Thanks for your reply, it is really good if I have to load another kernel. > But in my case the OS on the hard disk could be Windows, Linux or x86 > Solaris. A reboot is required from Linux booted from floppy/ramdisk after > the hard disk has been imaged with requested operating system by a user. Could be a starting point, though. > Because of the automated behavior of this, changing the boot sequence is not > an option. That is why I am after executing real mode BIOS interrupts to > load the MBR and then pass control to it. You still have to shutdown the currently running kernel and put the devices in some definite state. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Switch back to Real mode and then boot strap 2004-09-28 10:11 ` Switch back to Real mode and then boot strap Aboo Valappil 2004-09-28 10:21 ` Alex Riesen @ 2004-09-28 21:26 ` Aboo Valappil 1 sibling, 0 replies; 18+ messages in thread From: Aboo Valappil @ 2004-09-28 21:26 UTC (permalink / raw) To: linux-kernel 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 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch] i386: Xbox support 2004-09-28 9:18 ` Nick Piggin 2004-09-28 10:11 ` Switch back to Real mode and then boot strap Aboo Valappil @ 2004-09-28 21:45 ` Rahul Karnik 2004-09-28 22:06 ` Ed Schouten 1 sibling, 1 reply; 18+ messages in thread From: Rahul Karnik @ 2004-09-28 21:45 UTC (permalink / raw) To: Nick Piggin; +Cc: Pavel Machek, Ed Schouten, linux-kernel On Tue, 28 Sep 2004 19:18:28 +1000, Nick Piggin <nickpiggin@yahoo.com.au> wrote: > As I said, so long as Linus or Andrew is happy with it, I don't care. Linus rejected a similar (slightly larger patch) last year. http://marc.theaimsgroup.com/?t=105819036500001&r=1&w=2 That said, he does change his mind. Is this still a "politically hot potato"? -Rahul ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch] i386: Xbox support 2004-09-28 21:45 ` [Patch] i386: Xbox support Rahul Karnik @ 2004-09-28 22:06 ` Ed Schouten 0 siblings, 0 replies; 18+ messages in thread From: Ed Schouten @ 2004-09-28 22:06 UTC (permalink / raw) To: Rahul Karnik; +Cc: Nick Piggin, Pavel Machek, linux-kernel On Tue, 28 Sep 2004 17:45:33 -0400, Rahul Karnik <deathdruid@gmail.com> wrote: > Linus rejected a similar (slightly larger patch) last year. > > http://marc.theaimsgroup.com/?t=105819036500001&r=1&w=2 > > That said, he does change his mind. Is this still a "politically hot potato"? >From my point of view it isn't. Xbox-Linux already exists for three years and Microsoft still haven't done anything against it. It would be silly if they would file a lawsuit against us, after three years. If they would, it would be useless anyway. Quote from xbox-linux.org: "Everything done on this project is for the sole purpose of writing interoperable software under Sect. 1201 (f) Reverse Engineering exception of the DMCA." Sect. 1201 (f) can be read here: http://cyber.law.harvard.edu/openlaw/DVD/1201.html#f Yours, -- Ed Schouten <edschouten@gmail.com> Website: http://g-rave.nl/ ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch] i386: Xbox support 2004-09-28 7:42 ` Nick Piggin 2004-09-28 8:46 ` Ed Schouten 2004-09-28 9:06 ` Pavel Machek @ 2004-09-28 10:11 ` David Weinehall 2 siblings, 0 replies; 18+ messages in thread From: David Weinehall @ 2004-09-28 10:11 UTC (permalink / raw) To: Nick Piggin; +Cc: Ed Schouten, linux-kernel On Tue, Sep 28, 2004 at 05:42:40PM +1000, Nick Piggin wrote: [snip] > Well, I ask because there is probably quite a large number of embedded type > devices devices that you could "just add a small patch for" to get it > working. Yes, and I really hope that small patches for embedded type devices get accepted (given, of course, that they follow the same quality standards as other patches), just like we accept drivers for the x86... [snip] Regards: David Weinehall -- /) David Weinehall <tao@acc.umu.se> /) Northern lights wander (\ // Maintainer of the v2.0 kernel // Dance across the winter sky // \) http://www.acc.umu.se/~tao/ (/ Full colour fire (/ ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2004-09-29 22:17 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` Switch back to Real mode and then boot strap Aboo Valappil 2004-09-28 10:21 ` 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox