aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2003-08-02 14:54:49 +0000
committerBruce Evans <bde@FreeBSD.org>2003-08-02 14:54:49 +0000
commitad3dbee7a166a2a2c51e63d6b1ff3f15850766b4 (patch)
treef9b1e7a33a8a315d093ee19ec272b9ba85adada5
parente81dc827312ff1562e1db3bb907c6e4309f60578 (diff)
downloadsrc-ad3dbee7a166a2a2c51e63d6b1ff3f15850766b4.tar.gz
src-ad3dbee7a166a2a2c51e63d6b1ff3f15850766b4.zip
MFC locore.s 1.172-1.174 (don't hide the name of tmpstk, and clear the
bss properly) with adjustments for RELENG_3. The adjustments are the same as for RELENG_4. This is part of some making RELENG_3 kernels work when compiled by gcc-3.3. Fixing bss clearing and ATOMIC_ASM constrains are the only nontrivial parts.
Notes
Notes: svn path=/stable/3/; revision=118359
-rw-r--r--sys/i386/i386/locore.s51
-rw-r--r--sys/i386/i386/swtch.s2
2 files changed, 25 insertions, 28 deletions
diff --git a/sys/i386/i386/locore.s b/sys/i386/i386/locore.s
index e4a08081db55..c365e35cc282 100644
--- a/sys/i386/i386/locore.s
+++ b/sys/i386/i386/locore.s
@@ -93,9 +93,9 @@
.data
ALIGN_DATA /* just to be sure */
- .globl HIDENAME(tmpstk)
+ .globl tmpstk
.space 0x2000 /* space for tmpstk - temporary stack */
-HIDENAME(tmpstk):
+tmpstk:
.globl _boothowto,_bootdev
@@ -248,6 +248,27 @@ NON_GPROF_ENTRY(btext)
mov %ax, %fs
mov %ax, %gs
+/*
+ * Clear the bss. Not all boot programs do it, and it is our job anyway.
+ *
+ * XXX we don't check that there is memory for our bss and page tables
+ * before using it.
+ *
+ * Note: we must be careful to not overwrite an active gdt or idt. In
+ * the !BDE_DEBUGGER case they are inactive from now until we switch to
+ * new ones, since we don't load any more segment registers or permit
+ * interrupts until after the switch. In the BDE_DEBUGGER case, we depend
+ * on the convention that the boot program is below 1MB and we are above
+ * 1MB to keep the gdt and idt away from the bss and page tables.
+ */
+ movl $R(_end),%ecx
+ movl $R(_edata),%edi
+ subl %edi,%ecx
+ xorl %eax,%eax
+ cld
+ rep
+ stosb
+
call recover_bootinfo
/* Get onto a stack that we can trust. */
@@ -256,7 +277,7 @@ NON_GPROF_ENTRY(btext)
* the old stack, but it need not be, since recover_bootinfo actually
* returns via the old frame.
*/
- movl $R(HIDENAME(tmpstk)),%esp
+ movl $R(tmpstk),%esp
#ifdef PC98
/* pc98_machine_type & M_EPSON_PC98 */
@@ -287,30 +308,6 @@ NON_GPROF_ENTRY(btext)
call identify_cpu
-/* clear bss */
-/*
- * XXX this should be done a little earlier.
- *
- * XXX we don't check that there is memory for our bss and page tables
- * before using it.
- *
- * XXX the boot program somewhat bogusly clears the bss. We still have
- * to do it in case we were unzipped by kzipboot. Then the boot program
- * only clears kzipboot's bss.
- *
- * XXX the gdt and idt are still somewhere in the boot program. We
- * depend on the convention that the boot program is below 1MB and we
- * are above 1MB to keep the gdt and idt away from the bss and page
- * tables. The idt is only used if BDE_DEBUGGER is enabled.
- */
- movl $R(_end),%ecx
- movl $R(_edata),%edi
- subl %edi,%ecx
- xorl %eax,%eax
- cld
- rep
- stosb
-
#if NAPM > 0
#ifndef VM86
/*
diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s
index 81e0a3660c10..ab09d70844cd 100644
--- a/sys/i386/i386/swtch.s
+++ b/sys/i386/i386/swtch.s
@@ -376,7 +376,7 @@ idle_loop:
#else /* !SMP */
- movl $HIDENAME(tmpstk),%esp
+ movl $tmpstk,%esp
#if defined(OVERLY_CONSERVATIVE_PTD_MGMT)
#if defined(SWTCH_OPTIM_STATS)
incl _swtch_optim_stats