Search
lxdream.org :: lxdream/src/sh4/mmu.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/mmu.h
changeset 931:430048ea8b71
next939:6f2302afeb89
author nkeynes
date Sat Dec 27 03:14:59 2008 +0000 (15 years ago)
branchlxdream-mem
permissions -rw-r--r--
last change Update sh4x86 to take advantage of SR assumptions. nice 2% there :)
view annotate diff log raw
     1 /**
     2  * $Id$
     3  *
     4  * MMU/TLB definitions.
     5  *
     6  * Copyright (c) 2005 Nathan Keynes.
     7  *
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  */
    20 #ifndef lxdream_sh4_mmu_H
    21 #define lxdream_sh4_mmu_H 1
    23 #include "lxdream.h"
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    29 #define VMA_TO_EXT_ADDR(vma) ((vma)&0x1FFFFFFF)
    31 /************************** UTLB/ITLB Definitions ***************************/
    32 #define ITLB_ENTRY_COUNT 4
    33 #define UTLB_ENTRY_COUNT 64
    35 /* Entry address */
    36 #define TLB_VALID     0x00000100
    37 #define TLB_USERMODE  0x00000040
    38 #define TLB_WRITABLE  0x00000020
    39 #define TLB_USERWRITABLE (TLB_WRITABLE|TLB_USERMODE)
    40 #define TLB_SIZE_MASK 0x00000090
    41 #define TLB_SIZE_1K   0x00000000
    42 #define TLB_SIZE_4K   0x00000010
    43 #define TLB_SIZE_64K  0x00000080
    44 #define TLB_SIZE_1M   0x00000090
    45 #define TLB_CACHEABLE 0x00000008
    46 #define TLB_DIRTY     0x00000004
    47 #define TLB_SHARE     0x00000002
    48 #define TLB_WRITETHRU 0x00000001
    50 #define MASK_1K  0xFFFFFC00
    51 #define MASK_4K  0xFFFFF000
    52 #define MASK_64K 0xFFFF0000
    53 #define MASK_1M  0xFFF00000
    55 struct itlb_entry {
    56     sh4addr_t vpn; // Virtual Page Number
    57     uint32_t asid; // Process ID
    58     uint32_t mask;
    59     sh4addr_t ppn; // Physical Page Number
    60     uint32_t flags;
    61 };
    63 struct utlb_entry {
    64     sh4addr_t vpn; // Virtual Page Number
    65     uint32_t mask; // Page size mask
    66     uint32_t asid; // Process ID
    67     sh4addr_t ppn; // Physical Page Number
    68     uint32_t flags;
    69     uint32_t pcmcia; // extra pcmcia data - not used
    70 };
    72 struct utlb_sort_entry {
    73     sh4addr_t key; // Masked VPN + ASID
    74     uint32_t mask; // Mask + 0x00FF
    75     int entryNo;
    76 };
    78 #ifdef __cplusplus
    79 }
    80 #endif
    81 #endif /* !lxdream_sh4_mmu_H */
.