Deleted Added
full compact
locore.s (15543) locore.s (15565)
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: @(#)locore.s 7.3 (Berkeley) 5/13/91
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: @(#)locore.s 7.3 (Berkeley) 5/13/91
37 * $Id: locore.s,v 1.68 1996/04/30 11:58:56 phk Exp $
37 * $Id: locore.s,v 1.69 1996/05/02 14:19:43 phk Exp $
38 *
39 * originally from: locore.s, by William F. Jolitz
40 *
41 * Substantially rewritten by David Greenman, Rod Grimes,
42 * Bruce Evans, Wolfgang Solfrank, Poul-Henning Kamp
43 * and many others.
44 */
45

--- 53 unchanged lines hidden (view full) ---

99 ALIGN_DATA /* just to be sure */
100
101 .globl tmpstk
102 .space 0x2000 /* space for tmpstk - temporary stack */
103tmpstk:
104
105 .globl _boothowto,_bootdev
106
38 *
39 * originally from: locore.s, by William F. Jolitz
40 *
41 * Substantially rewritten by David Greenman, Rod Grimes,
42 * Bruce Evans, Wolfgang Solfrank, Poul-Henning Kamp
43 * and many others.
44 */
45

--- 53 unchanged lines hidden (view full) ---

99 ALIGN_DATA /* just to be sure */
100
101 .globl tmpstk
102 .space 0x2000 /* space for tmpstk - temporary stack */
103tmpstk:
104
105 .globl _boothowto,_bootdev
106
107 .globl _cpu,_atdevbase,_cpu_vendor,_cpu_id,_bootinfo
107 .globl _cpu,_cpu_vendor,_cpu_id,_bootinfo
108 .globl _cpu_high, _cpu_feature
109
110_cpu: .long 0 /* are we 386, 386sx, or 486 */
111_cpu_id: .long 0 /* stepping ID */
112_cpu_high: .long 0 /* highest arg to CPUID */
113_cpu_feature: .long 0 /* features */
114_cpu_vendor: .space 20 /* CPU origin code */
115_bootinfo: .space BOOTINFO_SIZE /* bootinfo that we can handle */
108 .globl _cpu_high, _cpu_feature
109
110_cpu: .long 0 /* are we 386, 386sx, or 486 */
111_cpu_id: .long 0 /* stepping ID */
112_cpu_high: .long 0 /* highest arg to CPUID */
113_cpu_feature: .long 0 /* features */
114_cpu_vendor: .space 20 /* CPU origin code */
115_bootinfo: .space BOOTINFO_SIZE /* bootinfo that we can handle */
116_atdevbase: .long 0 /* location of start of iomem in virtual */
117
118_KERNend: .long 0 /* phys addr end of kernel (just after bss) */
119physfree: .long 0 /* phys addr of next free page */
120upa: .long 0 /* phys addr of proc0's UPAGES */
121p0upt: .long 0 /* phys addr of proc0's UPAGES page table */
122
123 .globl _IdlePTD
124_IdlePTD: .long 0 /* phys addr of kernel PTD */

--- 26 unchanged lines hidden (view full) ---

151 movl $((foo)*PAGE_SIZE),%ecx ; \
152 xorl %eax,%eax ; \
153 cld ; \
154 rep ; \
155 stosb
156
157/*
158 * fillkpt
116
117_KERNend: .long 0 /* phys addr end of kernel (just after bss) */
118physfree: .long 0 /* phys addr of next free page */
119upa: .long 0 /* phys addr of proc0's UPAGES */
120p0upt: .long 0 /* phys addr of proc0's UPAGES page table */
121
122 .globl _IdlePTD
123_IdlePTD: .long 0 /* phys addr of kernel PTD */

--- 26 unchanged lines hidden (view full) ---

150 movl $((foo)*PAGE_SIZE),%ecx ; \
151 xorl %eax,%eax ; \
152 cld ; \
153 rep ; \
154 stosb
155
156/*
157 * fillkpt
159 * eax = (page frame address | control | status) == pte
160 * ebx = address of page table
158 * eax = page frame address
159 * ebx = index into page table
161 * ecx = how many pages to map
160 * ecx = how many pages to map
161 * base = base address of page dir/table
162 * prot = protection bits
162 */
163 */
163#define fillkpt \
1641: movl %eax,(%ebx) ; \
165 addl $PAGE_SIZE,%eax ; /* increment physical address */ \
166 addl $4,%ebx ; /* next pte */ \
164#define fillkpt(base, prot) \
165 shll $2, %ebx ; \
166 addl base, %ebx ; \
167 orl $PG_V+prot, %eax ; \
1681: movl %eax,(%ebx) ; \
169 addl $PAGE_SIZE,%eax ; /* increment physical address */ \
170 addl $4,%ebx ; /* next pte */ \
167 loop 1b
168
171 loop 1b
172
173/*
174 * fillkptphys(prot)
175 * eax = physical address
176 * ecx = how many pages to map
177 * prot = protection bits
178 */
179#define fillkptphys(prot) \
180 movl %eax, %ebx ; \
181 shrl $PAGE_SHIFT, %ebx ; \
182 fillkpt(R(_KPTphys), prot)
183
169 .text
170/**********************************************************************
171 *
172 * This is where the bootblocks start us, set the ball rolling...
173 *
174 */
175NON_GPROF_ENTRY(btext)
176

--- 506 unchanged lines hidden (view full) ---

683 je over_symalloc
684 movl %edi,%esi
685 movl $KERNBASE,%edi
686 addl %edi,R(_bootinfo+BI_SYMTAB)
687 addl %edi,R(_bootinfo+BI_ESYMTAB)
688over_symalloc:
689#endif
690
184 .text
185/**********************************************************************
186 *
187 * This is where the bootblocks start us, set the ball rolling...
188 *
189 */
190NON_GPROF_ENTRY(btext)
191

--- 506 unchanged lines hidden (view full) ---

698 je over_symalloc
699 movl %edi,%esi
700 movl $KERNBASE,%edi
701 addl %edi,R(_bootinfo+BI_SYMTAB)
702 addl %edi,R(_bootinfo+BI_ESYMTAB)
703over_symalloc:
704#endif
705
691 addl $PAGE_SIZE-1,%esi
692 andl $~(PAGE_SIZE-1),%esi
706 addl $PAGE_MASK,%esi
707 andl $~PAGE_MASK,%esi
693 movl %esi,R(_KERNend) /* save end of kernel */
694 movl %esi,R(physfree) /* next free page is at end of kernel */
695
696/* Allocate Kernel Page Tables */
697 ALLOCPAGES(NKPT)
698 movl %esi,R(_KPTphys)
699
700/* Allocate Page Table Directory */

--- 6 unchanged lines hidden (view full) ---

707 addl $KERNBASE, %esi
708 movl %esi, R(_proc0paddr)
709
710/* Allocate proc0's page table for the UPAGES. */
711 ALLOCPAGES(1)
712 movl %esi,R(p0upt)
713
714/* Map read-only from zero to the end of the kernel text section */
708 movl %esi,R(_KERNend) /* save end of kernel */
709 movl %esi,R(physfree) /* next free page is at end of kernel */
710
711/* Allocate Kernel Page Tables */
712 ALLOCPAGES(NKPT)
713 movl %esi,R(_KPTphys)
714
715/* Allocate Page Table Directory */

--- 6 unchanged lines hidden (view full) ---

722 addl $KERNBASE, %esi
723 movl %esi, R(_proc0paddr)
724
725/* Allocate proc0's page table for the UPAGES. */
726 ALLOCPAGES(1)
727 movl %esi,R(p0upt)
728
729/* Map read-only from zero to the end of the kernel text section */
715 movl R(_KPTphys), %esi
716 movl $R(_etext),%ecx
717 addl $PAGE_SIZE-1,%ecx
718 shrl $PAGE_SHIFT,%ecx
719 movl $PG_V|PG_KR,%eax
720 movl %esi, %ebx
730 xorl %eax, %eax
721#ifdef BDE_DEBUGGER
722/* If the debugger is present, actually map everything read-write. */
723 cmpl $0,R(_bdb_exists)
724 jne map_read_write
725#endif
731#ifdef BDE_DEBUGGER
732/* If the debugger is present, actually map everything read-write. */
733 cmpl $0,R(_bdb_exists)
734 jne map_read_write
735#endif
726 fillkpt
736 movl $R(_etext),%ecx
737 addl $PAGE_MASK,%ecx
738 shrl $PAGE_SHIFT,%ecx
739 fillkptphys(0)
727
728/* Map read-write, data, bss and symbols */
740
741/* Map read-write, data, bss and symbols */
742 movl $R(_etext),%eax
729map_read_write:
743map_read_write:
730 andl $PG_FRAME,%eax
731 movl R(_KERNend),%ecx
732 subl %eax,%ecx
733 shrl $PAGE_SHIFT,%ecx
744 movl R(_KERNend),%ecx
745 subl %eax,%ecx
746 shrl $PAGE_SHIFT,%ecx
734 orl $PG_V|PG_KW,%eax
735 fillkpt
747 fillkptphys(PG_RW)
736
737/* Map page directory. */
738 movl R(_IdlePTD), %eax
739 movl $1, %ecx
748
749/* Map page directory. */
750 movl R(_IdlePTD), %eax
751 movl $1, %ecx
740 movl %eax, %ebx
741 shrl $PAGE_SHIFT-2, %ebx
742 addl R(_KPTphys), %ebx
743 orl $PG_V|PG_KW, %eax
744 fillkpt
752 fillkptphys(PG_RW)
745
746/* Map proc0's page table for the UPAGES the physical way. */
747 movl R(p0upt), %eax
748 movl $1, %ecx
753
754/* Map proc0's page table for the UPAGES the physical way. */
755 movl R(p0upt), %eax
756 movl $1, %ecx
749 movl %eax, %ebx
750 shrl $PAGE_SHIFT-2, %ebx
751 addl R(_KPTphys), %ebx
752 orl $PG_V|PG_KW, %eax
753 fillkpt
757 fillkptphys(PG_RW)
754
755/* Map proc0s UPAGES the physical way */
756 movl R(upa), %eax
757 movl $UPAGES, %ecx
758
759/* Map proc0s UPAGES the physical way */
760 movl R(upa), %eax
761 movl $UPAGES, %ecx
758 movl %eax, %ebx
759 shrl $PAGE_SHIFT-2, %ebx
760 addl R(_KPTphys), %ebx
761 orl $PG_V|PG_KW, %eax
762 fillkpt
762 fillkptphys(PG_RW)
763
763
764/* ... and in the special page table for this purpose. */
764/* Map ISA hole */
765 movl $ISA_HOLE_START, %eax
766 movl $ISA_HOLE_LENGTH>>PAGE_SHIFT, %ecx
767 fillkptphys(PG_RW|PG_N)
768
769/* Map proc0s UPAGES in the special page table for this purpose. */
765 movl R(upa), %eax
770 movl R(upa), %eax
771 movl $KSTKPTEOFF, %ebx
766 movl $UPAGES, %ecx
772 movl $UPAGES, %ecx
767 orl $PG_V|PG_KW, %eax
768 movl R(p0upt), %ebx
769 addl $(KSTKPTEOFF * PTESIZE), %ebx
770 fillkpt
773 fillkpt(R(p0upt), PG_RW)
771
772/* and put the page table in the pde. */
773 movl R(p0upt), %eax
774
775/* and put the page table in the pde. */
776 movl R(p0upt), %eax
774 movl R(_IdlePTD), %esi
775 orl $PG_V|PG_KW,%eax
776 movl %eax,KSTKPTDI*PDESIZE(%esi)
777 movl $KSTKPTDI, %ebx
778 movl $1, %ecx
779 fillkpt(R(_IdlePTD), PG_RW)
777
780
778/* Map ISA hole */
779#define ISA_HOLE_START 0xa0000
780#define ISA_HOLE_LENGTH (0x100000-ISA_HOLE_START)
781 movl $ISA_HOLE_LENGTH>>PAGE_SHIFT, %ecx
782 movl $ISA_HOLE_START, %eax
783 movl %eax, %ebx
784/* XXX 2 is magic for log2(PTESIZE). */
785 shrl $PAGE_SHIFT-2, %ebx
786 addl R(_KPTphys), %ebx
787/* XXX could load %eax directly with $ISA_HOLE_START|PG_V|PG_KW_PG_N. */
788 orl $PG_V|PG_KW|PG_N, %eax
789 fillkpt
790/* XXX could load %eax directly with $ISA_HOLE_START+KERNBASE. */
791 movl $ISA_HOLE_START, %eax
792 addl $KERNBASE, %eax
793 movl %eax, R(_atdevbase)
794
795/* install a pde for temporary double map of bottom of VA */
781/* install a pde for temporary double map of bottom of VA */
796 movl R(_IdlePTD), %esi
797 movl R(_KPTphys), %eax
782 movl R(_KPTphys), %eax
798 orl $PG_V|PG_KW, %eax
799 movl %eax, (%esi)
783 xorl %ebx, %ebx
784 movl $1, %ecx
785 fillkpt(R(_IdlePTD), PG_RW)
800
801/* install pde's for pt's */
786
787/* install pde's for pt's */
802 movl R(_IdlePTD), %esi
803 movl R(_KPTphys), %eax
788 movl R(_KPTphys), %eax
804 orl $PG_V|PG_KW, %eax
805 movl $(NKPT), %ecx
806 lea (KPTDI*PDESIZE)(%esi), %ebx
807 fillkpt
789 movl $KPTDI, %ebx
790 movl $NKPT, %ecx
791 fillkpt(R(_IdlePTD), PG_RW)
808
809/* install a pde recursively mapping page directory as a page table */
792
793/* install a pde recursively mapping page directory as a page table */
810 movl R(_IdlePTD), %esi
811 movl %esi,%eax
812 orl $PG_V|PG_KW,%eax
813 movl %eax,PTDPTDI*PDESIZE(%esi)
794 movl R(_IdlePTD), %eax
795 movl $PTDPTDI, %ebx
796 movl $1,%ecx
797 fillkpt(R(_IdlePTD), PG_RW)
814
815 ret
816
817#ifdef BDE_DEBUGGER
818bdb_prepare_paging:
819 cmpl $0,R(_bdb_exists)
820 je bdb_prepare_paging_exit
821

--- 74 unchanged lines hidden ---
798
799 ret
800
801#ifdef BDE_DEBUGGER
802bdb_prepare_paging:
803 cmpl $0,R(_bdb_exists)
804 je bdb_prepare_paging_exit
805

--- 74 unchanged lines hidden ---