Merge pull request #3753 from jriwanek-forks/clock
Future support for higher clocked CPU's + A little more lint
This commit is contained in:
@@ -882,7 +882,7 @@ pc_speed_changed(void)
|
||||
if (cpu_s->cpu_type >= CPU_286)
|
||||
pit_set_clock(cpu_s->rspeed);
|
||||
else
|
||||
pit_set_clock(14318184.0);
|
||||
pit_set_clock((uint32_t) 14318184.0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1368,7 +1368,7 @@ pc_run(void)
|
||||
|
||||
/* Run a block of code. */
|
||||
startblit();
|
||||
cpu_exec(cpu_s->rspeed / 100);
|
||||
cpu_exec((int32_t) cpu_s->rspeed / 100);
|
||||
#ifdef USE_GDBSTUB /* avoid a KBC FIFO overflow when CPU emulation is stalled */
|
||||
if (gdbstub_step == GDBSTUB_EXEC) {
|
||||
#endif
|
||||
|
||||
@@ -1845,7 +1845,7 @@ save_machine(void)
|
||||
ini_section_set_string(cat, "machine", p);
|
||||
|
||||
ini_section_set_string(cat, "cpu_family", cpu_f->internal_name);
|
||||
ini_section_set_int(cat, "cpu_speed", cpu_f->cpus[cpu].rspeed);
|
||||
ini_section_set_uint(cat, "cpu_speed", cpu_f->cpus[cpu].rspeed);
|
||||
ini_section_set_double(cat, "cpu_multi", cpu_f->cpus[cpu].multi);
|
||||
if (cpu_override)
|
||||
ini_section_set_int(cat, "cpu_override", cpu_override);
|
||||
|
||||
@@ -219,16 +219,16 @@ fetch_ea_16_long(uint32_t rmdat)
|
||||
#include "386_ops.h"
|
||||
|
||||
void
|
||||
exec386_2386(int cycs)
|
||||
exec386_2386(int32_t cycs)
|
||||
{
|
||||
int ol;
|
||||
|
||||
int vector;
|
||||
int tempi;
|
||||
int cycdiff;
|
||||
int oldcyc;
|
||||
int cycle_period;
|
||||
int ins_cycles;
|
||||
int32_t cycdiff;
|
||||
int32_t oldcyc;
|
||||
int32_t cycle_period;
|
||||
int32_t ins_cycles;
|
||||
uint32_t addr;
|
||||
|
||||
cycles += cycs;
|
||||
|
||||
@@ -226,12 +226,12 @@ fetch_ea_16_long(uint32_t rmdat)
|
||||
#define CACHE_ON() (!(cr0 & (1 << 30)) && !(cpu_state.flags & T_FLAG))
|
||||
|
||||
#ifdef USE_DYNAREC
|
||||
int cycles_main = 0;
|
||||
static int cycles_old = 0;
|
||||
int32_t cycles_main = 0;
|
||||
static int32_t cycles_old = 0;
|
||||
static uint64_t tsc_old = 0;
|
||||
|
||||
# ifdef USE_ACYCS
|
||||
int acycs = 0;
|
||||
int32_t acycs = 0;
|
||||
# endif
|
||||
|
||||
void
|
||||
@@ -676,24 +676,24 @@ exec386_dynarec_dyn(void)
|
||||
}
|
||||
|
||||
void
|
||||
exec386_dynarec(int cycs)
|
||||
exec386_dynarec(int32_t cycs)
|
||||
{
|
||||
int vector;
|
||||
int tempi;
|
||||
int cycdiff;
|
||||
int oldcyc;
|
||||
int oldcyc2;
|
||||
int32_t cycdiff;
|
||||
int32_t oldcyc;
|
||||
int32_t oldcyc2;
|
||||
uint64_t oldtsc;
|
||||
uint64_t delta;
|
||||
|
||||
int cyc_period = cycs / 2000; /*5us*/
|
||||
int32_t cyc_period = cycs / 2000; /*5us*/
|
||||
|
||||
# ifdef USE_ACYCS
|
||||
acycs = 0;
|
||||
# endif
|
||||
cycles_main += cycs;
|
||||
while (cycles_main > 0) {
|
||||
int cycles_start;
|
||||
int32_t cycles_start;
|
||||
|
||||
cycles += cyc_period;
|
||||
cycles_start = cycles;
|
||||
@@ -799,14 +799,14 @@ exec386_dynarec(int cycs)
|
||||
#endif
|
||||
|
||||
void
|
||||
exec386(int cycs)
|
||||
exec386(int32_t cycs)
|
||||
{
|
||||
int vector;
|
||||
int tempi;
|
||||
int cycdiff;
|
||||
int oldcyc;
|
||||
int cycle_period;
|
||||
int ins_cycles;
|
||||
int32_t cycdiff;
|
||||
int32_t oldcyc;
|
||||
int32_t cycle_period;
|
||||
int32_t ins_cycles;
|
||||
uint32_t addr;
|
||||
|
||||
cycles += cycs;
|
||||
|
||||
@@ -2063,7 +2063,7 @@ farret(int far)
|
||||
|
||||
/* Executes instructions up to the specified number of cycles. */
|
||||
void
|
||||
execx86(int cycs)
|
||||
execx86(int32_t cycs)
|
||||
{
|
||||
uint8_t temp = 0;
|
||||
uint8_t temp2;
|
||||
|
||||
@@ -258,7 +258,7 @@ CPU *cpu_s;
|
||||
uint8_t do_translate = 0;
|
||||
uint8_t do_translate2 = 0;
|
||||
|
||||
void (*cpu_exec)(int cycs);
|
||||
void (*cpu_exec)(int32_t cycs);
|
||||
|
||||
static uint8_t ccr0;
|
||||
static uint8_t ccr1;
|
||||
|
||||
@@ -143,7 +143,7 @@ typedef struct cpu_t {
|
||||
const char *name;
|
||||
uint64_t cpu_type;
|
||||
const FPU *fpus;
|
||||
int rspeed;
|
||||
uint32_t rspeed;
|
||||
double multi;
|
||||
uint16_t voltage;
|
||||
uint32_t edx_reset;
|
||||
@@ -166,9 +166,9 @@ typedef struct {
|
||||
} cpu_family_t;
|
||||
|
||||
typedef struct {
|
||||
const char *family;
|
||||
const int rspeed;
|
||||
const double multi;
|
||||
const char *family;
|
||||
const uint32_t rspeed;
|
||||
const double multi;
|
||||
} cpu_legacy_table_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -739,13 +739,13 @@ extern void codegen_block_end(void);
|
||||
extern void codegen_reset(void);
|
||||
extern void cpu_set_edx(void);
|
||||
extern int divl(uint32_t val);
|
||||
extern void execx86(int cycs);
|
||||
extern void execx86(int32_t cycs);
|
||||
extern void enter_smm(int in_hlt);
|
||||
extern void enter_smm_check(int in_hlt);
|
||||
extern void leave_smm(void);
|
||||
extern void exec386_2386(int cycs);
|
||||
extern void exec386(int cycs);
|
||||
extern void exec386_dynarec(int cycs);
|
||||
extern void exec386_2386(int32_t cycs);
|
||||
extern void exec386(int32_t cycs);
|
||||
extern void exec386_dynarec(int32_t cycs);
|
||||
extern int idivl(int32_t val);
|
||||
extern void resetmcr(void);
|
||||
extern void resetx86(void);
|
||||
@@ -814,7 +814,7 @@ extern int prefetch_prefixes;
|
||||
extern uint8_t use_custom_nmi_vector;
|
||||
extern uint32_t custom_nmi_vector;
|
||||
|
||||
extern void (*cpu_exec)(int cycs);
|
||||
extern void (*cpu_exec)(int32_t cycs);
|
||||
extern uint8_t do_translate;
|
||||
extern uint8_t do_translate2;
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ static gdbstub_client_t *first_client = NULL;
|
||||
static gdbstub_client_t *last_client = NULL;
|
||||
static mutex_t *client_list_mutex;
|
||||
|
||||
static void (*cpu_exec_shadow)(int cycs);
|
||||
static void (*cpu_exec_shadow)(int32_t cycs);
|
||||
static gdbstub_breakpoint_t *first_swbreak = NULL;
|
||||
static gdbstub_breakpoint_t *first_hwbreak = NULL;
|
||||
static gdbstub_breakpoint_t *first_rwatch = NULL;
|
||||
@@ -1373,7 +1373,7 @@ end:
|
||||
}
|
||||
|
||||
static void
|
||||
gdbstub_cpu_exec(int cycs)
|
||||
gdbstub_cpu_exec(int32_t cycs)
|
||||
{
|
||||
/* Flag that we're now in the debugger context to avoid triggering watchpoints. */
|
||||
in_gdbstub = 1;
|
||||
|
||||
@@ -37,6 +37,10 @@ extern void ini_close(ini_t ini);
|
||||
|
||||
extern void ini_section_delete_var(ini_section_t section, const char *name);
|
||||
extern int ini_section_get_int(ini_section_t section, const char *name, int def);
|
||||
extern uint32_t ini_section_get_uint(ini_section_t section, const char *name, uint32_t def);
|
||||
#if 0
|
||||
extern float ini_section_get_float(ini_section_t section, const char *name, float def);
|
||||
#endif
|
||||
extern double ini_section_get_double(ini_section_t section, const char *name, double def);
|
||||
extern int ini_section_get_hex16(ini_section_t section, const char *name, int def);
|
||||
extern int ini_section_get_hex20(ini_section_t section, const char *name, int def);
|
||||
@@ -44,6 +48,10 @@ extern int ini_section_get_mac(ini_section_t section, const char *name, int
|
||||
extern char *ini_section_get_string(ini_section_t section, const char *name, char *def);
|
||||
extern wchar_t *ini_section_get_wstring(ini_section_t section, const char *name, wchar_t *def);
|
||||
extern void ini_section_set_int(ini_section_t section, const char *name, int val);
|
||||
extern void ini_section_set_uint(ini_section_t section, const char *name, uint32_t val);
|
||||
#if 0
|
||||
extern void ini_section_set_float(ini_section_t section, const char *name, float val);
|
||||
#endif
|
||||
extern void ini_section_set_double(ini_section_t section, const char *name, double val);
|
||||
extern void ini_section_set_hex16(ini_section_t section, const char *name, int val);
|
||||
extern void ini_section_set_hex20(ini_section_t section, const char *name, int val);
|
||||
@@ -54,6 +62,10 @@ extern void ini_section_set_wstring(ini_section_t section, const char *name,
|
||||
#define ini_delete_var(ini, head, name) ini_section_delete_var(ini_find_section(ini, head), name)
|
||||
|
||||
#define ini_get_int(ini, head, name, def) ini_section_get_int(ini_find_section(ini, head), name, def)
|
||||
#define ini_get_uint(ini, head, name, def) ini_section_get_uint(ini_find_section(ini, head), name, def)
|
||||
#if 0
|
||||
#define ini_get_float(ini, head, name, def) ini_section_get_float(ini_find_section(ini, head), name, def)
|
||||
#endif
|
||||
#define ini_get_double(ini, head, name, def) ini_section_get_double(ini_find_section(ini, head), name, def)
|
||||
#define ini_get_hex16(ini, head, name, def) ini_section_get_hex16(ini_find_section(ini, head), name, def)
|
||||
#define ini_get_hex20(ini, head, name, def) ini_section_get_hex20(ini_find_section(ini, head), name, def)
|
||||
@@ -62,6 +74,10 @@ extern void ini_section_set_wstring(ini_section_t section, const char *name,
|
||||
#define ini_get_wstring(ini, head, name, def) ini_section_get_wstring(ini_find_section(ini, head), name, def)
|
||||
|
||||
#define ini_set_int(ini, head, name, val) ini_section_set_int(ini_find_or_create_section(ini, head), name, val)
|
||||
#define ini_set_uint(ini, head, name, val) ini_section_set_uint(ini_find_or_create_section(ini, head), name, val)
|
||||
#if 0
|
||||
#define ini_set_float(ini, head, name, val) ini_section_set_float(ini_find_or_create_section(ini, head), name, val)
|
||||
#endif
|
||||
#define ini_set_double(ini, head, name, val) ini_section_set_double(ini_find_or_create_section(ini, head), name, val)
|
||||
#define ini_set_hex16(ini, head, name, val) ini_section_set_hex16(ini_find_or_create_section(ini, head), name, val)
|
||||
#define ini_set_hex20(ini, head, name, val) ini_section_set_hex20(ini_find_or_create_section(ini, head), name, val)
|
||||
|
||||
@@ -447,8 +447,8 @@ extern void mem_close(void);
|
||||
extern void mem_reset(void);
|
||||
extern void mem_remap_top(int kb);
|
||||
|
||||
extern mem_mapping_t *read_mapping[MEM_MAPPINGS_NO];
|
||||
extern mem_mapping_t *write_mapping[MEM_MAPPINGS_NO];
|
||||
extern mem_mapping_t *read_mapping[MEM_MAPPINGS_NO];
|
||||
extern mem_mapping_t *write_mapping[MEM_MAPPINGS_NO];
|
||||
|
||||
#ifdef EMU_CPU_H
|
||||
static __inline uint32_t
|
||||
|
||||
@@ -128,7 +128,7 @@ extern void pit_speaker_timer(int new_out, int old_out);
|
||||
|
||||
extern void pit_nmi_timer_ps2(int new_out, int old_out);
|
||||
|
||||
extern void pit_set_clock(int clock);
|
||||
extern void pit_set_clock(uint32_t clock);
|
||||
extern void pit_handler(int set, uint16_t base, int size, void *priv);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
|
||||
76
src/ini.c
76
src/ini.c
@@ -560,6 +560,46 @@ ini_section_get_int(ini_section_t self, const char *name, int def)
|
||||
return value;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ini_section_get_uint(ini_section_t self, const char *name, uint32_t def)
|
||||
{
|
||||
section_t *section = (section_t *) self;
|
||||
const entry_t *entry;
|
||||
uint32_t value;
|
||||
|
||||
if (section == NULL)
|
||||
return def;
|
||||
|
||||
entry = find_entry(section, name);
|
||||
if (entry == NULL)
|
||||
return def;
|
||||
|
||||
sscanf(entry->data, "%u", &value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
#if 0
|
||||
float
|
||||
ini_section_get_float(ini_section_t self, const char *name, float def)
|
||||
{
|
||||
section_t *section = (section_t *) self;
|
||||
const entry_t *entry;
|
||||
float value;
|
||||
|
||||
if (section == NULL)
|
||||
return def;
|
||||
|
||||
entry = find_entry(section, name);
|
||||
if (entry == NULL)
|
||||
return def;
|
||||
|
||||
sscanf(entry->data, "%g", &value);
|
||||
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
double
|
||||
ini_section_get_double(ini_section_t self, const char *name, double def)
|
||||
{
|
||||
@@ -687,6 +727,42 @@ ini_section_set_int(ini_section_t self, const char *name, int val)
|
||||
mbstowcs(ent->wdata, ent->data, 512);
|
||||
}
|
||||
|
||||
void
|
||||
ini_section_set_uint(ini_section_t self, const char *name, uint32_t val)
|
||||
{
|
||||
section_t *section = (section_t *) self;
|
||||
entry_t *ent;
|
||||
|
||||
if (section == NULL)
|
||||
return;
|
||||
|
||||
ent = find_entry(section, name);
|
||||
if (ent == NULL)
|
||||
ent = create_entry(section, name);
|
||||
|
||||
sprintf(ent->data, "%i", val);
|
||||
mbstowcs(ent->wdata, ent->data, 512);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
ini_section_set_float(ini_section_t self, const char *name, float val)
|
||||
{
|
||||
section_t *section = (section_t *) self;
|
||||
entry_t *ent;
|
||||
|
||||
if (section == NULL)
|
||||
return;
|
||||
|
||||
ent = find_entry(section, name);
|
||||
if (ent == NULL)
|
||||
ent = create_entry(section, name);
|
||||
|
||||
sprintf(ent->data, "%g", val);
|
||||
mbstowcs(ent->wdata, ent->data, 512);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
ini_section_set_double(ini_section_t self, const char *name, double val)
|
||||
{
|
||||
|
||||
@@ -1943,7 +1943,7 @@ machine_xt_m19_init(const machine_t *model)
|
||||
|
||||
device_add(&keyboard_xt_olivetti_device);
|
||||
|
||||
pit_set_clock(14318184.0);
|
||||
pit_set_clock((uint32_t) 14318184.0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ static void
|
||||
time_get(nvr_t *nvr, struct tm *tm)
|
||||
{
|
||||
const local_t *local = (local_t *) nvr->data;
|
||||
int8_t temp;
|
||||
int8_t temp;
|
||||
|
||||
if (nvr->regs[RTC_REGB] & REGB_DM) {
|
||||
/* NVR is in Binary data mode. */
|
||||
@@ -370,7 +370,7 @@ static void
|
||||
time_set(nvr_t *nvr, struct tm *tm)
|
||||
{
|
||||
const local_t *local = (local_t *) nvr->data;
|
||||
int year = (tm->tm_year + 1900);
|
||||
int year = (tm->tm_year + 1900);
|
||||
|
||||
if (nvr->regs[RTC_REGB] & REGB_DM) {
|
||||
/* NVR is in Binary data mode. */
|
||||
|
||||
@@ -1000,11 +1000,11 @@ pit_ps2_init(int type)
|
||||
}
|
||||
|
||||
void
|
||||
pit_set_clock(int clock)
|
||||
pit_set_clock(uint32_t clock)
|
||||
{
|
||||
/* Set default CPU/crystal clock and xt_cpu_multi. */
|
||||
if (cpu_s->cpu_type >= CPU_286) {
|
||||
int remainder = (clock % 100000000);
|
||||
uint32_t remainder = (clock % 100000000);
|
||||
if (remainder == 66666666)
|
||||
cpuclock = (double) (clock - remainder) + (200000000.0 / 3.0);
|
||||
else if (remainder == 33333333)
|
||||
|
||||
@@ -143,5 +143,4 @@ RendererCommon::eventDelegate(QEvent *event, bool &result)
|
||||
result = QApplication::sendEvent(parentWidget, event);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user