diff options
author | dg <dg@FreeBSD.org> | 1994-10-25 07:25:56 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1994-10-25 07:25:56 +0000 |
commit | 44d8a340c6b55e2586c2e909816eefecfd173bef (patch) | |
tree | b72b6db5f02d1a197e5219c660f05a02c1c70740 | |
parent | 2837d58a98db4b488a7e8c8c01db377bccc31278 (diff) | |
download | FreeBSD-src-44d8a340c6b55e2586c2e909816eefecfd173bef.zip FreeBSD-src-44d8a340c6b55e2586c2e909816eefecfd173bef.tar.gz |
Moved initialization of tmpstk so that it immediately follows the kernel
text. Fixed rounding bug that caused the last page of kernel text to be
read/write instead of read-only. This is important now that tmpstk can
crash into it. Removed +4 bias of tmpstk because it screws up ddb's
ability to traceback correctly.
-rw-r--r-- | sys/amd64/amd64/cpu_switch.S | 4 | ||||
-rw-r--r-- | sys/amd64/amd64/locore.S | 20 | ||||
-rw-r--r-- | sys/amd64/amd64/locore.s | 20 | ||||
-rw-r--r-- | sys/amd64/amd64/swtch.s | 4 | ||||
-rw-r--r-- | sys/i386/i386/locore.s | 20 | ||||
-rw-r--r-- | sys/i386/i386/swtch.s | 4 |
6 files changed, 51 insertions, 21 deletions
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S index ab40500..0531490 100644 --- a/sys/amd64/amd64/cpu_switch.S +++ b/sys/amd64/amd64/cpu_switch.S @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: swtch.s,v 1.14 1994/10/01 02:56:03 davidg Exp $ + * $Id: swtch.s,v 1.15 1994/10/02 04:45:35 davidg Exp $ */ #include "npx.h" /* for NNPX */ @@ -490,7 +490,7 @@ ENTRY(swtch_to_inactive) movl _IdlePTD,%ecx movl %ecx,%cr3 /* good bye address space */ #write buffer? - movl $tmpstk-4,%esp /* temporary stack, compensated for call */ + movl $tmpstk,%esp /* temporary stack, compensated for call */ MEXITCOUNT jmp %edx /* return, execute remainder of cleanup */ diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index 6d539ba..14a5238 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 - * $Id: locore.s,v 1.37 1994/10/20 00:07:47 phk Exp $ + * $Id: locore.s,v 1.38 1994/10/22 17:51:46 phk Exp $ */ /* @@ -103,6 +103,11 @@ */ .data + .globl tmpstk + .space 0x1000 /* space for tmpstk - temporary stack */ +tmpstk: + .long 0 /* for debugging tmpstk stack underflow */ + .globl _boothowto,_bootdev,_curpcb .globl _cpu,_cold,_atdevbase,_cpu_vendor,_cpu_id @@ -140,10 +145,6 @@ _apm_current_gdt_pdesc: _bootstrap_gdt: .space SIZEOF_GDT * BOOTSTRAP_GDT_NUM #endif /* NAPM */ - .globl tmpstk - .space 0x1000 -tmpstk: - /* * System Initialization @@ -566,8 +567,17 @@ NON_GPROF_ENTRY(btext) #else /* !KGDB && !BDE_DEBUGGER */ /* write protect kernel text (doesn't do a thing for 386's - only 486's) */ movl $_etext-KERNBASE,%ecx /* get size of text */ + addl $NBPG-1,%ecx /* round up to page */ shrl $PGSHIFT,%ecx /* for this many PTEs */ movl $PG_V|PG_KR,%eax /* specify read only */ +#if 0 + movl $_etext,%ecx /* get size of text */ + subl $_btext,%ecx + addl $NBPG-1,%ecx /* round up to page */ + shrl $PGSHIFT,%ecx /* for this many PTEs */ + movl $_btext-KERNBASE,%eax /* get offset to physical memory */ + orl $PG_V|PG_KR,%eax /* specify read only */ +#endif lea ((1+UPAGES+1)*NBPG)(%esi),%ebx /* phys addr of kernel PT base */ movl %ebx,_KPTphys-KERNBASE /* save in global */ fillkpt diff --git a/sys/amd64/amd64/locore.s b/sys/amd64/amd64/locore.s index 6d539ba..14a5238 100644 --- a/sys/amd64/amd64/locore.s +++ b/sys/amd64/amd64/locore.s @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 - * $Id: locore.s,v 1.37 1994/10/20 00:07:47 phk Exp $ + * $Id: locore.s,v 1.38 1994/10/22 17:51:46 phk Exp $ */ /* @@ -103,6 +103,11 @@ */ .data + .globl tmpstk + .space 0x1000 /* space for tmpstk - temporary stack */ +tmpstk: + .long 0 /* for debugging tmpstk stack underflow */ + .globl _boothowto,_bootdev,_curpcb .globl _cpu,_cold,_atdevbase,_cpu_vendor,_cpu_id @@ -140,10 +145,6 @@ _apm_current_gdt_pdesc: _bootstrap_gdt: .space SIZEOF_GDT * BOOTSTRAP_GDT_NUM #endif /* NAPM */ - .globl tmpstk - .space 0x1000 -tmpstk: - /* * System Initialization @@ -566,8 +567,17 @@ NON_GPROF_ENTRY(btext) #else /* !KGDB && !BDE_DEBUGGER */ /* write protect kernel text (doesn't do a thing for 386's - only 486's) */ movl $_etext-KERNBASE,%ecx /* get size of text */ + addl $NBPG-1,%ecx /* round up to page */ shrl $PGSHIFT,%ecx /* for this many PTEs */ movl $PG_V|PG_KR,%eax /* specify read only */ +#if 0 + movl $_etext,%ecx /* get size of text */ + subl $_btext,%ecx + addl $NBPG-1,%ecx /* round up to page */ + shrl $PGSHIFT,%ecx /* for this many PTEs */ + movl $_btext-KERNBASE,%eax /* get offset to physical memory */ + orl $PG_V|PG_KR,%eax /* specify read only */ +#endif lea ((1+UPAGES+1)*NBPG)(%esi),%ebx /* phys addr of kernel PT base */ movl %ebx,_KPTphys-KERNBASE /* save in global */ fillkpt diff --git a/sys/amd64/amd64/swtch.s b/sys/amd64/amd64/swtch.s index ab40500..0531490 100644 --- a/sys/amd64/amd64/swtch.s +++ b/sys/amd64/amd64/swtch.s @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: swtch.s,v 1.14 1994/10/01 02:56:03 davidg Exp $ + * $Id: swtch.s,v 1.15 1994/10/02 04:45:35 davidg Exp $ */ #include "npx.h" /* for NNPX */ @@ -490,7 +490,7 @@ ENTRY(swtch_to_inactive) movl _IdlePTD,%ecx movl %ecx,%cr3 /* good bye address space */ #write buffer? - movl $tmpstk-4,%esp /* temporary stack, compensated for call */ + movl $tmpstk,%esp /* temporary stack, compensated for call */ MEXITCOUNT jmp %edx /* return, execute remainder of cleanup */ diff --git a/sys/i386/i386/locore.s b/sys/i386/i386/locore.s index 6d539ba..14a5238 100644 --- a/sys/i386/i386/locore.s +++ b/sys/i386/i386/locore.s @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 - * $Id: locore.s,v 1.37 1994/10/20 00:07:47 phk Exp $ + * $Id: locore.s,v 1.38 1994/10/22 17:51:46 phk Exp $ */ /* @@ -103,6 +103,11 @@ */ .data + .globl tmpstk + .space 0x1000 /* space for tmpstk - temporary stack */ +tmpstk: + .long 0 /* for debugging tmpstk stack underflow */ + .globl _boothowto,_bootdev,_curpcb .globl _cpu,_cold,_atdevbase,_cpu_vendor,_cpu_id @@ -140,10 +145,6 @@ _apm_current_gdt_pdesc: _bootstrap_gdt: .space SIZEOF_GDT * BOOTSTRAP_GDT_NUM #endif /* NAPM */ - .globl tmpstk - .space 0x1000 -tmpstk: - /* * System Initialization @@ -566,8 +567,17 @@ NON_GPROF_ENTRY(btext) #else /* !KGDB && !BDE_DEBUGGER */ /* write protect kernel text (doesn't do a thing for 386's - only 486's) */ movl $_etext-KERNBASE,%ecx /* get size of text */ + addl $NBPG-1,%ecx /* round up to page */ shrl $PGSHIFT,%ecx /* for this many PTEs */ movl $PG_V|PG_KR,%eax /* specify read only */ +#if 0 + movl $_etext,%ecx /* get size of text */ + subl $_btext,%ecx + addl $NBPG-1,%ecx /* round up to page */ + shrl $PGSHIFT,%ecx /* for this many PTEs */ + movl $_btext-KERNBASE,%eax /* get offset to physical memory */ + orl $PG_V|PG_KR,%eax /* specify read only */ +#endif lea ((1+UPAGES+1)*NBPG)(%esi),%ebx /* phys addr of kernel PT base */ movl %ebx,_KPTphys-KERNBASE /* save in global */ fillkpt diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s index ab40500..0531490 100644 --- a/sys/i386/i386/swtch.s +++ b/sys/i386/i386/swtch.s @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: swtch.s,v 1.14 1994/10/01 02:56:03 davidg Exp $ + * $Id: swtch.s,v 1.15 1994/10/02 04:45:35 davidg Exp $ */ #include "npx.h" /* for NNPX */ @@ -490,7 +490,7 @@ ENTRY(swtch_to_inactive) movl _IdlePTD,%ecx movl %ecx,%cr3 /* good bye address space */ #write buffer? - movl $tmpstk-4,%esp /* temporary stack, compensated for call */ + movl $tmpstk,%esp /* temporary stack, compensated for call */ MEXITCOUNT jmp %edx /* return, execute remainder of cleanup */ |