Applied the mainline PCem AGI stall commit;

Fixed the mouse list order mess.
This commit is contained in:
OBattler
2017-07-24 18:42:29 +02:00
parent abf5b44b08
commit 9919de86ff
10 changed files with 852 additions and 783 deletions

View File

@@ -1,4 +1,8 @@
#ifndef _CODEGEN_H_
#define _CODEGEN_H_
#include "../mem.h"
#include "x86_ops.h"
#ifdef __amd64__
#include "codegen_x86-64.h"
@@ -35,10 +39,10 @@
typedef struct codeblock_t
{
uint64_t page_mask, page_mask2;
uint64_t page_mask, page_mask2;
uint64_t *dirty_mask, *dirty_mask2;
uint64_t cmp;
uint64_t cmp;
/*Previous and next pointers, for the codeblock list associated with
each physical page. Two sets of pointers, as a codeblock can be
present in two pages.*/
@@ -59,7 +63,7 @@ typedef struct codeblock_t
uint32_t _cs;
uint32_t endpc;
uint32_t phys, phys_2;
uint32_t status;
uint32_t status;
uint32_t flags;
uint8_t data[2048];
@@ -70,7 +74,7 @@ typedef struct codeblock_t
/*Code block is always entered with the same FPU top-of-stack*/
#define CODEBLOCK_STATIC_TOP 2
static __inline codeblock_t *codeblock_tree_find(uint32_t phys, uint32_t _cs)
static inline codeblock_t *codeblock_tree_find(uint32_t phys, uint32_t _cs)
{
codeblock_t *block = pages[phys >> 12].head;
uint64_t a = _cs | ((uint64_t)phys << 32);
@@ -88,7 +92,7 @@ static __inline codeblock_t *codeblock_tree_find(uint32_t phys, uint32_t _cs)
return block;
}
static __inline void codeblock_tree_add(codeblock_t *new_block)
static inline void codeblock_tree_add(codeblock_t *new_block)
{
codeblock_t *block = pages[new_block->phys >> 12].head;
uint64_t a = new_block->_cs | ((uint64_t)new_block->phys << 32);
@@ -122,7 +126,7 @@ static __inline void codeblock_tree_add(codeblock_t *new_block)
}
}
static __inline void codeblock_tree_delete(codeblock_t *block)
static inline void codeblock_tree_delete(codeblock_t *block)
{
codeblock_t *parent = block->parent;
@@ -252,6 +256,7 @@ void codegen_block_init(uint32_t phys_addr);
void codegen_block_remove();
void codegen_block_start_recompile(codeblock_t *block);
void codegen_block_end_recompile(codeblock_t *block);
void codegen_block_end();
void codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_pc, uint32_t old_pc);
void codegen_generate_seg_restore();
void codegen_set_op32();
@@ -300,7 +305,7 @@ extern int block_pos;
#define CPU_BLOCK_END() cpu_block_end = 1
static __inline void addbyte(uint8_t val)
static inline void addbyte(uint8_t val)
{
codeblock[block_current].data[block_pos++] = val;
if (block_pos >= BLOCK_MAX)
@@ -309,10 +314,10 @@ static __inline void addbyte(uint8_t val)
}
}
static __inline void addword(uint16_t val)
static inline void addword(uint16_t val)
{
uint16_t *p = (uint16_t *)&codeblock[block_current].data[block_pos];
*p = val;
uint16_t *p = (uint16_t *) &codeblock[block_current].data[block_pos];
*p = val;
block_pos += 2;
if (block_pos >= BLOCK_MAX)
{
@@ -320,10 +325,10 @@ static __inline void addword(uint16_t val)
}
}
static __inline void addlong(uint32_t val)
static inline void addlong(uint32_t val)
{
uint32_t *p = (uint32_t *)&codeblock[block_current].data[block_pos];
*p = val;
uint32_t *p = (uint32_t *) &codeblock[block_current].data[block_pos];
*p = val;
block_pos += 4;
if (block_pos >= BLOCK_MAX)
{
@@ -331,10 +336,10 @@ static __inline void addlong(uint32_t val)
}
}
static __inline void addquad(uint64_t val)
static inline void addquad(uint64_t val)
{
uint64_t *p = (uint64_t *)&codeblock[block_current].data[block_pos];
*p = val;
uint64_t *p = (uint64_t *) &codeblock[block_current].data[block_pos];
*p = val;
block_pos += 8;
if (block_pos >= BLOCK_MAX)
{
@@ -360,3 +365,5 @@ extern int codegen_fpu_loaded_iq[8];
extern int codegen_reg_loaded[8];
extern int codegen_in_recompile;
#endif