Merge branch 'master' of github.com:86Box/86Box into tc1995

This commit is contained in:
TC1995
2020-07-12 20:22:01 +02:00
7 changed files with 26 additions and 8 deletions

View File

@@ -599,8 +599,8 @@ generate_call:
codegen_timing_opcode(opcode, fetchdat, op_32, op_pc); codegen_timing_opcode(opcode, fetchdat, op_32, op_pc);
codegen_accumulate(ACCREG_ins, 1); codegen_accumulate(ir, ACCREG_ins, 1);
codegen_accumulate(ACCREG_cycles, -codegen_block_cycles); codegen_accumulate(ir, ACCREG_cycles, -codegen_block_cycles);
codegen_block_cycles = 0; codegen_block_cycles = 0;
if ((op_table == x86_dynarec_opcodes && if ((op_table == x86_dynarec_opcodes &&
@@ -620,10 +620,10 @@ generate_call:
codegen_timing_jump_cycles(); codegen_timing_jump_cycles();
if (jump_cycles) if (jump_cycles)
codegen_accumulate(ACCREG_cycles, -jump_cycles); codegen_accumulate(ir, ACCREG_cycles, -jump_cycles);
codegen_accumulate_flush(ir); codegen_accumulate_flush(ir);
if (jump_cycles) if (jump_cycles)
codegen_accumulate(ACCREG_cycles, jump_cycles); codegen_accumulate(ir, ACCREG_cycles, jump_cycles);
} }
if (op_table == x86_dynarec_opcodes_0f && opcode == 0x0f) if (op_table == x86_dynarec_opcodes_0f && opcode == 0x0f)

View File

@@ -17,7 +17,7 @@ static struct
[ACCREG_cycles] = {0, IREG_cycles}, [ACCREG_cycles] = {0, IREG_cycles},
}; };
void codegen_accumulate(int acc_reg, int delta) void codegen_accumulate(ir_data_t *ir, int acc_reg, int delta)
{ {
acc_regs[acc_reg].count += delta; acc_regs[acc_reg].count += delta;

View File

@@ -8,6 +8,6 @@ enum
struct ir_data_t; struct ir_data_t;
void codegen_accumulate(int acc_reg, int delta); void codegen_accumulate(struct ir_data_t *ir, int acc_reg, int delta);
void codegen_accumulate_flush(struct ir_data_t *ir); void codegen_accumulate_flush(struct ir_data_t *ir);
void codegen_accumulate_reset(); void codegen_accumulate_reset();

View File

@@ -782,7 +782,7 @@ void codegen_block_end()
void codegen_block_end_recompile(codeblock_t *block) void codegen_block_end_recompile(codeblock_t *block)
{ {
codegen_timing_block_end(); codegen_timing_block_end();
codegen_accumulate(ACCREG_cycles, -codegen_block_cycles); codegen_accumulate(ir_data, ACCREG_cycles, -codegen_block_cycles);
if (block->flags & CODEBLOCK_IN_DIRTY_LIST) if (block->flags & CODEBLOCK_IN_DIRTY_LIST)
block_dirty_list_remove(block); block_dirty_list_remove(block);

View File

@@ -141,6 +141,8 @@ extern const device_t *network_card_getdevice(int);
extern void network_set_wait(int wait); extern void network_set_wait(int wait);
extern int network_get_wait(void); extern int network_get_wait(void);
extern int network_timer_stop(void);
extern void network_queue_put(int tx, void *priv, uint8_t *data, int len); extern void network_queue_put(int tx, void *priv, uint8_t *data, int len);
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -122,6 +122,7 @@ int nic_do_log = ENABLE_NIC_LOG;
static volatile int net_wait = 0; static volatile int net_wait = 0;
static mutex_t *network_mutex; static mutex_t *network_mutex;
static uint8_t *network_mac; static uint8_t *network_mac;
static uint8_t network_timer_active = 0;
static pc_timer_t network_rx_queue_timer; static pc_timer_t network_rx_queue_timer;
static netpkt_t *first_pkt[2] = { NULL, NULL }, static netpkt_t *first_pkt[2] = { NULL, NULL },
*last_pkt[2] = { NULL, NULL }; *last_pkt[2] = { NULL, NULL };
@@ -354,6 +355,19 @@ network_attach(void *dev, uint8_t *mac, NETRXCB rx, NETWAITCB wait, NETSETLINKST
timer_add(&network_rx_queue_timer, network_rx_queue, NULL, 0); timer_add(&network_rx_queue_timer, network_rx_queue, NULL, 0);
/* 10 mbps. */ /* 10 mbps. */
timer_on_auto(&network_rx_queue_timer, 0.762939453125 * 2.0); timer_on_auto(&network_rx_queue_timer, 0.762939453125 * 2.0);
network_timer_active = 1;
}
/* Stop the network timer. */
void
network_timer_stop(void)
{
if (network_timer_active) {
timer_stop(&network_rx_queue_timer);
memset(&network_rx_queue_timer, 0x00, sizeof(pc_timer_t));
network_timer_active = 0;
}
} }
@@ -361,7 +375,7 @@ network_attach(void *dev, uint8_t *mac, NETRXCB rx, NETWAITCB wait, NETSETLINKST
void void
network_close(void) network_close(void)
{ {
timer_stop(&network_rx_queue_timer); network_timer_stop();
/* If already closed, do nothing. */ /* If already closed, do nothing. */
if (network_mutex == NULL) return; if (network_mutex == NULL) return;

View File

@@ -681,6 +681,8 @@ pc_reset_hard_close(void)
{ {
ui_sb_set_ready(0); ui_sb_set_ready(0);
network_timer_close();
/* Turn off timer processing to avoid potential segmentation faults. */ /* Turn off timer processing to avoid potential segmentation faults. */
timer_close(); timer_close();