mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-22 15:29:58 +00:00
Move big-endian memory access to memreadwrite.h.
This commit is contained in:
parent
14e203f528
commit
241031dfe7
@ -14,6 +14,7 @@
|
||||
#include <array>
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
#include "memreadwrite.h"
|
||||
#include "ppcemu.h"
|
||||
#include "ppcmmu.h"
|
||||
#include "devices/memctrlbase.h"
|
||||
@ -65,10 +66,9 @@ void msr_status_update(){
|
||||
msr_dr_test = (ppc_state.ppc_msr >> 4) & 1;
|
||||
}
|
||||
|
||||
static inline void ppc_set_cur_instruction(unsigned char *ptr, uint32_t offset)
|
||||
static inline void ppc_set_cur_instruction(const uint8_t *ptr)
|
||||
{
|
||||
ppc_cur_instruction = (ptr[offset] << 24) | (ptr[offset+1] << 16) |
|
||||
(ptr[offset+2] << 8) | ptr[offset+3];
|
||||
ppc_cur_instruction = READ_DWORD_BE(ptr);
|
||||
}
|
||||
|
||||
static inline void ppc_set_return_val(unsigned char *ptr, uint32_t offset,
|
||||
|
@ -4,10 +4,6 @@
|
||||
#include <cinttypes>
|
||||
#include <string>
|
||||
|
||||
#define READ_WORD_BE(addr) ((addr)[0] << 16) | (addr)[1]
|
||||
#define READ_DWORD_BE(addr) ((addr)[0] << 24) | ((addr)[1] << 16) | ((addr)[2] << 8) | (addr)[3]
|
||||
#define READ_DWORD_LE(addr) ((addr)[3] << 24) | ((addr)[2] << 16) | ((addr)[1] << 8) | (addr)[0]
|
||||
|
||||
/** Abstract class representing a simple, memory-mapped I/O device */
|
||||
class MMIODevice {
|
||||
public:
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <cstring>
|
||||
#include <cinttypes>
|
||||
|
||||
#include "memreadwrite.h"
|
||||
#include "memctrlbase.h"
|
||||
#include "mmiodevice.h"
|
||||
#include "mpc106.h"
|
||||
|
19
memreadwrite.h
Normal file
19
memreadwrite.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef MEM_READ_WRITE_H
|
||||
#define MEM_READ_WRITE_H
|
||||
|
||||
/** @file Set of macros for accessing integers of various sizes and endianness
|
||||
in host memory.
|
||||
*/
|
||||
|
||||
/* read a unaligned big-endian WORD (16bit) */
|
||||
#define READ_WORD_BE(addr) (((addr)[0] << 16) | (addr)[1])
|
||||
|
||||
/* read a unaligned big-endian DWORD (32bit) */
|
||||
#define READ_DWORD_BE(addr) (((addr)[0] << 24) | ((addr)[1] << 16) | \
|
||||
((addr)[2] << 8) | (addr)[3])
|
||||
|
||||
/* read a unaligned little-endian DWORD (32bit) */
|
||||
#define READ_DWORD_LE(addr) (((addr)[3] << 24) | ((addr)[2] << 16) | \
|
||||
((addr)[1] << 8) | (addr)[0])
|
||||
|
||||
#endif /* MEM_READ_WRITE_H */
|
Loading…
Reference in New Issue
Block a user