<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2900.2604" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=421181716-09092005><FONT face=Arial color=#0000ff size=2>QNX
Neutrino doesn't set up its own GDT right away. Its startup code
has some defensive logic that attempts to put the system into a known state.
This causes an exception when booted from LinuxBIOS, if its GDT got trashed
when elfboot() loaded the Neutrino image. See the hyperlink below for more
discussion.</FONT></SPAN></DIV>
<DIV><SPAN class=421181716-09092005><FONT face=Arial
color=#0000ff></FONT></SPAN> </DIV>
<DIV><SPAN class=421181716-09092005><FONT face=Arial color=#0000ff>The fix seems
straightforward, and the increased amount of "table" memory very modest. Do you
object to this patch?</FONT></SPAN></DIV>
<DIV><SPAN class=421181716-09092005><FONT face=Arial
color=#0000ff></FONT></SPAN> </DIV>
<DIV><SPAN class=421181716-09092005><FONT face=Arial
color=#0000ff>Steve</FONT></SPAN></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> yhlu
[mailto:yinghailu@gmail.com] <BR><B>Sent:</B> Friday, September 09, 2005 10:03
AM<BR><B>To:</B> Steven J. Magnani<BR><B>Cc:</B>
linuxbios@openbios.org<BR><B>Subject:</B> Re: [LinuxBIOS] PATCH: relocate GDT
before invoking payload<BR><BR></FONT></DIV>why?<BR><BR>The payload will have
its own GDT.<BR><BR>YH<BR><BR>
<DIV><SPAN class=gmail_quote>On 9/9/05, <B class=gmail_sendername>Steven J.
Magnani</B> <<A
href="mailto:steve@digidescorp.com">steve@digidescorp.com</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">I
posted this patch previously; see<BR><A
href="http://openbios.org/pipermail/linuxbios/2005-August/012063.html">http://openbios.org/pipermail/linuxbios/2005-August/012063.html</A>
for the<BR>original issue.<BR><BR>Here's another chance to comment before I
commit it. <BR><BR>PATCH:<BR><BR>---
src/arch/i386/boot/tables.c.orig 2005-09-08
13:35:39.125000000<BR>-0500<BR>+++ src/arch/i386/boot/tables.c 2005-08-16
16:17:41.766000000 -0500<BR>@@ -7,6 +7,32 @@<BR>#include <arch/acpi.h>
<BR>#include "linuxbios_table.h"<BR><BR>+// Global Descriptor Table, defined
in c_start.S<BR>+extern uint8_t gdt;<BR>+extern uint8_t gdt_end;<BR>+<BR>+/*
i386 lgdt argument */<BR>+struct gdtarg
{<BR>+ unsigned short limit;
<BR>+ unsigned int base;<BR>+}
__attribute__((packed));<BR>+<BR>+// Copy GDT to new location and reload
it<BR>+// 2003-07 by SONE Takeshi<BR>+// Ported from Etherboot to LinuxBIOS
2005-08 by Steve Magnani<BR>+void move_gdt(unsigned long newgdt)
<BR>+{<BR>+ uint16_t num_gdt_bytes =
&gdt_end - &gdt;<BR>+ struct gdtarg
gdtarg;<BR>+<BR>+ printk_debug("Moving GDT to
%#lx...", newgdt);<BR>+ memcpy((void*)newgdt,
&gdt, num_gdt_bytes); <BR>+ gdtarg.base =
newgdt;<BR>+ gdtarg.limit = num_gdt_bytes -
1;<BR>+ __asm__ __volatile__ ("lgdt %0\n\t" : : "m"
(gdtarg));<BR>+ printk_debug("ok\n");<BR>+}<BR>+<BR>struct
lb_memory *write_tables(void)
<BR>{<BR> unsigned long
low_table_start, low_table_end;<BR>@@ -45,6 +71,10
@@<BR> low_table_end
=
0x500;<BR> }<BR><BR>+
// Relocate the GDT to reserved memory, so it won't get<BR>clobbered
<BR>+
move_gdt(low_table_end);<BR>+
low_table_end += &gdt_end -
&gdt;<BR>+<BR> /* The
linuxbios table must be in 0-4K or 960K-1M
*/<BR> write_linuxbios_table(<BR> low_table_start,
low_table_end,<BR><BR>------------------------------------------------------------------------<BR>Steven
J.
Magnani
"I claim this network for MARS!<BR><A
href="http://www.digidescorp.com">www.digidescorp.com</A> Earthling,
return my space modulator!"<BR><BR>#include
<standard.disclaimer><BR><BR><BR><BR><BR>--<BR>LinuxBIOS mailing
list<BR><A
href="mailto:LinuxBIOS@openbios.org">LinuxBIOS@openbios.org</A><BR><A
href="http://www.openbios.org/mailman/listinfo/linuxbios">http://www.openbios.org/mailman/listinfo/linuxbios</A><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>