In this line of code in real_to_prot(): DATA32 ADDR32 lgdt %cs:gdtdesc
GAS generates an absolute address for `gdtdesc' (not relative to segment), and so for the code to work %cs must be zero. In current usage of real_to_prot(), %cs is always zero because we jump to 0x0:0x82xx early on. However, in other situations this is not possible. On i386-qemu, before moving to i386 mode the code we're running is in the 0xf0000-0x100000 range, which is inaccessible from segment 0. This patch changes this to access gdtdesc from segment 0 unconditionally. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
2009-06-22 Robert Millan <rmh.g...@aybabtu.com> * kern/i386/pc/startup.S (real_to_prot): Access `gdtdesc' using segment 0x0 unconditionally, because the reference generated by GAS is an absolute address. Index: kern/i386/pc/startup.S =================================================================== --- kern/i386/pc/startup.S (revision 2353) +++ kern/i386/pc/startup.S (working copy) @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -313,13 +313,9 @@ cli /* load the GDT register */ -#ifdef APPLE_CC - mov %cs, %ax - mov %ax, %ds - DATA32 ADDR32 lgdt gdtdesc -#else - DATA32 ADDR32 lgdt %cs:gdtdesc -#endif + xorw %ax, %ax + movw %ax, %ds + DATA32 ADDR32 lgdt %ds:gdtdesc /* turn on protected mode */ movl %cr0, %eax
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel