Formatting cleanup

This commit is contained in:
Dimitris Panokostas 2020-05-23 22:36:28 +02:00
parent ec06c1ecaa
commit 3e214e6ed7
2 changed files with 167 additions and 147 deletions

View file

@ -107,16 +107,16 @@ STATIC_INLINE void set_cycles (unsigned long int x)
eventtab[ev_hsync].oldcycles = x;
}
STATIC_INLINE int current_hpos (void)
STATIC_INLINE int current_hpos(void)
{
int hp = (get_cycles () - eventtab[ev_hsync].oldcycles) / CYCLE_UNIT;
return hp;
const int hp = (get_cycles() - eventtab[ev_hsync].oldcycles) / CYCLE_UNIT;
return hp;
}
STATIC_INLINE bool cycles_in_range (unsigned long endcycles)
{
signed long c = get_cycles ();
return (signed long)endcycles - c > 0;
const signed long c = get_cycles ();
return static_cast<signed long>(endcycles) - c > 0;
}
extern void MISC_handler (void);
@ -125,7 +125,7 @@ extern void event2_newevent_x_replace(evt t, uae_u32 data, evfunc2 func);
STATIC_INLINE void event2_newevent_x (int no, evt t, uae_u32 data, evfunc2 func)
{
if (((int)t) <= 0) {
if (static_cast<int>(t) <= 0) {
func (data);
return;
}
@ -143,7 +143,7 @@ STATIC_INLINE void event2_newevent2 (evt t, uae_u32 data, evfunc2 func)
STATIC_INLINE void event2_remevent (int no)
{
eventtab2[no].active = 0;
eventtab2[no].active = false;
}
#endif /* UAE_EVENTS_H */

View file

@ -1,4 +1,4 @@
/*
/*
* UAE - The Un*x Amiga Emulator
*
* MC68000 emulation
@ -20,12 +20,13 @@ extern int movem_index1[256];
extern int movem_index2[256];
extern int movem_next[256];
typedef uae_u32 REGPARAM3 cpuop_func (uae_u32) REGPARAM;
typedef void REGPARAM3 cpuop_func_ce (uae_u32) REGPARAM;
typedef uae_u32 REGPARAM3 cpuop_func(uae_u32) REGPARAM;
typedef void REGPARAM3 cpuop_func_ce(uae_u32) REGPARAM;
struct cputbl {
cpuop_func *handler;
uae_u16 opcode;
struct cputbl
{
cpuop_func* handler;
uae_u16 opcode;
uae_s8 length;
uae_s8 disp020[2];
uae_u8 branch;
@ -34,7 +35,7 @@ struct cputbl {
#ifdef JIT
#define MIN_JIT_CACHE 128
#define MAX_JIT_CACHE 16384
typedef uae_u32 REGPARAM3 compop_func (uae_u32) REGPARAM;
typedef uae_u32 REGPARAM3 compop_func(uae_u32) REGPARAM;
#define COMP_OPCODE_ISJUMP 0x0001
#define COMP_OPCODE_LONG_OPCODE 0x0002
@ -43,17 +44,18 @@ typedef uae_u32 REGPARAM3 compop_func (uae_u32) REGPARAM;
#define COMP_OPCODE_ISCJUMP 0x0010
#define COMP_OPCODE_USES_FPU 0x0020
struct comptbl {
compop_func *handler;
uae_u32 specific;
uae_u32 opcode;
struct comptbl
{
compop_func* handler;
uae_u32 specific;
uae_u32 opcode;
};
#else
#define MIN_JIT_CACHE 0
#define MAX_JIT_CACHE 0
#endif
extern uae_u32 REGPARAM3 op_illg (uae_u32) REGPARAM;
extern uae_u32 REGPARAM3 op_illg(uae_u32) REGPARAM;
typedef uae_u8 flagtype;
@ -64,9 +66,10 @@ typedef double fptype;
struct mmufixup
{
int reg;
uae_u32 value;
int reg;
uae_u32 value;
};
extern struct mmufixup mmufixup[1];
typedef struct
@ -81,37 +84,37 @@ typedef struct
struct regstruct
{
uae_u32 regs[16];
struct flag_struct ccrflags;
uae_u32 regs[16];
struct flag_struct ccrflags;
uae_u32 pc;
uae_u8 *pc_p;
uae_u8 *pc_oldp;
uae_u32 pc;
uae_u8* pc_p;
uae_u8* pc_oldp;
uae_u16 opcode;
uae_u32 instruction_pc;
uae_u16 irc, ir, db;
volatile uae_atomic spcflags;
uaecptr usp, isp, msp;
uae_u16 sr;
flagtype t1;
flagtype t0;
flagtype s;
flagtype m;
flagtype x;
flagtype stopped;
int halted;
int intmask;
uae_u32 instruction_pc;
uae_u32 vbr,sfc,dfc;
uae_u16 irc, ir, db;
volatile uae_atomic spcflags;
uaecptr usp, isp, msp;
uae_u16 sr;
flagtype t1;
flagtype t0;
flagtype s;
flagtype m;
flagtype x;
flagtype stopped;
int halted;
int intmask;
uae_u32 vbr, sfc, dfc;
#ifdef FPUEMU
fpdata fp[8];
#ifdef JIT
fpdata fp_result;
#endif
uae_u32 fpcr,fpsr, fpiar;
uae_u32 fpcr, fpsr, fpiar;
uae_u32 fpu_state;
uae_u32 fpu_exp_state;
uaecptr fp_ea;
@ -121,27 +124,27 @@ struct regstruct
bool fp_exception;
bool fp_branch;
#endif
uae_u32 cacr, caar;
uae_u32 itt0, itt1, dtt0, dtt1;
uae_u32 tcr, mmusr, urp, srp, buscr;
uae_u32 cacr, caar;
uae_u32 itt0, itt1, dtt0, dtt1;
uae_u32 tcr, mmusr, urp, srp, buscr;
uae_u32 pcr;
uae_u32 address_space_mask;
uae_u32 pcr;
uae_u32 address_space_mask;
uae_s32 pissoff;
uae_s32 pissoff;
uae_u8* natmem_offset;
#ifdef JIT
/* store scratch regs also in this struct to avoid load of mem pointer */
uae_u32 scratchregs[VREGS - S1];
fpu_register scratchfregs[VFREGS - 8];
uae_u32 jit_exception;
/* pointer to real arrays/structs for easier access in JIT */
uae_u32 *raw_cputbl_count;
uintptr mem_banks;
uintptr cache_tags;
#endif
/* store scratch regs also in this struct to avoid load of mem pointer */
uae_u32 scratchregs[VREGS - S1];
fpu_register scratchfregs[VFREGS - 8];
uae_u32 jit_exception;
/* pointer to real arrays/structs for easier access in JIT */
uae_u32* raw_cputbl_count;
uintptr mem_banks;
uintptr cache_tags;
#endif
};
extern struct regstruct regs;
@ -152,7 +155,7 @@ extern struct regstruct regs;
STATIC_INLINE uae_u32 munge24(uae_u32 x)
{
return x & regs.address_space_mask;
return x & regs.address_space_mask;
}
extern int cpu_cycles;
@ -162,13 +165,14 @@ STATIC_INLINE void set_special_exter(uae_u32 x)
{
atomic_or(&regs.spcflags, x);
}
STATIC_INLINE void set_special (uae_u32 x)
STATIC_INLINE void set_special(uae_u32 x)
{
atomic_or(&regs.spcflags, x);
cycles_do_special();
cycles_do_special();
}
STATIC_INLINE void unset_special (uae_u32 x)
STATIC_INLINE void unset_special(uae_u32 x)
{
atomic_and(&regs.spcflags, ~x);
}
@ -176,12 +180,12 @@ STATIC_INLINE void unset_special (uae_u32 x)
#define m68k_dreg(r,num) ((r).regs[(num)])
#define m68k_areg(r,num) (((r).regs + 8)[(num)])
extern uae_u32(*x_get_byte)(uaecptr addr);
extern uae_u32(*x_get_word)(uaecptr addr);
extern uae_u32(*x_get_long)(uaecptr addr);
extern void(*x_put_byte)(uaecptr addr, uae_u32 v);
extern void(*x_put_word)(uaecptr addr, uae_u32 v);
extern void(*x_put_long)(uaecptr addr, uae_u32 v);
extern uae_u32 (*x_get_byte)(uaecptr addr);
extern uae_u32 (*x_get_word)(uaecptr addr);
extern uae_u32 (*x_get_long)(uaecptr addr);
extern void (*x_put_byte)(uaecptr addr, uae_u32 v);
extern void (*x_put_word)(uaecptr addr, uae_u32 v);
extern void (*x_put_long)(uaecptr addr, uae_u32 v);
#define x_cp_get_byte x_get_byte
#define x_cp_get_word x_get_word
@ -196,20 +200,23 @@ extern void(*x_put_long)(uaecptr addr, uae_u32 v);
/* direct (regs.pc_p) access */
STATIC_INLINE void m68k_setpc (uaecptr newpc)
STATIC_INLINE void m68k_setpc(uaecptr newpc)
{
regs.pc_p = regs.pc_oldp = get_real_address (newpc);
regs.instruction_pc = regs.pc = newpc;
regs.pc_p = regs.pc_oldp = get_real_address(newpc);
regs.instruction_pc = regs.pc = newpc;
}
STATIC_INLINE void m68k_setpc_j(uaecptr newpc)
{
regs.pc_p = regs.pc_oldp = get_real_address(newpc);
regs.pc = newpc;
}
STATIC_INLINE uaecptr m68k_getpc (void)
STATIC_INLINE uaecptr m68k_getpc(void)
{
return (uaecptr)(regs.pc + ((uae_u8*)regs.pc_p - (uae_u8*)regs.pc_oldp));
return static_cast<uaecptr>(regs.pc + (static_cast<uae_u8*>(regs.pc_p) - static_cast<uae_u8*>(regs.pc_oldp)));
}
#define M68K_GETPC m68k_getpc()
STATIC_INLINE void m68k_incpc(int o)
{
@ -218,40 +225,45 @@ STATIC_INLINE void m68k_incpc(int o)
STATIC_INLINE uae_u32 get_dibyte(int o)
{
return do_get_mem_byte((uae_u8 *)((regs).pc_p + (o) + 1));
}
STATIC_INLINE uae_u32 get_diword(int o)
{
return do_get_mem_word((uae_u16 *)((regs).pc_p + (o)));
}
STATIC_INLINE uae_u32 get_dilong(int o)
{
return do_get_mem_long((uae_u32 *)((regs).pc_p + (o)));
}
STATIC_INLINE uae_u32 next_diword (void)
{
uae_u32 r = do_get_mem_word((uae_u16 *)((regs).pc_p));
m68k_incpc (2);
return r;
}
STATIC_INLINE uae_u32 next_dilong (void)
{
uae_u32 r = do_get_mem_long((uae_u32 *)((regs).pc_p));
m68k_incpc (4);
return r;
return do_get_mem_byte(static_cast<uae_u8*>((regs).pc_p + (o) + 1));
}
STATIC_INLINE void m68k_do_bsr (uaecptr oldpc, uae_s32 offset)
STATIC_INLINE uae_u32 get_diword(int o)
{
m68k_areg(regs, 7) -= 4;
put_long(m68k_areg(regs, 7), oldpc);
m68k_incpc (offset);
return do_get_mem_word((uae_u16*)((regs).pc_p + (o)));
}
STATIC_INLINE void m68k_do_rts (void)
STATIC_INLINE uae_u32 get_dilong(int o)
{
uae_u32 newpc = get_long (m68k_areg (regs, 7));
m68k_setpc (newpc);
m68k_areg(regs, 7) += 4;
return do_get_mem_long((uae_u32*)((regs).pc_p + (o)));
}
STATIC_INLINE uae_u32 next_diword(void)
{
uae_u32 r = do_get_mem_word((uae_u16*)((regs).pc_p));
m68k_incpc(2);
return r;
}
STATIC_INLINE uae_u32 next_dilong(void)
{
uae_u32 r = do_get_mem_long((uae_u32*)((regs).pc_p));
m68k_incpc(4);
return r;
}
STATIC_INLINE void m68k_do_bsr(uaecptr oldpc, uae_s32 offset)
{
m68k_areg(regs, 7) -= 4;
put_long(m68k_areg(regs, 7), oldpc);
m68k_incpc(offset);
}
STATIC_INLINE void m68k_do_rts(void)
{
uae_u32 newpc = get_long(m68k_areg(regs, 7));
m68k_setpc(newpc);
m68k_areg(regs, 7) += 4;
}
/* indirect (regs.pc) access */
@ -260,14 +272,17 @@ STATIC_INLINE void m68k_setpci(uaecptr newpc)
{
regs.instruction_pc = regs.pc = newpc;
}
STATIC_INLINE void m68k_setpci_j(uaecptr newpc)
{
regs.pc = newpc;
}
STATIC_INLINE uaecptr m68k_getpci(void)
{
return regs.pc;
}
STATIC_INLINE void m68k_incpci(int o)
{
regs.pc += o;
@ -279,6 +294,7 @@ STATIC_INLINE void m68k_do_bsri(uaecptr oldpc, uae_s32 offset)
x_put_long(m68k_areg(regs, 7), oldpc);
m68k_incpci(offset);
}
STATIC_INLINE void m68k_do_rtsi(void)
{
uae_u32 newpc = x_get_long(m68k_areg(regs, 7));
@ -298,10 +314,13 @@ STATIC_INLINE void m68k_incpc_normal(int o)
STATIC_INLINE void m68k_setpc_normal(uaecptr pc)
{
if (m68k_pc_indirect > 0) {
regs.pc_p = regs.pc_oldp = 0;
if (m68k_pc_indirect > 0)
{
regs.pc_p = regs.pc_oldp = nullptr;
m68k_setpci(pc);
} else {
}
else
{
m68k_setpc(pc);
}
}
@ -310,44 +329,45 @@ extern void check_t0_trace(void);
#define x_do_cycles(c) do_cycles(c)
extern void m68k_setstopped (void);
extern void m68k_setstopped(void);
extern void m68k_resumestopped(void);
extern void m68k_cancel_idle(void);
#define get_disp_ea_020(base,idx) _get_disp_ea_020(base)
extern uae_u32 REGPARAM3 _get_disp_ea_020 (uae_u32 base) REGPARAM;
extern uae_u32 REGPARAM3 _get_disp_ea_020(uae_u32 base) REGPARAM;
extern uae_u32 REGPARAM3 get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset, int width) REGPARAM;
extern void REGPARAM3 put_bitfield (uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s32 offset, int width) REGPARAM;
extern int get_cpu_model (void);
extern uae_u32 REGPARAM3 get_bitfield(uae_u32 src, uae_u32 bdata[2], uae_s32 offset, int width) REGPARAM;
extern void REGPARAM3 put_bitfield(uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s32 offset, int width) REGPARAM;
extern int get_cpu_model(void);
extern void set_cpu_caches (bool flush);
extern void set_cpu_caches(bool flush);
extern void flush_cpu_caches_040(uae_u16 opcode);
extern void REGPARAM3 MakeSR (void) REGPARAM;
extern void REGPARAM3 MakeFromSR (void) REGPARAM;
extern void REGPARAM3 MakeSR(void) REGPARAM;
extern void REGPARAM3 MakeFromSR(void) REGPARAM;
extern void REGPARAM3 MakeFromSR_T0(void) REGPARAM;
extern void REGPARAM3 Exception (int) REGPARAM;
extern void REGPARAM3 Exception(int) REGPARAM;
extern void REGPARAM3 Exception_cpu(int) REGPARAM;
extern void NMI (void);
extern void doint (void);
extern void dump_counts (void);
extern int m68k_move2c (int, uae_u32 *);
extern int m68k_movec2 (int, uae_u32 *);
extern void m68k_divl (uae_u32, uae_u32, uae_u16);
extern void m68k_mull (uae_u32, uae_u32, uae_u16);
extern void init_m68k (void);
extern void m68k_go (int);
extern void NMI(void);
extern void doint(void);
extern void dump_counts(void);
extern int m68k_move2c(int, uae_u32*);
extern int m68k_movec2(int, uae_u32*);
extern void m68k_divl(uae_u32, uae_u32, uae_u16);
extern void m68k_mull(uae_u32, uae_u32, uae_u16);
extern void init_m68k(void);
extern void m68k_go(int);
extern int getDivu68kCycles(uae_u32 dividend, uae_u16 divisor);
extern int getDivs68kCycles(uae_s32 dividend, uae_s16 divisor);
extern void divbyzero_special (bool issigned, uae_s32 dst);
extern void divbyzero_special(bool issigned, uae_s32 dst);
extern void setdivuoverflowflags(uae_u32 dividend, uae_u16 divisor);
extern void setdivsoverflowflags(uae_s32 dividend, uae_s16 divisor);
extern void setchkundefinedflags(uae_s32 src, uae_s32 dst, int size);
extern void setchk2undefinedflags(uae_u32 lower, uae_u32 upper, uae_u32 val, int size);
extern void protect_roms (bool);
extern void protect_roms(bool);
extern void Exception_build_stack_frame_common(uae_u32 oldpc, uae_u32 currpc, int nr);
extern void Exception_build_stack_frame(uae_u32 oldpc, uae_u32 currpc, uae_u32 ssw, int nr, int format);
extern void Exception_build_68000_address_error_stack_frame(uae_u16 mode, uae_u16 opcode, uaecptr fault_addr, uaecptr pc);
extern void Exception_build_68000_address_error_stack_frame(uae_u16 mode, uae_u16 opcode, uaecptr fault_addr,
uaecptr pc);
extern uae_u32 exception_pc(int nr);
void ccr_68000_long_move_ae_LZN(uae_s32 src);
@ -358,21 +378,21 @@ void ccr_68000_word_move_ae_normal(uae_s16 src);
STATIC_INLINE int bitset_count16(uae_u16 data)
{
unsigned int const MASK1 = 0x5555;
unsigned int const MASK2 = 0x3333;
unsigned int const MASK4 = 0x0f0f;
unsigned int const MASK6 = 0x003f;
unsigned int const MASK1 = 0x5555;
unsigned int const MASK2 = 0x3333;
unsigned int const MASK4 = 0x0f0f;
unsigned int const MASK6 = 0x003f;
unsigned int const w = (data & MASK1) + ((data >> 1) & MASK1);
unsigned int const x = (w & MASK2) + ((w >> 2) & MASK2);
unsigned int const y = ((x + (x >> 4)) & MASK4);
unsigned int const z = (y + (y >> 8)) & MASK6;
unsigned int const w = (data & MASK1) + ((data >> 1) & MASK1);
unsigned int const x = (w & MASK2) + ((w >> 2) & MASK2);
unsigned int const y = ((x + (x >> 4)) & MASK4);
unsigned int const z = (y + (y >> 8)) & MASK6;
return z;
return z;
}
extern void mmu_op (uae_u32, uae_u32);
extern bool mmu_op30 (uaecptr, uae_u32, uae_u16, uaecptr);
extern void mmu_op(uae_u32, uae_u32);
extern bool mmu_op30(uaecptr, uae_u32, uae_u16, uaecptr);
extern void fpuop_arithmetic(uae_u32, uae_u16);
extern void fpuop_dbcc(uae_u32, uae_u16);
@ -381,18 +401,18 @@ extern void fpuop_trapcc(uae_u32, uaecptr, uae_u16);
extern void fpuop_bcc(uae_u32, uaecptr, uae_u32);
extern void fpuop_save(uae_u32);
extern void fpuop_restore(uae_u32);
extern void fpu_reset (void);
extern void fpu_reset(void);
extern void exception3_read(uae_u32 opcode, uaecptr addr);
extern void exception3_write(uae_u32 opcode, uaecptr addr);
extern void exception3i (uae_u32 opcode, uaecptr addr);
extern void exception3b (uae_u32 opcode, uaecptr addr, bool w, bool i, uaecptr pc);
extern void exception2 (uaecptr addr, bool read, int size, uae_u32 fc);
extern void cpureset (void);
extern void cpu_halt (int id);
extern void exception3i(uae_u32 opcode, uaecptr addr);
extern void exception3b(uae_u32 opcode, uaecptr addr, bool w, bool i, uaecptr pc);
extern void exception2(uaecptr addr, bool read, int size, uae_u32 fc);
extern void cpureset(void);
extern void cpu_halt(int id);
extern int cpu_sleep_millis(int ms);
extern void fill_prefetch (void);
extern void fill_prefetch(void);
#define CPU_OP_NAME(a) op ## a
@ -414,7 +434,7 @@ extern const struct cputbl op_smalltbl_5_ff[];
extern const struct cputbl op_smalltbl_45_ff[];
extern const struct cputbl op_smalltbl_12_ff[]; // prefetch
extern cpuop_func *cpufunctbl[65536] ASM_SYM_FOR_FUNC ("cpufunctbl");
extern cpuop_func* cpufunctbl[65536] ASM_SYM_FOR_FUNC("cpufunctbl");
#ifdef JIT
extern void flush_icache(int);
@ -424,7 +444,7 @@ extern void compemu_reset(void);
#define flush_icache(int) do {} while (0)
#define flush_icache_hard(int) do {} while (0)
#endif
bool check_prefs_changed_comp (bool);
bool check_prefs_changed_comp(bool);
#define CPU_HALT_BUS_ERROR_DOUBLE_FAULT 1
#define CPU_HALT_DOUBLE_FAULT 2