diff options
| author | 2015-02-13 08:08:21 -0500 | |
|---|---|---|
| committer | 2015-02-13 09:11:12 -0500 | |
| commit | a75e1ff6e6b33b3e4751b82e0ab91b8dad169fc6 (patch) | |
| tree | fb2a89cbc953be437c43db3b16654be8f4d7efb8 /src/core/arm/skyeye_common | |
| parent | Merge pull request #569 from lioncash/modeswitch (diff) | |
| download | yuzu-a75e1ff6e6b33b3e4751b82e0ab91b8dad169fc6.tar.gz yuzu-a75e1ff6e6b33b3e4751b82e0ab91b8dad169fc6.tar.xz yuzu-a75e1ff6e6b33b3e4751b82e0ab91b8dad169fc6.zip | |
arm: General cleanup
- Remove several typedefs for ARMul_State.
- Remove unused functions
- Remove unused/unnecessary headers
- Removed unused enums, etc.
Diffstat (limited to 'src/core/arm/skyeye_common')
| -rw-r--r-- | src/core/arm/skyeye_common/armdefs.h | 16 | ||||
| -rw-r--r-- | src/core/arm/skyeye_common/armemu.h | 71 | ||||
| -rw-r--r-- | src/core/arm/skyeye_common/skyeye_defs.h | 83 | ||||
| -rw-r--r-- | src/core/arm/skyeye_common/vfp/vfp.cpp | 9 | ||||
| -rw-r--r-- | src/core/arm/skyeye_common/vfp/vfp_helper.h | 6 | ||||
| -rw-r--r-- | src/core/arm/skyeye_common/vfp/vfpdouble.cpp | 1 |
6 files changed, 57 insertions, 129 deletions
diff --git a/src/core/arm/skyeye_common/armdefs.h b/src/core/arm/skyeye_common/armdefs.h index dc2256a35..070fcf7dc 100644 --- a/src/core/arm/skyeye_common/armdefs.h +++ b/src/core/arm/skyeye_common/armdefs.h | |||
| @@ -17,19 +17,9 @@ | |||
| 17 | 17 | ||
| 18 | #pragma once | 18 | #pragma once |
| 19 | 19 | ||
| 20 | #include <cerrno> | ||
| 21 | #include <csignal> | ||
| 22 | #include <cstdio> | ||
| 23 | #include <cstdlib> | ||
| 24 | #include <cstring> | ||
| 25 | #include <fcntl.h> | ||
| 26 | #include <sys/stat.h> | ||
| 27 | #include <sys/types.h> | ||
| 28 | |||
| 29 | #include "arm_regformat.h" | ||
| 30 | #include "common/common_types.h" | 20 | #include "common/common_types.h" |
| 31 | #include "common/platform.h" | ||
| 32 | #include "core/arm/skyeye_common/armmmu.h" | 21 | #include "core/arm/skyeye_common/armmmu.h" |
| 22 | #include "core/arm/skyeye_common/arm_regformat.h" | ||
| 33 | #include "core/arm/skyeye_common/skyeye_defs.h" | 23 | #include "core/arm/skyeye_common/skyeye_defs.h" |
| 34 | 24 | ||
| 35 | #define BITS(s, a, b) ((s << ((sizeof(s) * 8 - 1) - b)) >> (sizeof(s) * 8 - b + a - 1)) | 25 | #define BITS(s, a, b) ((s << ((sizeof(s) * 8 - 1) - b)) >> (sizeof(s) * 8 - b + a - 1)) |
| @@ -118,9 +108,7 @@ struct ARMul_State | |||
| 118 | // Add armv6 flags dyf:2010-08-09 | 108 | // Add armv6 flags dyf:2010-08-09 |
| 119 | ARMword GEFlag, EFlag, AFlag, QFlag; | 109 | ARMword GEFlag, EFlag, AFlag, QFlag; |
| 120 | 110 | ||
| 121 | #ifdef MODET | ||
| 122 | ARMword TFlag; // Thumb state | 111 | ARMword TFlag; // Thumb state |
| 123 | #endif | ||
| 124 | 112 | ||
| 125 | unsigned long long NumInstrs; // The number of instructions executed | 113 | unsigned long long NumInstrs; // The number of instructions executed |
| 126 | unsigned NumInstrsToExecute; | 114 | unsigned NumInstrsToExecute; |
| @@ -218,8 +206,6 @@ So, if lateabtSig=1, then it means Late Abort Model(Base Updated Abort Model) | |||
| 218 | u32 CurrWrite; | 206 | u32 CurrWrite; |
| 219 | }; | 207 | }; |
| 220 | 208 | ||
| 221 | typedef ARMul_State arm_core_t; | ||
| 222 | |||
| 223 | /***************************************************************************\ | 209 | /***************************************************************************\ |
| 224 | * Types of ARM we know about * | 210 | * Types of ARM we know about * |
| 225 | \***************************************************************************/ | 211 | \***************************************************************************/ |
diff --git a/src/core/arm/skyeye_common/armemu.h b/src/core/arm/skyeye_common/armemu.h index 2467f4319..8bfd4e0f0 100644 --- a/src/core/arm/skyeye_common/armemu.h +++ b/src/core/arm/skyeye_common/armemu.h | |||
| @@ -19,61 +19,24 @@ | |||
| 19 | 19 | ||
| 20 | #include "core/arm/skyeye_common/armdefs.h" | 20 | #include "core/arm/skyeye_common/armdefs.h" |
| 21 | 21 | ||
| 22 | /* Macros to twiddle the status flags and mode. */ | 22 | // Flags for use with the APSR. |
| 23 | #define NBIT ((unsigned)1L << 31) | 23 | enum : u32 { |
| 24 | #define ZBIT (1L << 30) | 24 | NBIT = (1U << 31U), |
| 25 | #define CBIT (1L << 29) | 25 | ZBIT = (1 << 30), |
| 26 | #define VBIT (1L << 28) | 26 | CBIT = (1 << 29), |
| 27 | #define QBIT (1L << 27) | 27 | VBIT = (1 << 28), |
| 28 | #define IBIT (1L << 7) | 28 | QBIT = (1 << 27), |
| 29 | #define FBIT (1L << 6) | 29 | JBIT = (1 << 24), |
| 30 | #define IFBITS (3L << 6) | 30 | EBIT = (1 << 9), |
| 31 | #define R15IBIT (1L << 27) | 31 | ABIT = (1 << 8), |
| 32 | #define R15FBIT (1L << 26) | 32 | IBIT = (1 << 7), |
| 33 | #define R15IFBITS (3L << 26) | 33 | FBIT = (1 << 6), |
| 34 | TBIT = (1 << 5), | ||
| 34 | 35 | ||
| 35 | #if defined MODE32 || defined MODET | 36 | // Masks for groups of bits in the APSR. |
| 36 | #define CCBITS (0xf8000000L) | 37 | MODEBITS = 0x1F, |
| 37 | #else | 38 | INTBITS = 0xC0, |
| 38 | #define CCBITS (0xf0000000L) | 39 | }; |
| 39 | #endif | ||
| 40 | |||
| 41 | #define INTBITS (0xc0L) | ||
| 42 | |||
| 43 | #if defined MODET && defined MODE32 | ||
| 44 | #define PCBITS (0xffffffffL) | ||
| 45 | #else | ||
| 46 | #define PCBITS (0xfffffffcL) | ||
| 47 | #endif | ||
| 48 | |||
| 49 | #define MODEBITS (0x1fL) | ||
| 50 | #define R15INTBITS (3L << 26) | ||
| 51 | |||
| 52 | #if defined MODET && defined MODE32 | ||
| 53 | #define R15PCBITS (0x03ffffffL) | ||
| 54 | #else | ||
| 55 | #define R15PCBITS (0x03fffffcL) | ||
| 56 | #endif | ||
| 57 | |||
| 58 | #define R15MODEBITS (0x3L) | ||
| 59 | |||
| 60 | #ifdef MODE32 | ||
| 61 | #define PCMASK PCBITS | ||
| 62 | #define PCWRAP(pc) (pc) | ||
| 63 | #else | ||
| 64 | #define PCMASK R15PCBITS | ||
| 65 | #define PCWRAP(pc) ((pc) & R15PCBITS) | ||
| 66 | #endif | ||
| 67 | |||
| 68 | #define PC (state->Reg[15] & PCMASK) | ||
| 69 | #define R15CCINTMODE (state->Reg[15] & (CCBITS | R15INTBITS | R15MODEBITS)) | ||
| 70 | #define R15INT (state->Reg[15] & R15INTBITS) | ||
| 71 | #define R15INTPC (state->Reg[15] & (R15INTBITS | R15PCBITS)) | ||
| 72 | #define R15INTPCMODE (state->Reg[15] & (R15INTBITS | R15PCBITS | R15MODEBITS)) | ||
| 73 | #define R15INTMODE (state->Reg[15] & (R15INTBITS | R15MODEBITS)) | ||
| 74 | #define R15PC (state->Reg[15] & R15PCBITS) | ||
| 75 | #define R15PCMODE (state->Reg[15] & (R15PCBITS | R15MODEBITS)) | ||
| 76 | #define R15MODE (state->Reg[15] & R15MODEBITS) | ||
| 77 | 40 | ||
| 78 | // Different ways to start the next instruction. | 41 | // Different ways to start the next instruction. |
| 79 | enum { | 42 | enum { |
diff --git a/src/core/arm/skyeye_common/skyeye_defs.h b/src/core/arm/skyeye_common/skyeye_defs.h index 6648e9d66..edf6097e0 100644 --- a/src/core/arm/skyeye_common/skyeye_defs.h +++ b/src/core/arm/skyeye_common/skyeye_defs.h | |||
| @@ -1,57 +1,38 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | 2 | ||
| 3 | #include "common/common.h" | 3 | #include "common/common_types.h" |
| 4 | 4 | ||
| 5 | #define MODE32 | 5 | struct cpu_config_t |
| 6 | #define MODET | ||
| 7 | |||
| 8 | typedef struct | ||
| 9 | { | 6 | { |
| 10 | const char *cpu_arch_name; /* CPU architecture version name.e.g. armv4t */ | 7 | const char* cpu_arch_name; // CPU architecture version name.e.g. ARMv4T |
| 11 | const char *cpu_name; /* CPU name. e.g. arm7tdmi or arm720t */ | 8 | const char* cpu_name; // CPU name. e.g. ARM7TDMI or ARM720T |
| 12 | u32 cpu_val; /*CPU value; also call MMU ID or processor id;see | 9 | u32 cpu_val; // CPU value; also call MMU ID or processor id;see |
| 13 | ARM Architecture Reference Manual B2-6 */ | 10 | // ARM Architecture Reference Manual B2-6 |
| 14 | u32 cpu_mask; /* cpu_val's mask. */ | 11 | u32 cpu_mask; // cpu_val's mask. |
| 15 | u32 cachetype; /* this CPU has what kind of cache */ | 12 | u32 cachetype; // CPU cache type |
| 16 | } cpu_config_t; | 13 | }; |
| 17 | 14 | ||
| 18 | typedef enum { | 15 | enum { |
| 19 | /* No exception */ | 16 | // No exception |
| 20 | No_exp = 0, | 17 | No_exp = 0, |
| 21 | /* Memory allocation exception */ | 18 | // Memory allocation exception |
| 22 | Malloc_exp, | 19 | Malloc_exp, |
| 23 | /* File open exception */ | 20 | // File open exception |
| 24 | File_open_exp, | 21 | File_open_exp, |
| 25 | /* DLL open exception */ | 22 | // DLL open exception |
| 26 | Dll_open_exp, | 23 | Dll_open_exp, |
| 27 | /* Invalid argument exception */ | 24 | // Invalid argument exception |
| 28 | Invarg_exp, | 25 | Invarg_exp, |
| 29 | /* Invalid module exception */ | 26 | // Invalid module exception |
| 30 | Invmod_exp, | 27 | Invmod_exp, |
| 31 | /* wrong format exception for config file parsing */ | 28 | // wrong format exception for config file parsing |
| 32 | Conf_format_exp, | 29 | Conf_format_exp, |
| 33 | /* some reference excess the predefiend range. Such as the index out of array range */ | 30 | // some reference excess the predefiend range. Such as the index out of array range |
| 34 | Excess_range_exp, | 31 | Excess_range_exp, |
| 35 | /* Can not find the desirable result */ | 32 | // Can not find the desirable result |
| 36 | Not_found_exp, | 33 | Not_found_exp, |
| 37 | 34 | // Unknown exception | |
| 38 | /* Unknown exception */ | 35 | Unknown_exp |
| 39 | Unknown_exp | 36 | }; |
| 40 | } exception_t; | ||
| 41 | |||
| 42 | typedef enum { | ||
| 43 | Align = 0, | ||
| 44 | UnAlign | ||
| 45 | } align_t; | ||
| 46 | |||
| 47 | typedef enum { | ||
| 48 | Little_endian = 0, | ||
| 49 | Big_endian | ||
| 50 | } endian_t; | ||
| 51 | |||
| 52 | typedef enum { | ||
| 53 | Phys_addr = 0, | ||
| 54 | Virt_addr | ||
| 55 | } addr_type_t; | ||
| 56 | 37 | ||
| 57 | typedef u32 addr_t; | 38 | typedef u32 addr_t; |
diff --git a/src/core/arm/skyeye_common/vfp/vfp.cpp b/src/core/arm/skyeye_common/vfp/vfp.cpp index 6f22923bb..6286e7b62 100644 --- a/src/core/arm/skyeye_common/vfp/vfp.cpp +++ b/src/core/arm/skyeye_common/vfp/vfp.cpp | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | /* Note: this file handles interface with arm core and vfp registers */ | 21 | /* Note: this file handles interface with arm core and vfp registers */ |
| 22 | 22 | ||
| 23 | #include "common/common.h" | 23 | #include "common/common.h" |
| 24 | #include "common/logging/log.h" | ||
| 24 | 25 | ||
| 25 | #include "core/arm/skyeye_common/armdefs.h" | 26 | #include "core/arm/skyeye_common/armdefs.h" |
| 26 | #include "core/arm/skyeye_common/vfp/asm_vfp.h" | 27 | #include "core/arm/skyeye_common/vfp/asm_vfp.h" |
| @@ -724,26 +725,26 @@ void VMOVR(ARMul_State* state, ARMword single, ARMword d, ARMword m) | |||
| 724 | } | 725 | } |
| 725 | 726 | ||
| 726 | /* Miscellaneous functions */ | 727 | /* Miscellaneous functions */ |
| 727 | int32_t vfp_get_float(arm_core_t* state, unsigned int reg) | 728 | int32_t vfp_get_float(ARMul_State* state, unsigned int reg) |
| 728 | { | 729 | { |
| 729 | LOG_TRACE(Core_ARM11, "VFP get float: s%d=[%08x]\n", reg, state->ExtReg[reg]); | 730 | LOG_TRACE(Core_ARM11, "VFP get float: s%d=[%08x]\n", reg, state->ExtReg[reg]); |
| 730 | return state->ExtReg[reg]; | 731 | return state->ExtReg[reg]; |
| 731 | } | 732 | } |
| 732 | 733 | ||
| 733 | void vfp_put_float(arm_core_t* state, int32_t val, unsigned int reg) | 734 | void vfp_put_float(ARMul_State* state, int32_t val, unsigned int reg) |
| 734 | { | 735 | { |
| 735 | LOG_TRACE(Core_ARM11, "VFP put float: s%d <= [%08x]\n", reg, val); | 736 | LOG_TRACE(Core_ARM11, "VFP put float: s%d <= [%08x]\n", reg, val); |
| 736 | state->ExtReg[reg] = val; | 737 | state->ExtReg[reg] = val; |
| 737 | } | 738 | } |
| 738 | 739 | ||
| 739 | uint64_t vfp_get_double(arm_core_t* state, unsigned int reg) | 740 | uint64_t vfp_get_double(ARMul_State* state, unsigned int reg) |
| 740 | { | 741 | { |
| 741 | uint64_t result = ((uint64_t) state->ExtReg[reg*2+1])<<32 | state->ExtReg[reg*2]; | 742 | uint64_t result = ((uint64_t) state->ExtReg[reg*2+1])<<32 | state->ExtReg[reg*2]; |
| 742 | LOG_TRACE(Core_ARM11, "VFP get double: s[%d-%d]=[%016llx]\n", reg * 2 + 1, reg * 2, result); | 743 | LOG_TRACE(Core_ARM11, "VFP get double: s[%d-%d]=[%016llx]\n", reg * 2 + 1, reg * 2, result); |
| 743 | return result; | 744 | return result; |
| 744 | } | 745 | } |
| 745 | 746 | ||
| 746 | void vfp_put_double(arm_core_t* state, uint64_t val, unsigned int reg) | 747 | void vfp_put_double(ARMul_State* state, uint64_t val, unsigned int reg) |
| 747 | { | 748 | { |
| 748 | LOG_TRACE(Core_ARM11, "VFP put double: s[%d-%d] <= [%08x-%08x]\n", reg * 2 + 1, reg * 2, (uint32_t)(val >> 32), (uint32_t)(val & 0xffffffff)); | 749 | LOG_TRACE(Core_ARM11, "VFP put double: s[%d-%d] <= [%08x-%08x]\n", reg * 2 + 1, reg * 2, (uint32_t)(val >> 32), (uint32_t)(val & 0xffffffff)); |
| 749 | state->ExtReg[reg*2] = (uint32_t) (val & 0xffffffff); | 750 | state->ExtReg[reg*2] = (uint32_t) (val & 0xffffffff); |
diff --git a/src/core/arm/skyeye_common/vfp/vfp_helper.h b/src/core/arm/skyeye_common/vfp/vfp_helper.h index b68090b80..75d860e95 100644 --- a/src/core/arm/skyeye_common/vfp/vfp_helper.h +++ b/src/core/arm/skyeye_common/vfp/vfp_helper.h | |||
| @@ -32,11 +32,7 @@ | |||
| 32 | 32 | ||
| 33 | #pragma once | 33 | #pragma once |
| 34 | 34 | ||
| 35 | /* Custom edit */ | 35 | #include <cstdio> |
| 36 | |||
| 37 | #include <stdint.h> | ||
| 38 | #include <stdio.h> | ||
| 39 | |||
| 40 | #include "common/common_types.h" | 36 | #include "common/common_types.h" |
| 41 | #include "core/arm/skyeye_common/armdefs.h" | 37 | #include "core/arm/skyeye_common/armdefs.h" |
| 42 | 38 | ||
diff --git a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp index 9a7088088..17726b8bb 100644 --- a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp +++ b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp | |||
| @@ -51,6 +51,7 @@ | |||
| 51 | * =========================================================================== | 51 | * =========================================================================== |
| 52 | */ | 52 | */ |
| 53 | 53 | ||
| 54 | #include "common/logging/log.h" | ||
| 54 | #include "core/arm/skyeye_common/vfp/vfp.h" | 55 | #include "core/arm/skyeye_common/vfp/vfp.h" |
| 55 | #include "core/arm/skyeye_common/vfp/vfp_helper.h" | 56 | #include "core/arm/skyeye_common/vfp/vfp_helper.h" |
| 56 | #include "core/arm/skyeye_common/vfp/asm_vfp.h" | 57 | #include "core/arm/skyeye_common/vfp/asm_vfp.h" |