diff options
Diffstat (limited to 'sys/powerpc/include')
-rw-r--r-- | sys/powerpc/include/md_var.h | 3 | ||||
-rw-r--r-- | sys/powerpc/include/param.h | 6 | ||||
-rw-r--r-- | sys/powerpc/include/pmap.h | 118 | ||||
-rw-r--r-- | sys/powerpc/include/pte.h | 12 | ||||
-rw-r--r-- | sys/powerpc/include/sr.h | 44 |
5 files changed, 96 insertions, 87 deletions
diff --git a/sys/powerpc/include/md_var.h b/sys/powerpc/include/md_var.h index 6aeb26c..75640e4 100644 --- a/sys/powerpc/include/md_var.h +++ b/sys/powerpc/include/md_var.h @@ -39,6 +39,9 @@ extern int szsigcode; extern int Maxmem; extern int busdma_swi_pending; +extern vm_offset_t kstack0; +extern vm_offset_t kstack0_phys; + struct fpreg; struct proc; struct reg; diff --git a/sys/powerpc/include/param.h b/sys/powerpc/include/param.h index 3ac5646..6060f89 100644 --- a/sys/powerpc/include/param.h +++ b/sys/powerpc/include/param.h @@ -42,6 +42,8 @@ * Machine dependent constants for PowerPC (32-bit only currently) */ +#include <machine/pte.h> + /* * Round p (pointer or byte index) up to a correctly-aligned value * for all data types (int, long, ...). The result is unsigned int @@ -113,7 +115,8 @@ #define MAXDUMPPGS (DFLTPHYS/PAGE_SIZE) #ifndef KSTACK_UPAGES -#define KSTACK_PAGES 2 /* includes pcb */ +#define KSTACK_PAGES 2 /* includes pcb */ +#define KSTACK_GUARD_PAGES 1 #endif #define USPACE (KSTACK_PAGES * PAGE_SIZE) /* total size of pcb */ #define UAREA_PAGES 1 /* holds struct user WITHOUT PCB */ @@ -179,6 +182,7 @@ /* XXX: NetBSD defines that we're using for the moment */ #define USER_SR 13 #define KERNEL_SR 14 +#define KERNEL_VSIDBITS 0xfffff #define KERNEL_SEGMENT (0xfffff0 + KERNEL_SR) #define EMPTY_SEGMENT 0xfffff0 #define USER_ADDR ((void *)(USER_SR << ADDR_SR_SHFT)) diff --git a/sys/powerpc/include/pmap.h b/sys/powerpc/include/pmap.h index ce744d9..080c5a3 100644 --- a/sys/powerpc/include/pmap.h +++ b/sys/powerpc/include/pmap.h @@ -35,102 +35,52 @@ #ifndef _MACHINE_PMAP_H_ #define _MACHINE_PMAP_H_ -#include <machine/pte.h> - -/* - * Segment registers - */ -#ifndef LOCORE -typedef u_int sr_t; -#endif /* LOCORE */ -#define SR_TYPE 0x80000000 -#define SR_SUKEY 0x40000000 -#define SR_PRKEY 0x20000000 -#define SR_VSID 0x00ffffff - -#ifndef LOCORE - -struct pv_entry { - struct pv_entry *pv_next; /* Linked list of mappings */ - int pv_idx; /* Index into ptable */ - vm_offset_t pv_va; /* virtual address of mapping */ +#include <machine/sr.h> + +struct pmap { + u_int pm_sr[16]; + u_int pm_active; + u_int pm_context; + u_int pm_count; + struct pmap_statistics pm_stats; }; -struct md_page { - int pv_list_count; - int pv_flags; - TAILQ_HEAD(,pv_entry) pv_list; -}; +typedef struct pmap *pmap_t; -/* - * Pmap stuff - */ -struct pmap { - sr_t pm_sr[16]; /* segments used in this pmap */ - int pm_refs; /* ref count */ - struct pmap_statistics pm_stats; /* pmap statistics */ +struct pvo_entry { + LIST_ENTRY(pvo_entry) pvo_vlink; /* Link to common virt page */ + LIST_ENTRY(pvo_entry) pvo_olink; /* Link to overflow entry */ + struct pte pvo_pte; /* PTE */ + pmap_t pvo_pmap; /* Owning pmap */ + vm_offset_t pvo_vaddr; /* VA of entry */ }; +LIST_HEAD(pvo_head, pvo_entry); -typedef struct pmap *pmap_t; - -typedef struct pv_entry *pv_entry_t; +struct md_page { + u_int mdpg_attrs; + struct pvo_head mdpg_pvoh; +}; -#ifdef _KERNEL +extern struct pmap kernel_pmap_store; +#define kernel_pmap (&kernel_pmap_store) -#define pmap_clear_modify(pg) (ptemodify((pg), PTE_CHG, 0)) -#define pmap_clear_reference(pg) (ptemodify((pg), PTE_REF, 0)) -#define pmap_is_modified(pg) (ptebits((pg), PTE_CHG)) -#define pmap_is_referenced(pg) (ptebits((pg), PTE_REF)) -#define pmap_unwire(pm, va) +#define pmap_resident_count(pm) (pm->pm_stats.resident_count) -#define pmap_phys_address(x) (x) +#ifdef _KERNEL -#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) +void pmap_bootstrap(vm_offset_t, vm_offset_t); +vm_offset_t pmap_kextract(vm_offset_t); -extern pmap_t kernel_pmap; +int pmap_pte_spill(vm_offset_t); -extern vm_offset_t avail_end; -extern vm_offset_t avail_start; -extern vm_offset_t phys_avail[]; -extern vm_offset_t virtual_avail; -extern vm_offset_t virtual_end; +extern vm_offset_t avail_start; +extern vm_offset_t avail_end; +extern vm_offset_t phys_avail[]; +extern vm_offset_t virtual_avail; +extern vm_offset_t virtual_end; -void pmap_bootstrap __P((void)); -void *pmap_mapdev __P((vm_offset_t, vm_size_t)); -void pmap_setavailmem __P((u_int kernelstart, u_int kernelend)); -vm_offset_t pmap_steal_memory __P((vm_size_t)); -boolean_t ptemodify __P((struct vm_page *, u_int, u_int)); -int ptebits __P((struct vm_page *, int)); +extern vm_offset_t msgbuf_phys; -#if 0 -#define PMAP_NEED_PROCWR -void pmap_procwr __P((struct proc *, vaddr_t, size_t)); #endif -/* - * Alternate mapping hooks for pool pages. Avoids thrashing the TLB. - * - * Note: This won't work if we have more memory than can be direct-mapped - * VA==PA all at once. But pmap_copy_page() and pmap_zero_page() will have - * this problem, too. - */ -#define PMAP_MAP_POOLPAGE(pa) (pa) -#define PMAP_UNMAP_POOLPAGE(pa) (pa) - -#define vtophys(va) pmap_kextract(((vm_offset_t) (va))) - -extern pte_t PTmap[]; - -#define vtopte(x) (PTmap + powerpc_btop(x)) - -static __inline vm_offset_t -pmap_kextract(vm_offset_t va) -{ - /* XXX: coming soon... */ - return (0); -} - -#endif /* _KERNEL */ -#endif /* LOCORE */ - -#endif /* _MACHINE_PMAP_H_ */ +#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/powerpc/include/pte.h b/sys/powerpc/include/pte.h index 3d1ddcf..38e9a07 100644 --- a/sys/powerpc/include/pte.h +++ b/sys/powerpc/include/pte.h @@ -45,6 +45,10 @@ struct pte { u_int pte_hi; u_int pte_lo; }; + +struct pteg { + struct pte pt[8]; +}; #endif /* LOCORE */ /* High word: */ #define PTE_VALID 0x80000000 @@ -61,8 +65,12 @@ struct pte { #define PTE_M 0x00000010 #define PTE_G 0x00000008 #define PTE_PP 0x00000003 -#define PTE_RO 0x00000003 -#define PTE_RW 0x00000002 +#define PTE_SO 0x00000000 /* Super. Only (U: XX, S: RW) */ +#define PTE_SW 0x00000001 /* Super. Write-Only (U: RO, S: RW) */ +#define PTE_BW 0x00000002 /* Supervisor (U: RW, S: RW) */ +#define PTE_BR 0x00000003 /* Both Read Only (U: RO, S: RO) */ +#define PTE_RW PTE_BW +#define PTE_RO PTE_BR #ifndef LOCORE typedef struct pte pte_t; diff --git a/sys/powerpc/include/sr.h b/sys/powerpc/include/sr.h new file mode 100644 index 0000000..e87c76a --- /dev/null +++ b/sys/powerpc/include/sr.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2002 Benno Rice. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_SR_H_ +#define _MACHINE_SR_H_ + +/* + * Bit definitions for segment registers. + * + * PowerPC Microprocessor Family: The Programming Environments for 32-bit + * Microprocessors, section 2.3.5 + */ + +#define SR_TYPE 0x80000000 /* Type selector */ +#define SR_KS 0x40000000 /* Supervisor-state protection key */ +#define SR_KP 0x20000000 /* User-state protection key */ +#define SR_N 0x10000000 /* No-execute protection */ +#define SR_VSID_MASK 0x00ffffff /* Virtual Segment ID mask */ + +#endif /* !_MACHINE_SR_H_ */ |