Search
lxdream.org :: lxdream/src/sh4/mmu.h :: diff
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 :)
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/sh4/mmu.h Sat Dec 27 03:14:59 2008 +0000
1.3 @@ -0,0 +1,81 @@
1.4 +/**
1.5 + * $Id$
1.6 + *
1.7 + * MMU/TLB definitions.
1.8 + *
1.9 + * Copyright (c) 2005 Nathan Keynes.
1.10 + *
1.11 + * This program is free software; you can redistribute it and/or modify
1.12 + * it under the terms of the GNU General Public License as published by
1.13 + * the Free Software Foundation; either version 2 of the License, or
1.14 + * (at your option) any later version.
1.15 + *
1.16 + * This program is distributed in the hope that it will be useful,
1.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.19 + * GNU General Public License for more details.
1.20 + */
1.21 +
1.22 +
1.23 +#ifndef lxdream_sh4_mmu_H
1.24 +#define lxdream_sh4_mmu_H 1
1.25 +
1.26 +#include "lxdream.h"
1.27 +
1.28 +#ifdef __cplusplus
1.29 +extern "C" {
1.30 +#endif
1.31 +
1.32 +#define VMA_TO_EXT_ADDR(vma) ((vma)&0x1FFFFFFF)
1.33 +
1.34 +/************************** UTLB/ITLB Definitions ***************************/
1.35 +#define ITLB_ENTRY_COUNT 4
1.36 +#define UTLB_ENTRY_COUNT 64
1.37 +
1.38 +/* Entry address */
1.39 +#define TLB_VALID 0x00000100
1.40 +#define TLB_USERMODE 0x00000040
1.41 +#define TLB_WRITABLE 0x00000020
1.42 +#define TLB_USERWRITABLE (TLB_WRITABLE|TLB_USERMODE)
1.43 +#define TLB_SIZE_MASK 0x00000090
1.44 +#define TLB_SIZE_1K 0x00000000
1.45 +#define TLB_SIZE_4K 0x00000010
1.46 +#define TLB_SIZE_64K 0x00000080
1.47 +#define TLB_SIZE_1M 0x00000090
1.48 +#define TLB_CACHEABLE 0x00000008
1.49 +#define TLB_DIRTY 0x00000004
1.50 +#define TLB_SHARE 0x00000002
1.51 +#define TLB_WRITETHRU 0x00000001
1.52 +
1.53 +#define MASK_1K 0xFFFFFC00
1.54 +#define MASK_4K 0xFFFFF000
1.55 +#define MASK_64K 0xFFFF0000
1.56 +#define MASK_1M 0xFFF00000
1.57 +
1.58 +struct itlb_entry {
1.59 + sh4addr_t vpn; // Virtual Page Number
1.60 + uint32_t asid; // Process ID
1.61 + uint32_t mask;
1.62 + sh4addr_t ppn; // Physical Page Number
1.63 + uint32_t flags;
1.64 +};
1.65 +
1.66 +struct utlb_entry {
1.67 + sh4addr_t vpn; // Virtual Page Number
1.68 + uint32_t mask; // Page size mask
1.69 + uint32_t asid; // Process ID
1.70 + sh4addr_t ppn; // Physical Page Number
1.71 + uint32_t flags;
1.72 + uint32_t pcmcia; // extra pcmcia data - not used
1.73 +};
1.74 +
1.75 +struct utlb_sort_entry {
1.76 + sh4addr_t key; // Masked VPN + ASID
1.77 + uint32_t mask; // Mask + 0x00FF
1.78 + int entryNo;
1.79 +};
1.80 +
1.81 +#ifdef __cplusplus
1.82 +}
1.83 +#endif
1.84 +#endif /* !lxdream_sh4_mmu_H */
.