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 Tue Dec 23 05:48:05 2008 +0000 (12 years ago)
branchlxdream-mem
permissions -rw-r--r--
last change More refactoring and general cleanup. Most things should be working again now.
Split off cache and start real implementation, breaking save states in the process
file annotate diff log raw
nkeynes@931
     1
/**
nkeynes@931
     2
 * $Id$
nkeynes@931
     3
 *
nkeynes@931
     4
 * MMU/TLB definitions.
nkeynes@931
     5
 *
nkeynes@931
     6
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@931
     7
 *
nkeynes@931
     8
 * This program is free software; you can redistribute it and/or modify
nkeynes@931
     9
 * it under the terms of the GNU General Public License as published by
nkeynes@931
    10
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@931
    11
 * (at your option) any later version.
nkeynes@931
    12
 *
nkeynes@931
    13
 * This program is distributed in the hope that it will be useful,
nkeynes@931
    14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@931
    15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@931
    16
 * GNU General Public License for more details.
nkeynes@931
    17
 */
nkeynes@931
    18
nkeynes@931
    19
nkeynes@931
    20
#ifndef lxdream_sh4_mmu_H
nkeynes@931
    21
#define lxdream_sh4_mmu_H 1
nkeynes@931
    22
nkeynes@931
    23
#include "lxdream.h"
nkeynes@931
    24
nkeynes@931
    25
#ifdef __cplusplus
nkeynes@931
    26
extern "C" {
nkeynes@931
    27
#endif
nkeynes@931
    28
nkeynes@931
    29
#define VMA_TO_EXT_ADDR(vma) ((vma)&0x1FFFFFFF)
nkeynes@931
    30
nkeynes@931
    31
/************************** UTLB/ITLB Definitions ***************************/
nkeynes@931
    32
#define ITLB_ENTRY_COUNT 4
nkeynes@931
    33
#define UTLB_ENTRY_COUNT 64
nkeynes@931
    34
nkeynes@931
    35
/* Entry address */
nkeynes@931
    36
#define TLB_VALID     0x00000100
nkeynes@931
    37
#define TLB_USERMODE  0x00000040
nkeynes@931
    38
#define TLB_WRITABLE  0x00000020
nkeynes@931
    39
#define TLB_USERWRITABLE (TLB_WRITABLE|TLB_USERMODE)
nkeynes@931
    40
#define TLB_SIZE_MASK 0x00000090
nkeynes@931
    41
#define TLB_SIZE_1K   0x00000000
nkeynes@931
    42
#define TLB_SIZE_4K   0x00000010
nkeynes@931
    43
#define TLB_SIZE_64K  0x00000080
nkeynes@931
    44
#define TLB_SIZE_1M   0x00000090
nkeynes@931
    45
#define TLB_CACHEABLE 0x00000008
nkeynes@931
    46
#define TLB_DIRTY     0x00000004
nkeynes@931
    47
#define TLB_SHARE     0x00000002
nkeynes@931
    48
#define TLB_WRITETHRU 0x00000001
nkeynes@931
    49
nkeynes@931
    50
#define MASK_1K  0xFFFFFC00
nkeynes@931
    51
#define MASK_4K  0xFFFFF000
nkeynes@931
    52
#define MASK_64K 0xFFFF0000
nkeynes@931
    53
#define MASK_1M  0xFFF00000
nkeynes@931
    54
nkeynes@931
    55
struct itlb_entry {
nkeynes@931
    56
    sh4addr_t vpn; // Virtual Page Number
nkeynes@931
    57
    uint32_t asid; // Process ID
nkeynes@931
    58
    uint32_t mask;
nkeynes@931
    59
    sh4addr_t ppn; // Physical Page Number
nkeynes@931
    60
    uint32_t flags;
nkeynes@931
    61
};
nkeynes@931
    62
nkeynes@931
    63
struct utlb_entry {
nkeynes@931
    64
    sh4addr_t vpn; // Virtual Page Number
nkeynes@931
    65
    uint32_t mask; // Page size mask
nkeynes@931
    66
    uint32_t asid; // Process ID
nkeynes@931
    67
    sh4addr_t ppn; // Physical Page Number
nkeynes@931
    68
    uint32_t flags;
nkeynes@931
    69
    uint32_t pcmcia; // extra pcmcia data - not used
nkeynes@931
    70
};
nkeynes@931
    71
nkeynes@931
    72
struct utlb_sort_entry {
nkeynes@931
    73
    sh4addr_t key; // Masked VPN + ASID
nkeynes@931
    74
    uint32_t mask; // Mask + 0x00FF
nkeynes@931
    75
    int entryNo;
nkeynes@931
    76
};
nkeynes@931
    77
    
nkeynes@931
    78
#ifdef __cplusplus
nkeynes@931
    79
}
nkeynes@931
    80
#endif
nkeynes@931
    81
#endif /* !lxdream_sh4_mmu_H */
.