summaryrefslogtreecommitdiff
path: root/src/core/arm
diff options
context:
space:
mode:
authorGravatar bunnei2014-05-08 17:16:35 -0400
committerGravatar bunnei2014-05-08 17:16:35 -0400
commitbdc54d0d4897841a4d24aee80311bfb1f0eba884 (patch)
tree558d87c83fe8f7e8e3e57644407c872244ee5a3a /src/core/arm
parentMerge pull request #16 from Sethpaien/master (diff)
parentremoved unknown fields from GX_CmdBufferHeader (diff)
downloadyuzu-bdc54d0d4897841a4d24aee80311bfb1f0eba884.tar.gz
yuzu-bdc54d0d4897841a4d24aee80311bfb1f0eba884.tar.xz
yuzu-bdc54d0d4897841a4d24aee80311bfb1f0eba884.zip
Merge pull request #15 from bunnei/hle-services
Various fixes/improvements to HLE of 3DS services, mostly cleans up GSP call decoding
Diffstat (limited to 'src/core/arm')
-rw-r--r--src/core/arm/disassembler/load_symbol_map.cpp33
-rw-r--r--src/core/arm/disassembler/load_symbol_map.h13
-rw-r--r--src/core/arm/interpreter/armemu.cpp39
-rw-r--r--src/core/arm/interpreter/armsupp.cpp61
-rw-r--r--src/core/arm/mmu/arm1176jzf_s_mmu.cpp6
5 files changed, 102 insertions, 50 deletions
diff --git a/src/core/arm/disassembler/load_symbol_map.cpp b/src/core/arm/disassembler/load_symbol_map.cpp
new file mode 100644
index 000000000..d7fc0a042
--- /dev/null
+++ b/src/core/arm/disassembler/load_symbol_map.cpp
@@ -0,0 +1,33 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#include <string>
6#include <vector>
7
8#include "common/symbols.h"
9#include "common/common_types.h"
10#include "common/file_util.h"
11
12#include "core/arm/disassembler/load_symbol_map.h"
13
14/*
15 * Loads a symbol map file for use with the disassembler
16 * @param filename String filename path of symbol map file
17 */
18void LoadSymbolMap(std::string filename) {
19 std::ifstream infile(filename);
20
21 std::string address_str, function_name, line;
22 u32 size, address;
23
24 while (std::getline(infile, line)) {
25 std::istringstream iss(line);
26 if (!(iss >> address_str >> size >> function_name)) {
27 break; // Error parsing
28 }
29 u32 address = std::stoul(address_str, nullptr, 16);
30
31 Symbols::Add(address, function_name, size, 2);
32 }
33}
diff --git a/src/core/arm/disassembler/load_symbol_map.h b/src/core/arm/disassembler/load_symbol_map.h
new file mode 100644
index 000000000..837cca99b
--- /dev/null
+++ b/src/core/arm/disassembler/load_symbol_map.h
@@ -0,0 +1,13 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <string>
8
9/*
10 * Loads a symbol map file for use with the disassembler
11 * @param filename String filename path of symbol map file
12 */
13void LoadSymbolMap(std::string filename);
diff --git a/src/core/arm/interpreter/armemu.cpp b/src/core/arm/interpreter/armemu.cpp
index a35c5c8dc..1af684fe3 100644
--- a/src/core/arm/interpreter/armemu.cpp
+++ b/src/core/arm/interpreter/armemu.cpp
@@ -5536,14 +5536,15 @@ Handle_Load_Double (ARMul_State * state, ARMword instr)
5536 addr = base; 5536 addr = base;
5537 5537
5538 /* The address must be aligned on a 8 byte boundary. */ 5538 /* The address must be aligned on a 8 byte boundary. */
5539 if (addr & 0x7) { 5539 // FIX(Normatt): Disable strict alignment on LDRD/STRD
5540#ifdef ABORTS 5540// if (addr & 0x7) {
5541 ARMul_DATAABORT (addr); 5541//#ifdef ABORTS
5542#else 5542// ARMul_DATAABORT (addr);
5543 ARMul_UndefInstr (state, instr); 5543//#else
5544#endif 5544// ARMul_UndefInstr (state, instr);
5545 return; 5545//#endif
5546 } 5546// return;
5547// }
5547 5548
5548 /* For pre indexed or post indexed addressing modes, 5549 /* For pre indexed or post indexed addressing modes,
5549 check that the destination registers do not overlap 5550 check that the destination registers do not overlap
@@ -5640,14 +5641,15 @@ Handle_Store_Double (ARMul_State * state, ARMword instr)
5640 addr = base; 5641 addr = base;
5641 5642
5642 /* The address must be aligned on a 8 byte boundary. */ 5643 /* The address must be aligned on a 8 byte boundary. */
5643 if (addr & 0x7) { 5644 // FIX(Normatt): Disable strict alignment on LDRD/STRD
5644#ifdef ABORTS 5645// if (addr & 0x7) {
5645 ARMul_DATAABORT (addr); 5646//#ifdef ABORTS
5646#else 5647// ARMul_DATAABORT (addr);
5647 ARMul_UndefInstr (state, instr); 5648//#else
5648#endif 5649// ARMul_UndefInstr (state, instr);
5649 return; 5650//#endif
5650 } 5651// return;
5652// }
5651 5653
5652 /* For pre indexed or post indexed addressing modes, 5654 /* For pre indexed or post indexed addressing modes,
5653 check that the destination registers do not overlap 5655 check that the destination registers do not overlap
@@ -6405,6 +6407,8 @@ handle_v6_insn (ARMul_State * state, ARMword instr)
6405 if (state->Aborted) { 6407 if (state->Aborted) {
6406 TAKEABORT; 6408 TAKEABORT;
6407 } 6409 }
6410 // FIX(Normmatt): Handle RD in STREX/STREXB
6411 state->Reg[DESTReg] = 0; //Always succeed
6408 6412
6409 return 1; 6413 return 1;
6410 } 6414 }
@@ -6432,7 +6436,8 @@ handle_v6_insn (ARMul_State * state, ARMword instr)
6432 if (state->Aborted) { 6436 if (state->Aborted) {
6433 TAKEABORT; 6437 TAKEABORT;
6434 } 6438 }
6435 6439 // FIX(Normmatt): Handle RD in STREX/STREXB
6440 state->Reg[DESTReg] = 0; //Always succeed
6436 //printf("In %s, strexb not implemented\n", __FUNCTION__); 6441 //printf("In %s, strexb not implemented\n", __FUNCTION__);
6437 UNDEF_LSRBPC; 6442 UNDEF_LSRBPC;
6438 /* WRITESDEST (dest); */ 6443 /* WRITESDEST (dest); */
diff --git a/src/core/arm/interpreter/armsupp.cpp b/src/core/arm/interpreter/armsupp.cpp
index b2bbedc18..e531dceda 100644
--- a/src/core/arm/interpreter/armsupp.cpp
+++ b/src/core/arm/interpreter/armsupp.cpp
@@ -20,7 +20,7 @@
20 20
21//#include "ansidecl.h" 21//#include "ansidecl.h"
22#include "skyeye_defs.h" 22#include "skyeye_defs.h"
23#include "core/hle/mrc.h" 23#include "core/hle/coprocessor.h"
24#include "core/arm/disassembler/arm_disasm.h" 24#include "core/arm/disassembler/arm_disasm.h"
25 25
26unsigned xscale_cp15_cp_access_allowed (ARMul_State * state, unsigned reg, 26unsigned xscale_cp15_cp_access_allowed (ARMul_State * state, unsigned reg,
@@ -661,39 +661,40 @@ ARMul_STC (ARMul_State * state, ARMword instr, ARMword address)
661void 661void
662ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source) 662ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source)
663{ 663{
664 unsigned cpab; 664 HLE::CallMCR(instr, source);
665 //unsigned cpab;
665 666
666 //printf("SKYEYE ARMul_MCR, CPnum is %x, source %x\n",CPNum, source); 667 ////printf("SKYEYE ARMul_MCR, CPnum is %x, source %x\n",CPNum, source);
667 if (!CP_ACCESS_ALLOWED (state, CPNum)) { 668 //if (!CP_ACCESS_ALLOWED (state, CPNum)) {
668 //chy 2004-07-19 should fix in the future ????!!!! 669 // //chy 2004-07-19 should fix in the future ????!!!!
669 //printf("SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr CPnum is %x, source %x\n",CPNum, source); 670 // //printf("SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr CPnum is %x, source %x\n",CPNum, source);
670 ARMul_UndefInstr (state, instr); 671 // ARMul_UndefInstr (state, instr);
671 return; 672 // return;
672 } 673 //}
673 674
674 cpab = (state->MCR[CPNum]) (state, ARMul_FIRST, instr, source); 675 //cpab = (state->MCR[CPNum]) (state, ARMul_FIRST, instr, source);
675 676
676 while (cpab == ARMul_BUSY) { 677 //while (cpab == ARMul_BUSY) {
677 ARMul_Icycles (state, 1, 0); 678 // ARMul_Icycles (state, 1, 0);
678 679
679 if (IntPending (state)) { 680 // if (IntPending (state)) {
680 cpab = (state->MCR[CPNum]) (state, ARMul_INTERRUPT, 681 // cpab = (state->MCR[CPNum]) (state, ARMul_INTERRUPT,
681 instr, 0); 682 // instr, 0);
682 return; 683 // return;
683 } 684 // }
684 else 685 // else
685 cpab = (state->MCR[CPNum]) (state, ARMul_BUSY, instr, 686 // cpab = (state->MCR[CPNum]) (state, ARMul_BUSY, instr,
686 source); 687 // source);
687 } 688 //}
688 689
689 if (cpab == ARMul_CANT) { 690 //if (cpab == ARMul_CANT) {
690 printf ("SKYEYE ARMul_MCR, CANT, UndefinedInstr %x CPnum is %x, source %x\n", instr, CPNum, source); 691 // printf ("SKYEYE ARMul_MCR, CANT, UndefinedInstr %x CPnum is %x, source %x\n", instr, CPNum, source);
691 ARMul_Abort (state, ARMul_UndefinedInstrV); 692 // ARMul_Abort (state, ARMul_UndefinedInstrV);
692 } 693 //}
693 else { 694 //else {
694 BUSUSEDINCPCN; 695 // BUSUSEDINCPCN;
695 ARMul_Ccycles (state, 1, 0); 696 // ARMul_Ccycles (state, 1, 0);
696 } 697 //}
697} 698}
698 699
699/* This function does the Busy-Waiting for an MCRR instruction. */ 700/* This function does the Busy-Waiting for an MCRR instruction. */
@@ -739,7 +740,7 @@ ARMul_MRC (ARMul_State * state, ARMword instr)
739{ 740{
740 unsigned cpab; 741 unsigned cpab;
741 742
742 ARMword result = HLE::CallMRC((HLE::ARM11_MRC_OPERATION)BITS(20, 27)); 743 ARMword result = HLE::CallMRC(instr);
743 744
744 ////printf("SKYEYE ARMul_MRC, CPnum is %x, instr %x\n",CPNum, instr); 745 ////printf("SKYEYE ARMul_MRC, CPnum is %x, instr %x\n",CPNum, instr);
745 //if (!CP_ACCESS_ALLOWED (state, CPNum)) { 746 //if (!CP_ACCESS_ALLOWED (state, CPNum)) {
diff --git a/src/core/arm/mmu/arm1176jzf_s_mmu.cpp b/src/core/arm/mmu/arm1176jzf_s_mmu.cpp
index 7e7fbfbfa..a32f076b9 100644
--- a/src/core/arm/mmu/arm1176jzf_s_mmu.cpp
+++ b/src/core/arm/mmu/arm1176jzf_s_mmu.cpp
@@ -355,7 +355,7 @@ arm1176jzf_s_mmu_load_instr (ARMul_State *state, ARMword va, ARMword *instr)
355 355
356 static int debug_count = 0; /* used for debug */ 356 static int debug_count = 0; /* used for debug */
357 357
358 DEBUG_LOG(ARM11, "va = %x\n", va); 358 //DEBUG_LOG(ARM11, "va = %x\n", va);
359 359
360 va = mmu_pid_va_map (va); 360 va = mmu_pid_va_map (va);
361 if (MMU_Enabled) { 361 if (MMU_Enabled) {
@@ -444,7 +444,7 @@ arm1176jzf_s_mmu_read (ARMul_State *state, ARMword va, ARMword *data,
444 ARMword perm; /* physical addr access permissions */ 444 ARMword perm; /* physical addr access permissions */
445 int ap, sop; 445 int ap, sop;
446 446
447 DEBUG_LOG(ARM11, "va = %x\n", va); 447 //DEBUG_LOG(ARM11, "va = %x\n", va);
448 448
449 va = mmu_pid_va_map (va); 449 va = mmu_pid_va_map (va);
450 real_va = va; 450 real_va = va;
@@ -629,7 +629,7 @@ arm1176jzf_s_mmu_write (ARMul_State *state, ARMword va, ARMword data,
629 } 629 }
630#endif 630#endif
631 631
632 DEBUG_LOG(ARM11, "va = %x, val = %x\n", va, data); 632 //DEBUG_LOG(ARM11, "va = %x, val = %x\n", va, data);
633 va = mmu_pid_va_map (va); 633 va = mmu_pid_va_map (va);
634 real_va = va; 634 real_va = va;
635 635