[2261] 2009-06-04 Vladimir Serbinenko <[email protected]>

Vladimir Serbinenko <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2261
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2261
Author:   phcoder
Date:     2009-06-04 21:21:31 +0000 (Thu, 04 Jun 2009)
Log Message:
-----------
2009-06-04  Vladimir Serbinenko  <[email protected]>

	Address in trampolines based on 32-bit registers when compiled
	with Apple's CC

	* loader/i386/xnu_helper.S [APPLE_CC]: use 32-bit registers 
	for addresses
	* loader/i386/linux_trampoline.S [APPLE_CC]: likewise

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/loader/i386/linux_trampoline.S
    trunk/grub2/loader/i386/xnu_helper.S

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-06-04 21:17:05 UTC (rev 2260)
+++ trunk/grub2/ChangeLog	2009-06-04 21:21:31 UTC (rev 2261)
@@ -1,5 +1,14 @@
 2009-06-04  Vladimir Serbinenko  <[email protected]>
 
+	Address in trampolines based on 32-bit registers when compiled
+	with Apple's CC
+
+	* loader/i386/xnu_helper.S [APPLE_CC]: use 32-bit registers 
+	for addresses
+	* loader/i386/linux_trampoline.S [APPLE_CC]: likewise
+
+2009-06-04  Vladimir Serbinenko  <[email protected]>
+
 	Avoid aliases when compiling with Apple's CC for PCBIOS machine
 
 	* kern/misc.c [APPLE_CC] (memcpy): new function

Modified: trunk/grub2/loader/i386/linux_trampoline.S
===================================================================
--- trunk/grub2/loader/i386/linux_trampoline.S	2009-06-04 21:17:05 UTC (rev 2260)
+++ trunk/grub2/loader/i386/linux_trampoline.S	2009-06-04 21:21:31 UTC (rev 2261)
@@ -30,7 +30,22 @@
 	call base
 base:	
 	pop %rsi
+
+#ifdef APPLE_CC	
+	lea (cont1 - base) (%esi, 1), %rax
+	mov %eax, (jump_vector - base) (%esi, 1)
+
+	lea (gdt - base) (%esi, 1), %rax
+	mov %rax, (gdtaddr - base) (%esi, 1)
 	
+	/* Switch to compatibility mode. */
+
+	lidt (idtdesc - base) (%esi, 1)
+	lgdt (gdtdesc - base) (%esi, 1)
+	
+	/* Update %cs. Thanks to David Miller for pointing this mistake out. */
+	ljmp *(jump_vector - base) (%esi, 1)
+#else
 	lea (cont1 - base) (%rsi, 1), %rax
 	mov %eax, (jump_vector - base) (%rsi, 1)
 
@@ -44,6 +59,8 @@
 	
 	/* Update %cs. Thanks to David Miller for pointing this mistake out. */
 	ljmp *(jump_vector - base) (%rsi, 1)
+#endif
+ 	
 cont1:
 	.code32
 

Modified: trunk/grub2/loader/i386/xnu_helper.S
===================================================================
--- trunk/grub2/loader/i386/xnu_helper.S	2009-06-04 21:17:05 UTC (rev 2260)
+++ trunk/grub2/loader/i386/xnu_helper.S	2009-06-04 21:21:31 UTC (rev 2261)
@@ -94,11 +94,28 @@
 	movsl
 
 	mov %rax, %rsi
+#ifdef APPLE_CC
+	add $(cont0-base), %eax
+#else
 	add $(cont0-base), %rax
+#endif
 	jmp *%rax
 
 cont0:	
+#ifdef APPLE_CC
+	lea (cont1 - base) (%esi, 1), %eax
+	mov %eax, (jump_vector - base) (%esi, 1)
 
+	lea (gdt - base) (%esi, 1), %eax
+	mov %eax, (gdt_addr - base) (%esi, 1)
+	
+	/* Switch to compatibility mode. */
+
+	lgdt (gdtdesc - base) (%esi, 1)
+	
+	/* Update %cs. Thanks to David Miller for pointing this mistake out. */
+	ljmp *(jump_vector - base) (%esi,1)
+#else
 	lea (cont1 - base) (%rsi, 1), %rax
 	mov %eax, (jump_vector - base) (%rsi, 1)
 
@@ -111,6 +128,8 @@
 	
 	/* Update %cs. Thanks to David Miller for pointing this mistake out. */
 	ljmp *(jump_vector - base) (%rsi, 1)
+#endif
+	
 cont1:
 	.code32
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.