diff options
| author | 2015-01-30 15:48:57 -0500 | |
|---|---|---|
| committer | 2015-01-30 15:48:57 -0500 | |
| commit | 904194c3e8bdf78f36355f3244a058025c2f3975 (patch) | |
| tree | b469f11ef52c8dae98a62188c8a8db4c8a64e41e /src | |
| parent | Merge pull request #513 from lioncash/cleanup (diff) | |
| download | yuzu-904194c3e8bdf78f36355f3244a058025c2f3975.tar.gz yuzu-904194c3e8bdf78f36355f3244a058025c2f3975.tar.xz yuzu-904194c3e8bdf78f36355f3244a058025c2f3975.zip | |
arm: Clean out armos.h and armmmu.h
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/arm/skyeye_common/armmmu.h | 99 | ||||
| -rw-r--r-- | src/core/arm/skyeye_common/armos.h | 105 |
2 files changed, 23 insertions, 181 deletions
diff --git a/src/core/arm/skyeye_common/armmmu.h b/src/core/arm/skyeye_common/armmmu.h index 30858f9ba..6e54142ee 100644 --- a/src/core/arm/skyeye_common/armmmu.h +++ b/src/core/arm/skyeye_common/armmmu.h | |||
| @@ -18,19 +18,10 @@ | |||
| 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef _ARMMMU_H_ | 21 | #pragma once |
| 22 | #define _ARMMMU_H_ | ||
| 23 | 22 | ||
| 24 | 23 | // Register numbers in the MMU | |
| 25 | #define WORD_SHT 2 | 24 | enum |
| 26 | #define WORD_SIZE (1<<WORD_SHT) | ||
| 27 | /* The MMU is accessible with MCR and MRC operations to copro 15: */ | ||
| 28 | |||
| 29 | #define MMU_COPRO (15) | ||
| 30 | |||
| 31 | /* Register numbers in the MMU: */ | ||
| 32 | |||
| 33 | typedef enum mmu_regnum_t | ||
| 34 | { | 25 | { |
| 35 | MMU_ID = 0, | 26 | MMU_ID = 0, |
| 36 | MMU_CONTROL = 1, | 27 | MMU_CONTROL = 1, |
| @@ -44,94 +35,22 @@ typedef enum mmu_regnum_t | |||
| 44 | MMU_TLB_LOCKDOWN = 10, | 35 | MMU_TLB_LOCKDOWN = 10, |
| 45 | MMU_PID = 13, | 36 | MMU_PID = 13, |
| 46 | 37 | ||
| 47 | /*MMU_V4 */ | 38 | // MMU_V4 |
| 48 | MMU_V4_CACHE_OPS = 7, | 39 | MMU_V4_CACHE_OPS = 7, |
| 49 | MMU_V4_TLB_OPS = 8, | 40 | MMU_V4_TLB_OPS = 8, |
| 50 | 41 | ||
| 51 | /*MMU_V3 */ | 42 | // MMU_V3 |
| 52 | MMU_V3_FLUSH_TLB = 5, | 43 | MMU_V3_FLUSH_TLB = 5, |
| 53 | MMU_V3_FLUSH_TLB_ENTRY = 6, | 44 | MMU_V3_FLUSH_TLB_ENTRY = 6, |
| 54 | MMU_V3_FLUSH_CACHE = 7, | 45 | MMU_V3_FLUSH_CACHE = 7, |
| 55 | 46 | ||
| 56 | /*MMU Intel SA-1100 */ | 47 | // MMU Intel SA-1100 |
| 57 | MMU_SA_RB_OPS = 9, | 48 | MMU_SA_RB_OPS = 9, |
| 58 | MMU_SA_DEBUG = 14, | 49 | MMU_SA_DEBUG = 14, |
| 59 | MMU_SA_CP15_R15 = 15, | 50 | MMU_SA_CP15_R15 = 15, |
| 60 | //chy 2003-08-24 | 51 | |
| 61 | /*Intel xscale CP15 */ | 52 | // Intel xscale CP15 |
| 62 | XSCALE_CP15_CACHE_TYPE = 0, | 53 | XSCALE_CP15_CACHE_TYPE = 0, |
| 63 | XSCALE_CP15_AUX_CONTROL = 1, | 54 | XSCALE_CP15_AUX_CONTROL = 1, |
| 64 | XSCALE_CP15_COPRO_ACCESS = 15, | 55 | XSCALE_CP15_COPRO_ACCESS = 15, |
| 65 | 56 | }; | |
| 66 | } mmu_regnum_t; | ||
| 67 | |||
| 68 | /* Bits in the control register */ | ||
| 69 | |||
| 70 | #define CONTROL_MMU (1<<0) | ||
| 71 | #define CONTROL_ALIGN_FAULT (1<<1) | ||
| 72 | #define CONTROL_CACHE (1<<2) | ||
| 73 | #define CONTROL_DATA_CACHE (1<<2) | ||
| 74 | #define CONTROL_WRITE_BUFFER (1<<3) | ||
| 75 | #define CONTROL_BIG_ENDIAN (1<<7) | ||
| 76 | #define CONTROL_SYSTEM (1<<8) | ||
| 77 | #define CONTROL_ROM (1<<9) | ||
| 78 | #define CONTROL_UNDEFINED (1<<10) | ||
| 79 | #define CONTROL_BRANCH_PREDICT (1<<11) | ||
| 80 | #define CONTROL_INSTRUCTION_CACHE (1<<12) | ||
| 81 | #define CONTROL_VECTOR (1<<13) | ||
| 82 | #define CONTROL_RR (1<<14) | ||
| 83 | #define CONTROL_L4 (1<<15) | ||
| 84 | #define CONTROL_XP (1<<23) | ||
| 85 | #define CONTROL_EE (1<<25) | ||
| 86 | |||
| 87 | /*Macro defines for MMU state*/ | ||
| 88 | #define MMU_CTL (state->mmu.control) | ||
| 89 | #define MMU_Enabled (state->mmu.control & CONTROL_MMU) | ||
| 90 | #define MMU_Disabled (!(MMU_Enabled)) | ||
| 91 | #define MMU_Aligned (state->mmu.control & CONTROL_ALIGN_FAULT) | ||
| 92 | |||
| 93 | #define MMU_ICacheEnabled (MMU_CTL & CONTROL_INSTRUCTION_CACHE) | ||
| 94 | #define MMU_ICacheDisabled (!(MMU_ICacheDisabled)) | ||
| 95 | |||
| 96 | #define MMU_DCacheEnabled (MMU_CTL & CONTROL_DATA_CACHE) | ||
| 97 | #define MMU_DCacheDisabled (!(MMU_DCacheEnabled)) | ||
| 98 | |||
| 99 | #define MMU_CacheEnabled (MMU_CTL & CONTROL_CACHE) | ||
| 100 | #define MMU_CacheDisabled (!(MMU_CacheEnabled)) | ||
| 101 | |||
| 102 | #define MMU_WBEnabled (MMU_CTL & CONTROL_WRITE_BUFFER) | ||
| 103 | #define MMU_WBDisabled (!(MMU_WBEnabled)) | ||
| 104 | |||
| 105 | /*virt_addr exchange according to CP15.R13(process id virtul mapping)*/ | ||
| 106 | #define PID_VA_MAP_MASK 0xfe000000 | ||
| 107 | //#define mmu_pid_va_map(va) ({\ | ||
| 108 | // ARMword ret; \ | ||
| 109 | // if ((va) & PID_VA_MAP_MASK)\ | ||
| 110 | // ret = (va); \ | ||
| 111 | // else \ | ||
| 112 | // ret = ((va) | (state->mmu.process_id & PID_VA_MAP_MASK));\ | ||
| 113 | // ret;\ | ||
| 114 | //}) | ||
| 115 | #define mmu_pid_va_map(va) ((va) & PID_VA_MAP_MASK) ? (va) : ((va) | (state->mmu.process_id & PID_VA_MAP_MASK)) | ||
| 116 | |||
| 117 | /* FS[3:0] in the fault status register: */ | ||
| 118 | |||
| 119 | typedef enum fault_t | ||
| 120 | { | ||
| 121 | NO_FAULT = 0x0, | ||
| 122 | ALIGNMENT_FAULT = 0x1, | ||
| 123 | |||
| 124 | SECTION_TRANSLATION_FAULT = 0x5, | ||
| 125 | PAGE_TRANSLATION_FAULT = 0x7, | ||
| 126 | SECTION_DOMAIN_FAULT = 0x9, | ||
| 127 | PAGE_DOMAIN_FAULT = 0xB, | ||
| 128 | SECTION_PERMISSION_FAULT = 0xD, | ||
| 129 | SUBPAGE_PERMISSION_FAULT = 0xF, | ||
| 130 | |||
| 131 | /* defined by skyeye */ | ||
| 132 | TLB_READ_MISS = 0x30, | ||
| 133 | TLB_WRITE_MISS = 0x40, | ||
| 134 | |||
| 135 | } fault_t; | ||
| 136 | |||
| 137 | #endif /* _ARMMMU_H_ */ | ||
diff --git a/src/core/arm/skyeye_common/armos.h b/src/core/arm/skyeye_common/armos.h index ffdadcd1c..1217a728b 100644 --- a/src/core/arm/skyeye_common/armos.h +++ b/src/core/arm/skyeye_common/armos.h | |||
| @@ -1,38 +1,24 @@ | |||
| 1 | /* armos.h -- ARMulator OS definitions: ARM6 Instruction Emulator. | 1 | /* armos.h -- ARMulator OS definitions: ARM6 Instruction Emulator. |
| 2 | Copyright (C) 1994 Advanced RISC Machines Ltd. | 2 | Copyright (C) 1994 Advanced RISC Machines Ltd. |
| 3 | 3 | ||
| 4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
| 6 | the Free Software Foundation; either version 2 of the License, or | 6 | the Free Software Foundation; either version 2 of the License, or |
| 7 | (at your option) any later version. | 7 | (at your option) any later version. |
| 8 | 8 | ||
| 9 | This program is distributed in the hope that it will be useful, | 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
| 13 | 13 | ||
| 14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program; if not, write to the Free Software | 15 | along with this program; if not, write to the Free Software |
| 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | 17 | */ | |
| 18 | #include <stdint.h> | ||
| 19 | 18 | ||
| 20 | #if FAST_MEMORY | 19 | // |
| 21 | /* in user mode, mmap_base will be on initial brk, | 20 | // SWI Numbers |
| 22 | set at the first mmap request */ | 21 | // |
| 23 | #define mmap_base -1 | ||
| 24 | #else | ||
| 25 | #define mmap_base 0x50000000 | ||
| 26 | #endif | ||
| 27 | static long mmap_next_base = mmap_base; | ||
| 28 | |||
| 29 | //static mmap_area_t* new_mmap_area(int sim_addr, int len); | ||
| 30 | static char mmap_mem_write(short size, int addr, uint32_t value); | ||
| 31 | static char mmap_mem_read(short size, int addr, uint32_t * value); | ||
| 32 | |||
| 33 | /***************************************************************************\ | ||
| 34 | * SWI numbers * | ||
| 35 | \***************************************************************************/ | ||
| 36 | 22 | ||
| 37 | #define SWI_Syscall 0x0 | 23 | #define SWI_Syscall 0x0 |
| 38 | #define SWI_Exit 0x1 | 24 | #define SWI_Exit 0x1 |
| @@ -44,8 +30,8 @@ static char mmap_mem_read(short size, int addr, uint32_t * value); | |||
| 44 | #define SWI_Rename 0x26 | 30 | #define SWI_Rename 0x26 |
| 45 | #define SWI_Break 0x11 | 31 | #define SWI_Break 0x11 |
| 46 | 32 | ||
| 47 | #define SWI_Times 0x2b | 33 | #define SWI_Times 0x2b |
| 48 | #define SWI_Brk 0x2d | 34 | #define SWI_Brk 0x2d |
| 49 | 35 | ||
| 50 | #define SWI_Mmap 0x5a | 36 | #define SWI_Mmap 0x5a |
| 51 | #define SWI_Munmap 0x5b | 37 | #define SWI_Munmap 0x5b |
| @@ -56,76 +42,13 @@ static char mmap_mem_read(short size, int addr, uint32_t * value); | |||
| 56 | #define SWI_GetEUID32 0xc9 | 42 | #define SWI_GetEUID32 0xc9 |
| 57 | #define SWI_GetEGID32 0xca | 43 | #define SWI_GetEGID32 0xca |
| 58 | 44 | ||
| 59 | #define SWI_ExitGroup 0xf8 | 45 | #define SWI_ExitGroup 0xf8 |
| 60 | |||
| 61 | #if 0 | ||
| 62 | #define SWI_Time 0xd | ||
| 63 | #define SWI_Clock 0x61 | ||
| 64 | #define SWI_Time 0x63 | ||
| 65 | #define SWI_Remove 0x64 | ||
| 66 | #define SWI_Rename 0x65 | ||
| 67 | #define SWI_Flen 0x6c | ||
| 68 | #endif | ||
| 69 | 46 | ||
| 70 | #define SWI_Uname 0x7a | 47 | #define SWI_Uname 0x7a |
| 71 | #define SWI_Fcntl 0xdd | 48 | #define SWI_Fcntl 0xdd |
| 72 | #define SWI_Fstat64 0xc5 | 49 | #define SWI_Fstat64 0xc5 |
| 73 | #define SWI_Gettimeofday 0x4e | 50 | #define SWI_Gettimeofday 0x4e |
| 74 | #define SWI_Set_tls 0xf0005 | 51 | #define SWI_Set_tls 0xf0005 |
| 75 | 52 | ||
| 76 | #define SWI_Breakpoint 0x180000 /* see gdb's tm-arm.h */ | 53 | #define SWI_Breakpoint 0x180000 /* see gdb's tm-arm.h */ |
| 77 | 54 | ||
| 78 | /***************************************************************************\ | ||
| 79 | * SWI structures * | ||
| 80 | \***************************************************************************/ | ||
| 81 | |||
| 82 | /* Arm binaries (for now) only support 32 bit, and expect to receive | ||
| 83 | 32-bit compliant structure in return of a systen call. Because | ||
| 84 | we use host system calls to emulate system calls, the returned | ||
| 85 | structure can be 32-bit compliant or 64-bit compliant, depending | ||
| 86 | on the OS running skyeye. Therefore, we need a fixed size structure | ||
| 87 | adapted to arm.*/ | ||
| 88 | |||
| 89 | /* Borrowed from qemu */ | ||
| 90 | struct target_stat64 { | ||
| 91 | unsigned short st_dev; | ||
| 92 | unsigned char __pad0[10]; | ||
| 93 | uint32_t __st_ino; | ||
| 94 | unsigned int st_mode; | ||
| 95 | unsigned int st_nlink; | ||
| 96 | uint32_t st_uid; | ||
| 97 | uint32_t st_gid; | ||
| 98 | unsigned short st_rdev; | ||
| 99 | unsigned char __pad3[10]; | ||
| 100 | unsigned char __pad31[4]; | ||
| 101 | long long st_size; | ||
| 102 | uint32_t st_blksize; | ||
| 103 | unsigned char __pad32[4]; | ||
| 104 | uint32_t st_blocks; | ||
| 105 | uint32_t __pad4; | ||
| 106 | uint32_t st32_atime; | ||
| 107 | uint32_t __pad5; | ||
| 108 | uint32_t st32_mtime; | ||
| 109 | uint32_t __pad6; | ||
| 110 | uint32_t st32_ctime; | ||
| 111 | uint32_t __pad7; | ||
| 112 | unsigned long long st_ino; | ||
| 113 | };// __attribute__((packed)); | ||
| 114 | |||
| 115 | struct target_tms32 { | ||
| 116 | uint32_t tms_utime; | ||
| 117 | uint32_t tms_stime; | ||
| 118 | uint32_t tms_cutime; | ||
| 119 | uint32_t tms_cstime; | ||
| 120 | }; | ||
| 121 | |||
| 122 | struct target_timeval32 { | ||
| 123 | uint32_t tv_sec; /* seconds */ | ||
| 124 | uint32_t tv_usec; /* microseconds */ | ||
| 125 | }; | ||
| 126 | |||
| 127 | struct target_timezone32 { | ||
| 128 | int32_t tz_minuteswest; /* minutes west of Greenwich */ | ||
| 129 | int32_t tz_dsttime; /* type of DST correction */ | ||
| 130 | }; | ||
| 131 | |||