Update structure to a binary and machine util and a64inst modules
This commit is contained in:
parent
c4e3493fdc
commit
954be5f8f4
@ -1,7 +1,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "emulator/a64instruction/a64instruction.h"
|
||||
#include "emulator/a64instruction/a64instruction_global.h"
|
||||
#include "shared/a64instruction/a64instruction.h"
|
||||
#include "shared/a64instruction/a64instruction_global.h"
|
||||
#include "emulator/emulator.h"
|
||||
#include "emulator/fileio.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "decode.h"
|
||||
#include "binary_util.h"
|
||||
#include "../shared/binary_util.h"
|
||||
|
||||
// Given a binary word, return its internal representation as an a64instruction struct encoding the same
|
||||
// information.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#include "../global.h"
|
||||
#include "a64instruction/a64instruction.h"
|
||||
#include "../shared/a64instruction/a64instruction.h"
|
||||
|
||||
#define HALT_WORD 0x8a000000
|
||||
|
||||
|
||||
@ -3,14 +3,6 @@
|
||||
#include "../global.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
/************************************
|
||||
* DEFINITIONS
|
||||
************************************/
|
||||
|
||||
#define BYTE_BITS 8
|
||||
#define WORD_BITS (BYTE_BITS * sizeof(word))
|
||||
#define DWORD_BITS (BYTE_BITS * sizeof(dword))
|
||||
|
||||
/************************************
|
||||
* STRUCTS
|
||||
************************************/
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#include <assert.h>
|
||||
#include "execute.h"
|
||||
#include "print.h"
|
||||
#include "binary_util.h"
|
||||
#include "../shared/binary_util.h"
|
||||
#include "machine_util.h"
|
||||
|
||||
// Defines the maximum value that can be held in a register
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#ifndef __EXECUTE__
|
||||
#define __EXECUTE__
|
||||
#include "a64instruction/a64instruction.h"
|
||||
#include "../shared/a64instruction/a64instruction.h"
|
||||
#include "emulator.h"
|
||||
|
||||
void execute(Machine *state, a64inst_instruction *inst);
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
/** Machine Util */
|
||||
#include "assert.h"
|
||||
#include "machine_util.h"
|
||||
#include "a64instruction/a64instruction_global.h"
|
||||
#include "../shared/a64instruction/a64instruction_global.h"
|
||||
#include "../global.h"
|
||||
#include "emulator.h"
|
||||
#include "binary_util.h"
|
||||
#include "../shared/binary_util.h"
|
||||
|
||||
// Returns the dword starting at address. The value is truncated if regType is a 64-bit register.
|
||||
dword readMemory(byte *memory, uint32_t address, a64inst_regType regType) {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#ifndef __MACHINE_UTIL__
|
||||
#define __MACHINE_UTIL__
|
||||
#include "../global.h"
|
||||
#include "a64instruction/a64instruction_global.h"
|
||||
#include "../shared/a64instruction/a64instruction_global.h"
|
||||
#include "emulator.h"
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include "print.h"
|
||||
#include "a64instruction/a64instruction_global.h"
|
||||
#include "../shared/a64instruction/a64instruction_global.h"
|
||||
#include "emulator.h"
|
||||
#include "machine_util.h"
|
||||
|
||||
|
||||
@ -9,6 +9,11 @@
|
||||
#define __GLOBAL__
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/************************************
|
||||
* DEFINITIONS
|
||||
************************************/
|
||||
|
||||
// Number of General Purpose Registers.
|
||||
#define REGISTER_COUNT 31
|
||||
// Register identifier interpreted as the 'zero register'
|
||||
@ -27,4 +32,8 @@ typedef uint32_t word;
|
||||
// Double word is a 64-bit unsigned integer.
|
||||
typedef uint64_t dword;
|
||||
|
||||
#define BYTE_BITS 8
|
||||
#define WORD_BITS (BYTE_BITS * sizeof(word))
|
||||
#define DWORD_BITS (BYTE_BITS * sizeof(dword))
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
#include <stdbool.h>
|
||||
#include "a64instruction_global.h"
|
||||
#include "../../global.h"
|
||||
|
||||
typedef enum {
|
||||
a64inst_UNCONDITIONAL = 0,
|
||||
@ -1,4 +1,4 @@
|
||||
#include "../../global.h"
|
||||
#include "./a64instruction_global.h"
|
||||
|
||||
typedef struct {
|
||||
dword value;
|
||||
@ -1,6 +1,5 @@
|
||||
#include <stdbool.h>
|
||||
#include "a64instruction_global.h"
|
||||
#include "../../global.h"
|
||||
|
||||
typedef enum {
|
||||
a64inst_SINGLE_TRANSFER_SINGLE_DATA_TRANSFER = 1,
|
||||
@ -1,6 +1,7 @@
|
||||
#ifndef __A64INSTRUCTION_GLOBAL__
|
||||
#define __A64INSTRUCTION_GLOBAL__
|
||||
#include <stdint.h>
|
||||
#include "../../global.h"
|
||||
|
||||
// Specifies the register being referred to
|
||||
typedef uint8_t a64inst_regSpecifier;
|
||||
@ -1,10 +1,9 @@
|
||||
#ifndef __BINARY_UTIL__
|
||||
#define __BINARY_UTIL__
|
||||
|
||||
#include "emulator.h"
|
||||
#include "../global.h"
|
||||
#include "a64instruction/a64instruction_global.h"
|
||||
|
||||
|
||||
word getBits(word wrd, uint8_t lsb, uint8_t msb);
|
||||
|
||||
dword max(dword a, dword b);
|
||||
Loading…
Reference in New Issue
Block a user