pmap.c (cf4b29e405024c5d1262891c4b8e7206d15a6385) pmap.c (5931a9c24e798d31c4389671b8c8431911b18c5d)
1/*
2 * Copyright (c) 1991 Regents of the University of California.
3 * All rights reserved.
4 * Copyright (c) 1994 John S. Dyson
5 * All rights reserved.
6 * Copyright (c) 1994 David Greenman
7 * All rights reserved.
8 *

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

34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 *
41 * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
1/*
2 * Copyright (c) 1991 Regents of the University of California.
3 * All rights reserved.
4 * Copyright (c) 1994 John S. Dyson
5 * All rights reserved.
6 * Copyright (c) 1994 David Greenman
7 * All rights reserved.
8 *

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

34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 *
41 * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
42 * $Id: pmap.c,v 1.197 1998/05/15 07:25:25 dyson Exp $
42 * $Id: pmap.c,v 1.198 1998/05/17 17:43:13 tegge Exp $
43 */
44
45/*
46 * Manages physical address maps.
47 *
48 * In addition to hardware address maps, this
49 * module is called upon to provide software-use-only
50 * maps which may or may not be stored in the same

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

185
186#ifdef SMP
187extern char prv_CPAGE1[], prv_CPAGE2[], prv_CPAGE3[];
188extern pt_entry_t *prv_CMAP1, *prv_CMAP2, *prv_CMAP3;
189extern pd_entry_t *IdlePTDS[];
190extern pt_entry_t SMP_prvpt[];
191#endif
192
43 */
44
45/*
46 * Manages physical address maps.
47 *
48 * In addition to hardware address maps, this
49 * module is called upon to provide software-use-only
50 * maps which may or may not be stored in the same

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

185
186#ifdef SMP
187extern char prv_CPAGE1[], prv_CPAGE2[], prv_CPAGE3[];
188extern pt_entry_t *prv_CMAP1, *prv_CMAP2, *prv_CMAP3;
189extern pd_entry_t *IdlePTDS[];
190extern pt_entry_t SMP_prvpt[];
191#endif
192
193#ifdef SMP
194extern unsigned int prv_PPAGE1[];
195extern pt_entry_t *prv_PMAP1;
196#else
193static pt_entry_t *PMAP1 = 0;
194static unsigned *PADDR1 = 0;
197static pt_entry_t *PMAP1 = 0;
198static unsigned *PADDR1 = 0;
199#endif
195
196static PMAP_INLINE void free_pv_entry __P((pv_entry_t pv));
197static unsigned * get_ptbase __P((pmap_t pmap));
198static pv_entry_t get_pv_entry __P((void));
199static void i386_protection_init __P((void));
200static void pmap_changebit __P((vm_offset_t pa, int bit, boolean_t setem));
201
202static PMAP_INLINE int pmap_is_managed __P((vm_offset_t pa));

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

342
343 /*
344 * msgbufp is used to map the system message buffer.
345 * XXX msgbufmap is not used.
346 */
347 SYSMAP(struct msgbuf *, msgbufmap, msgbufp,
348 atop(round_page(sizeof(struct msgbuf))))
349
200
201static PMAP_INLINE void free_pv_entry __P((pv_entry_t pv));
202static unsigned * get_ptbase __P((pmap_t pmap));
203static pv_entry_t get_pv_entry __P((void));
204static void i386_protection_init __P((void));
205static void pmap_changebit __P((vm_offset_t pa, int bit, boolean_t setem));
206
207static PMAP_INLINE int pmap_is_managed __P((vm_offset_t pa));

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

347
348 /*
349 * msgbufp is used to map the system message buffer.
350 * XXX msgbufmap is not used.
351 */
352 SYSMAP(struct msgbuf *, msgbufmap, msgbufp,
353 atop(round_page(sizeof(struct msgbuf))))
354
355#if !defined(SMP)
350 /*
351 * ptemap is used for pmap_pte_quick
352 */
353 SYSMAP(unsigned *, PMAP1, PADDR1, 1);
356 /*
357 * ptemap is used for pmap_pte_quick
358 */
359 SYSMAP(unsigned *, PMAP1, PADDR1, 1);
360#endif
354
355 virtual_avail = va;
356
357 *(int *) CMAP1 = *(int *) CMAP2 = 0;
358 *(int *) PTD = 0;
359
360
361 pgeflag = 0;

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

433 if (j == 16)
434 panic("no space to map IO apic %d!", i);
435 }
436
437 /* BSP does this itself, AP's get it pre-set */
438 prv_CMAP1 = &SMP_prvpt[3 + UPAGES];
439 prv_CMAP2 = &SMP_prvpt[4 + UPAGES];
440 prv_CMAP3 = &SMP_prvpt[5 + UPAGES];
361
362 virtual_avail = va;
363
364 *(int *) CMAP1 = *(int *) CMAP2 = 0;
365 *(int *) PTD = 0;
366
367
368 pgeflag = 0;

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

440 if (j == 16)
441 panic("no space to map IO apic %d!", i);
442 }
443
444 /* BSP does this itself, AP's get it pre-set */
445 prv_CMAP1 = &SMP_prvpt[3 + UPAGES];
446 prv_CMAP2 = &SMP_prvpt[4 + UPAGES];
447 prv_CMAP3 = &SMP_prvpt[5 + UPAGES];
448 prv_PMAP1 = &SMP_prvpt[6 + UPAGES];
441#endif
442
443 invltlb();
444
445}
446
447void
448getmtrr()

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

730
731 /* are we current address space or kernel? */
732 if (pmap == kernel_pmap || frame == (((unsigned) PTDpde) & PG_FRAME)) {
733 return (unsigned *) PTmap;
734 }
735 /* otherwise, we are alternate address space */
736 if (frame != (((unsigned) APTDpde) & PG_FRAME)) {
737 APTDpde = (pd_entry_t) (frame | PG_RW | PG_V);
449#endif
450
451 invltlb();
452
453}
454
455void
456getmtrr()

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

738
739 /* are we current address space or kernel? */
740 if (pmap == kernel_pmap || frame == (((unsigned) PTDpde) & PG_FRAME)) {
741 return (unsigned *) PTmap;
742 }
743 /* otherwise, we are alternate address space */
744 if (frame != (((unsigned) APTDpde) & PG_FRAME)) {
745 APTDpde = (pd_entry_t) (frame | PG_RW | PG_V);
746#if defined(SMP)
747 /* The page directory is not shared between CPUs */
748 cpu_invltlb();
749#else
738 invltlb();
750 invltlb();
751#endif
739 }
740 return (unsigned *) APTmap;
741}
742
743/*
744 * Super fast pmap_pte routine best used when scanning
745 * the pv lists. This eliminates many coarse-grained
746 * invltlb calls. Note that many of the pv list

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

758 unsigned frame = (unsigned) pmap->pm_pdir[PTDPTDI] & PG_FRAME;
759 unsigned index = i386_btop(va);
760 /* are we current address space or kernel? */
761 if ((pmap == kernel_pmap) ||
762 (frame == (((unsigned) PTDpde) & PG_FRAME))) {
763 return (unsigned *) PTmap + index;
764 }
765 newpf = pde & PG_FRAME;
752 }
753 return (unsigned *) APTmap;
754}
755
756/*
757 * Super fast pmap_pte routine best used when scanning
758 * the pv lists. This eliminates many coarse-grained
759 * invltlb calls. Note that many of the pv list

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

771 unsigned frame = (unsigned) pmap->pm_pdir[PTDPTDI] & PG_FRAME;
772 unsigned index = i386_btop(va);
773 /* are we current address space or kernel? */
774 if ((pmap == kernel_pmap) ||
775 (frame == (((unsigned) PTDpde) & PG_FRAME))) {
776 return (unsigned *) PTmap + index;
777 }
778 newpf = pde & PG_FRAME;
779#ifdef SMP
780 if ( ((* (unsigned *) prv_PMAP1) & PG_FRAME) != newpf) {
781 * (unsigned *) prv_PMAP1 = newpf | PG_RW | PG_V;
782 cpu_invlpg(&prv_PPAGE1);
783 }
784 return prv_PPAGE1 + ((unsigned) index & (NPTEPG - 1));
785#else
766 if ( ((* (unsigned *) PMAP1) & PG_FRAME) != newpf) {
767 * (unsigned *) PMAP1 = newpf | PG_RW | PG_V;
768 invltlb_1pg((vm_offset_t) PADDR1);
769 }
770 return PADDR1 + ((unsigned) index & (NPTEPG - 1));
786 if ( ((* (unsigned *) PMAP1) & PG_FRAME) != newpf) {
787 * (unsigned *) PMAP1 = newpf | PG_RW | PG_V;
788 invltlb_1pg((vm_offset_t) PADDR1);
789 }
790 return PADDR1 + ((unsigned) index & (NPTEPG - 1));
791#endif
771 }
772 return (0);
773}
774
775/*
776 * Routine: pmap_extract
777 * Function:
778 * Extract the physical page address associated

--- 2724 unchanged lines hidden ---
792 }
793 return (0);
794}
795
796/*
797 * Routine: pmap_extract
798 * Function:
799 * Extract the physical page address associated

--- 2724 unchanged lines hidden ---