mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 07:30:05 +00:00
added initial support for hw.cpp module
This commit is contained in:
parent
670ac5643a
commit
31abc42d3d
@ -152,7 +152,7 @@
|
|||||||
<ClCompile Include="src\elf\elf_reader.cpp" />
|
<ClCompile Include="src\elf\elf_reader.cpp" />
|
||||||
<ClCompile Include="src\file_sys\directory_file_system.cpp" />
|
<ClCompile Include="src\file_sys\directory_file_system.cpp" />
|
||||||
<ClCompile Include="src\file_sys\meta_file_system.cpp" />
|
<ClCompile Include="src\file_sys\meta_file_system.cpp" />
|
||||||
<ClCompile Include="src\hw\hardware.cpp" />
|
<ClCompile Include="src\hw\hw.cpp" />
|
||||||
<ClCompile Include="src\loader.cpp" />
|
<ClCompile Include="src\loader.cpp" />
|
||||||
<ClCompile Include="src\mem_map.cpp" />
|
<ClCompile Include="src\mem_map.cpp" />
|
||||||
<ClCompile Include="src\mem_map_funcs.cpp" />
|
<ClCompile Include="src\mem_map_funcs.cpp" />
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
<ClCompile Include="src\arm\interpreter\arm_interpreter.cpp">
|
<ClCompile Include="src\arm\interpreter\arm_interpreter.cpp">
|
||||||
<Filter>arm\interpreter</Filter>
|
<Filter>arm\interpreter</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\hw\hardware.cpp">
|
<ClCompile Include="src\hw\hw.cpp">
|
||||||
<Filter>hw</Filter>
|
<Filter>hw</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (C) 2013 Citrus Emulator
|
* Copyright (C) 2013 Citrus Emulator
|
||||||
*
|
*
|
||||||
* @file arm_interpreter.h
|
* @file arm_interpreter.h
|
||||||
* @author bunnei
|
* @author bunnei
|
||||||
* @date 2014-04-04
|
* @date 2014-04-04
|
||||||
* @brief ARM interface instance for SkyEye interprerer
|
* @brief ARM interface instance for SkyEye interprerer
|
||||||
*
|
*
|
||||||
* @section LICENSE
|
* @section LICENSE
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License as
|
* modify it under the terms of the GNU General Public License as
|
||||||
* published by the Free Software Foundation; either version 2 of
|
* published by the Free Software Foundation; either version 2 of
|
||||||
* the License, or (at your option) any later version.
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details at
|
* General Public License for more details at
|
||||||
* http://www.gnu.org/copyleft/gpl.html
|
* http://www.gnu.org/copyleft/gpl.html
|
||||||
*
|
*
|
||||||
* Official project repository can be found at:
|
* Official project repository can be found at:
|
||||||
* http://code.google.com/p/gekko-gc-emu/
|
* http://code.google.com/p/gekko-gc-emu/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "arm_interpreter.h"
|
#include "arm_interpreter.h"
|
||||||
|
|
||||||
|
@ -55,6 +55,9 @@ void Stop();
|
|||||||
/// Initialize the core
|
/// Initialize the core
|
||||||
int Init();
|
int Init();
|
||||||
|
|
||||||
|
/// Shutdown the core
|
||||||
|
void Shutdown();
|
||||||
|
|
||||||
ARMul_State* GetState();
|
ARMul_State* GetState();
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -29,42 +29,34 @@ namespace HW {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void Read(T &var, const u32 addr) {
|
inline void Read(T &var, const u32 addr) {
|
||||||
// TODO: Figure out the fastest order of tests for both read and write (they are probably different).
|
NOTICE_LOG(HW, "Hardware read from address %08X", addr);
|
||||||
// TODO: Make sure this represents the mirrors in a correct way.
|
|
||||||
|
|
||||||
// Could just do a base-relative read, too.... TODO
|
|
||||||
|
|
||||||
//if ((addr & 0x3E000000) == 0x08000000) {
|
|
||||||
// var = *((const T*)&g_fcram[addr & MEM_FCRAM_MASK]);
|
|
||||||
|
|
||||||
//} else {
|
|
||||||
// _assert_msg_(HW, false, "unknown hardware read");
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void Write(u32 addr, const T data) {
|
inline void Write(u32 addr, const T data) {
|
||||||
//// ExeFS:/.code is loaded here:
|
NOTICE_LOG(HW, "Hardware write to address %08X", addr);
|
||||||
//if ((addr & 0xFFF00000) == 0x00100000) {
|
|
||||||
// // TODO(ShizZy): This is dumb... handle correctly. From 3DBrew:
|
|
||||||
// // http://3dbrew.org/wiki/Memory_layout#ARM11_User-land_memory_regions
|
|
||||||
// // The ExeFS:/.code is loaded here, executables must be loaded to the 0x00100000 region when
|
|
||||||
// // the exheader "special memory" flag is clear. The 0x03F00000-byte size restriction only
|
|
||||||
// // applies when this flag is clear. Executables are usually loaded to 0x14000000 when the
|
|
||||||
// // exheader "special memory" flag is set, however this address can be arbitrary.
|
|
||||||
// *(T*)&g_fcram[addr & MEM_FCRAM_MASK] = data;
|
|
||||||
|
|
||||||
//// Error out...
|
|
||||||
//} else {
|
|
||||||
// _assert_msg_(HW, false, "unknown hardware write");
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Explicitly instantiate template functions because we aren't defining this in the header:
|
||||||
|
|
||||||
|
template void Read<u64>(u64 &var, const u32 addr);
|
||||||
|
template void Read<u32>(u32 &var, const u32 addr);
|
||||||
|
template void Read<u16>(u16 &var, const u32 addr);
|
||||||
|
template void Read<u8>(u8 &var, const u32 addr);
|
||||||
|
|
||||||
|
template void Write<const u64>(u32 addr, const u64 data);
|
||||||
|
template void Write<const u32>(u32 addr, const u32 data);
|
||||||
|
template void Write<const u16>(u32 addr, const u16 data);
|
||||||
|
template void Write<const u8>(u32 addr, const u8 data);
|
||||||
|
|
||||||
|
/// Initialize hardware
|
||||||
void Init() {
|
void Init() {
|
||||||
|
NOTICE_LOG(HW, "Hardware initialized OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Shutdown hardware
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
|
NOTICE_LOG(HW, "Hardware shutdown OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -32,4 +32,10 @@ inline void Read(T &var, const u32 addr);
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
inline void Write(u32 addr, const T data);
|
inline void Write(u32 addr, const T data);
|
||||||
|
|
||||||
|
/// Initialize hardware
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
/// Shutdown hardware
|
||||||
|
void Shutdown();
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include "mem_map.h"
|
#include "mem_map.h"
|
||||||
|
#include "hw/hw.h"
|
||||||
|
|
||||||
namespace Memory {
|
namespace Memory {
|
||||||
|
|
||||||
@ -32,10 +33,15 @@ template <typename T>
|
|||||||
inline void _Read(T &var, const u32 addr) {
|
inline void _Read(T &var, const u32 addr) {
|
||||||
// TODO: Figure out the fastest order of tests for both read and write (they are probably different).
|
// TODO: Figure out the fastest order of tests for both read and write (they are probably different).
|
||||||
// TODO: Make sure this represents the mirrors in a correct way.
|
// TODO: Make sure this represents the mirrors in a correct way.
|
||||||
|
|
||||||
// Could just do a base-relative read, too.... TODO
|
// Could just do a base-relative read, too.... TODO
|
||||||
|
|
||||||
if ((addr & 0x3E000000) == 0x08000000) {
|
// Hardware I/O register reads
|
||||||
|
// 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space
|
||||||
|
if ((addr & 0xFF000000) == 0x10000000 || (addr & 0xFF000000) == 0x1E000000) {
|
||||||
|
HW::Read<T>(var, addr);
|
||||||
|
|
||||||
|
// FCRAM virtual address reads
|
||||||
|
} else if ((addr & 0x3E000000) == 0x08000000) {
|
||||||
var = *((const T*)&g_fcram[addr & MEM_FCRAM_MASK]);
|
var = *((const T*)&g_fcram[addr & MEM_FCRAM_MASK]);
|
||||||
|
|
||||||
// Scratchpad memory
|
// Scratchpad memory
|
||||||
@ -60,8 +66,14 @@ inline void _Read(T &var, const u32 addr) {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void _Write(u32 addr, const T data) {
|
inline void _Write(u32 addr, const T data) {
|
||||||
|
|
||||||
|
// Hardware I/O register writes
|
||||||
|
// 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space
|
||||||
|
if ((addr & 0xFF000000) == 0x10000000 || (addr & 0xFF000000) == 0x1E000000) {
|
||||||
|
HW::Write<const T>(addr, data);
|
||||||
|
|
||||||
// ExeFS:/.code is loaded here:
|
// ExeFS:/.code is loaded here:
|
||||||
if ((addr & 0xFFF00000) == 0x00100000) {
|
} else if ((addr & 0xFFF00000) == 0x00100000) {
|
||||||
// TODO(ShizZy): This is dumb... handle correctly. From 3DBrew:
|
// TODO(ShizZy): This is dumb... handle correctly. From 3DBrew:
|
||||||
// http://3dbrew.org/wiki/Memory_layout#ARM11_User-land_memory_regions
|
// http://3dbrew.org/wiki/Memory_layout#ARM11_User-land_memory_regions
|
||||||
// The ExeFS:/.code is loaded here, executables must be loaded to the 0x00100000 region when
|
// The ExeFS:/.code is loaded here, executables must be loaded to the 0x00100000 region when
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
|
#include "hw/hw.h"
|
||||||
#include "core_timing.h"
|
#include "core_timing.h"
|
||||||
#include "mem_map.h"
|
#include "mem_map.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
@ -38,6 +39,7 @@ void UpdateState(State state) {
|
|||||||
void Init(EmuWindow* emu_window) {
|
void Init(EmuWindow* emu_window) {
|
||||||
Core::Init();
|
Core::Init();
|
||||||
Memory::Init();
|
Memory::Init();
|
||||||
|
HW::Init();
|
||||||
CoreTiming::Init();
|
CoreTiming::Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,6 +51,8 @@ void RunLoopUntil(u64 global_cycles) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
|
Core::Shutdown();
|
||||||
|
HW::Shutdown();
|
||||||
g_ctr_file_system.Shutdown();
|
g_ctr_file_system.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user