Module Name:    src
Committed By:   jakllsch
Date:           Sun Dec 19 17:18:23 UTC 2010

Modified Files:
        src/sys/arch/i386/stand/lib: realprot.S

Log Message:
Compute real/protected %sp/%esp offset in 'gdt_fixup' using all 32-bits.
Allows the case of %ss being less than %cs to work.
Also, completely save and restore the general-purpose registers we use.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/lib/realprot.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/lib/realprot.S
diff -u src/sys/arch/i386/stand/lib/realprot.S:1.9 src/sys/arch/i386/stand/lib/realprot.S:1.10
--- src/sys/arch/i386/stand/lib/realprot.S:1.9	Sat Nov 21 11:54:47 2009
+++ src/sys/arch/i386/stand/lib/realprot.S	Sun Dec 19 17:18:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: realprot.S,v 1.9 2009/11/21 11:54:47 dsl Exp $	*/
+/*	$NetBSD: realprot.S,v 1.10 2010/12/19 17:18:23 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -90,18 +90,18 @@
 	.global	gdt_fixup
 gdt_fixup:
 	.code16
-	push	%ax
-	push	%dx
+	pushl	%eax
+	pushl	%edx
 
 	xorl	%eax, %eax
 	mov	%cs, %ax
 	mov	%ax, ourseg
 	/* sort out stuff for %ss != %ds */
+	xorl	%edx, %edx
 	movw	%ss, %dx
 	movw	%dx, stkseg
-	subw	%ax, %dx
-	shll	$16, %edx
-	shrl	$12, %edx
+	subl	%eax, %edx
+	shll	$4, %edx
 	movl	%edx, stkdif
 
 	/* fix up GDT entries for bootstrap */
@@ -121,8 +121,8 @@
 	addl	$gdt, %eax
 	movl	%eax, gdtarg+2
 
-	pop	%dx
-	pop	%ax
+	popl	%edx
+	popl	%eax
 	ret
 
 /*

Reply via email to