Skip to content

Commit 88ddada

Browse files
committed
isa/dectalk: hack it to work until it can be better understood
i386: some limit checks
1 parent b5521d7 commit 88ddada

File tree

9 files changed

+25
-24
lines changed

9 files changed

+25
-24
lines changed

Diff for: src/devices/bus/isa/dectalk.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,11 @@ uint16_t dectalk_isa_device::host_irq_r()
5353

5454
uint8_t dectalk_isa_device::dma_r()
5555
{
56-
if (!machine().side_effects_disabled())
57-
m_cpu->drq1_w(0);
5856
return m_dma;
5957
}
6058

6159
void dectalk_isa_device::dma_w(uint8_t data)
6260
{
63-
m_cpu->drq1_w(0);
6461
m_dma = data;
6562
}
6663

@@ -88,7 +85,6 @@ void dectalk_isa_device::output_ctl_w(uint16_t data)
8885
uint16_t dectalk_isa_device::dsp_dma_r()
8986
{
9087
m_bio = ASSERT_LINE;
91-
m_cpu->drq1_w(0);
9288
return m_dsp_dma;
9389
}
9490

@@ -102,7 +98,7 @@ int dectalk_isa_device::bio_line_r()
10298
{
10399
// TODO: reading the bio line doesn't cause any direct external effects so this is wrong
104100
if(m_bio == ASSERT_LINE)
105-
m_cpu->drq0_w(1);
101+
m_cpu->dma_sync_req(0);
106102
return m_bio;
107103
}
108104

@@ -191,7 +187,7 @@ void dectalk_isa_device::write(offs_t offset, uint8_t data)
191187
break;
192188
case 4:
193189
m_dma = data;
194-
m_cpu->drq1_w(1);
190+
m_cpu->dma_sync_req(1);
195191
break;
196192
case 6:
197193
m_cpu->int1_w(1);
@@ -213,7 +209,7 @@ uint8_t dectalk_isa_device::read(offs_t offset)
213209
return m_data >> 8;
214210
case 4:
215211
if (!machine().side_effects_disabled())
216-
m_cpu->drq1_w(1);
212+
m_cpu->dma_sync_req(1);
217213
return m_dma;
218214
}
219215
return 0;

Diff for: src/devices/cpu/i386/i386.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#define LOG_PM_FAULT_DF (1U << 10)
4141
#define LOG_PM_FAULT_UD (1U << 11)
4242

43-
//#define VERBOSE (LOG_PM_FAULT_GP)
43+
#define VERBOSE (LOG_PM_FAULT_GP | LOG_PM_FAULT_UD | LOG_PM_EVENTS | LOG_LIMIT_CHECK)
4444
#include "logmacro.h"
4545

4646
/* seems to be defined on mingw-gcc */
@@ -165,14 +165,14 @@ MODRM_TABLE i386_MODRM_table[256];
165165

166166
/*************************************************************************/
167167

168-
uint32_t i386_device::i386_translate(int segment, uint32_t ip, int rwn)
168+
uint32_t i386_device::i386_translate(int segment, uint32_t ip, int rwn, int size)
169169
{
170170
// TODO: segment limit access size, execution permission, handle exception thrown from exception handler
171171
if (PROTECTED_MODE && !V8086_MODE && (rwn != -1))
172172
{
173173
if (!(m_sreg[segment].valid))
174174
FAULT_THROW((segment == SS) ? FAULT_SS : FAULT_GP, 0);
175-
if (i386_limit_check(segment, ip))
175+
if (i386_limit_check(segment, ip, size))
176176
FAULT_THROW((segment == SS) ? FAULT_SS : FAULT_GP, 0);
177177
if ((rwn == 0) && ((m_sreg[segment].flags & 8) && !(m_sreg[segment].flags & 2)))
178178
FAULT_THROW(FAULT_GP, 0);

Diff for: src/devices/cpu/i386/i386.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ class i386_device : public cpu_device, public device_vtlb_interface, public i386
435435
void register_state_i386();
436436
void register_state_i386_x87();
437437
void register_state_i386_x87_xmm();
438-
uint32_t i386_translate(int segment, uint32_t ip, int rwn);
438+
uint32_t i386_translate(int segment, uint32_t ip, int rwn, int size = 1);
439439
inline vtlb_entry get_permissions(uint32_t pte, int wp);
440440
bool i386_translate_address(int intention, bool debug, offs_t *address, vtlb_entry *entry);
441441
bool translate_address(int pl, int type, uint32_t *address, uint32_t *error);
@@ -512,7 +512,7 @@ class i386_device : public cpu_device, public device_vtlb_interface, public i386
512512
uint32_t GetEA(uint8_t modrm, int rwn);
513513
uint32_t Getx87EA(uint8_t modrm, int rwn);
514514
void i386_check_sreg_validity(int reg);
515-
int i386_limit_check(int seg, uint32_t offset);
515+
int i386_limit_check(int seg, uint32_t offset, int size = 1);
516516
void i386_sreg_load(uint16_t selector, uint8_t reg, bool *fault);
517517
void i386_trap(int irq, int irq_gate, int trap_level);
518518
void i386_trap_with_error(int irq, int irq_gate, int trap_level, uint32_t error);

Diff for: src/devices/cpu/i386/i386op16.hxx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1225,9 +1225,9 @@ void i386_device::i386_lodsw() // Opcode 0xad
12251225
{
12261226
uint32_t eas;
12271227
if( m_segment_prefix ) {
1228-
eas = i386_translate(m_segment_override, m_address_size ? REG32(ESI) : REG16(SI), 0 );
1228+
eas = i386_translate(m_segment_override, m_address_size ? REG32(ESI) : REG16(SI), 0, 2);
12291229
} else {
1230-
eas = i386_translate(DS, m_address_size ? REG32(ESI) : REG16(SI), 0 );
1230+
eas = i386_translate(DS, m_address_size ? REG32(ESI) : REG16(SI), 0, 2);
12311231
}
12321232
REG16(AX) = READ16(eas);
12331233
BUMP_SI(2);
@@ -1424,11 +1424,11 @@ void i386_device::i386_movsw() // Opcode 0xa5
14241424
uint32_t eas, ead;
14251425
uint16_t v;
14261426
if( m_segment_prefix ) {
1427-
eas = i386_translate(m_segment_override, m_address_size ? REG32(ESI) : REG16(SI), 0 );
1427+
eas = i386_translate(m_segment_override, m_address_size ? REG32(ESI) : REG16(SI), 0, 2);
14281428
} else {
1429-
eas = i386_translate(DS, m_address_size ? REG32(ESI) : REG16(SI), 0 );
1429+
eas = i386_translate(DS, m_address_size ? REG32(ESI) : REG16(SI), 0, 2);
14301430
}
1431-
ead = i386_translate(ES, m_address_size ? REG32(EDI) : REG16(DI), 1 );
1431+
ead = i386_translate(ES, m_address_size ? REG32(EDI) : REG16(DI), 1, 2);
14321432
v = READ16(eas);
14331433
WRITE16(ead, v);
14341434
BUMP_SI(2);

Diff for: src/devices/cpu/i386/i386op32.hxx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1068,9 +1068,9 @@ void i386_device::i386_lodsd() // Opcode 0xad
10681068
{
10691069
uint32_t eas;
10701070
if( m_segment_prefix ) {
1071-
eas = i386_translate(m_segment_override, m_address_size ? REG32(ESI) : REG16(SI), 0 );
1071+
eas = i386_translate(m_segment_override, m_address_size ? REG32(ESI) : REG16(SI), 0, 4 );
10721072
} else {
1073-
eas = i386_translate(DS, m_address_size ? REG32(ESI) : REG16(SI), 0 );
1073+
eas = i386_translate(DS, m_address_size ? REG32(ESI) : REG16(SI), 0, 4 );
10741074
}
10751075
REG32(EAX) = READ32(eas);
10761076
BUMP_SI(4);
@@ -1243,11 +1243,11 @@ void i386_device::i386_movsd() // Opcode 0xa5
12431243
{
12441244
uint32_t eas, ead, v;
12451245
if( m_segment_prefix ) {
1246-
eas = i386_translate(m_segment_override, m_address_size ? REG32(ESI) : REG16(SI), 0 );
1246+
eas = i386_translate(m_segment_override, m_address_size ? REG32(ESI) : REG16(SI), 0, 4 );
12471247
} else {
1248-
eas = i386_translate(DS, m_address_size ? REG32(ESI) : REG16(SI), 0 );
1248+
eas = i386_translate(DS, m_address_size ? REG32(ESI) : REG16(SI), 0, 4 );
12491249
}
1250-
ead = i386_translate(ES, m_address_size ? REG32(EDI) : REG16(DI), 1 );
1250+
ead = i386_translate(ES, m_address_size ? REG32(EDI) : REG16(DI), 1, 4 );
12511251
v = READ32(eas);
12521252
WRITE32(ead, v);
12531253
BUMP_SI(4);

Diff for: src/devices/cpu/i386/i386segs.hxx

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void i386_device::i386_check_sreg_validity(int reg)
216216
}
217217
}
218218

219-
int i386_device::i386_limit_check(int seg, uint32_t offset)
219+
int i386_device::i386_limit_check(int seg, uint32_t offset, int size)
220220
{
221221
if(PROTECTED_MODE && !V8086_MODE)
222222
{
@@ -231,7 +231,7 @@ int i386_device::i386_limit_check(int seg, uint32_t offset)
231231
}
232232
else
233233
{
234-
if(offset > m_sreg[seg].limit)
234+
if((offset + size - 1) > m_sreg[seg].limit)
235235
{
236236
LOGMASKED(LOG_LIMIT_CHECK, "Limit check at 0x%08x failed. Segment %04x, limit %08x, offset %08x\n",m_pc,m_sreg[seg].selector,m_sreg[seg].limit,offset);
237237
//machine().debug_break();

Diff for: src/devices/cpu/i86/i186.h

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ class i80186_cpu_device : public i8086_common_cpu_device
3737
void int2_w(int state) { external_int(2, state); }
3838
void int3_w(int state) { external_int(3, state); }
3939

40+
// This a hack, only use if there are sync problems with another cpu
41+
void dma_sync_req(int which) { drq_callback(which); }
42+
4043
// device_memory_interface overrides
4144
virtual space_config_vector memory_space_config() const override;
4245

Diff for: src/devices/machine/at.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ void at_mb_device::device_add_mconfig(machine_config &config)
134134
m_isabus->drq6_callback().set(m_dma8237_2, FUNC(am9517a_device::dreq2_w));
135135
m_isabus->drq7_callback().set(m_dma8237_2, FUNC(am9517a_device::dreq3_w));
136136
m_isabus->iochck_callback().set(FUNC(at_mb_device::iochck_w));
137+
m_isabus->iochrdy_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
137138

138139
MC146818(config, m_mc146818, 32.768_kHz_XTAL);
139140
m_mc146818->irq().set(m_pic8259_slave, FUNC(pic8259_device::ir0_w));

Diff for: src/devices/machine/genpc.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ void ibm5160_mb_device::device_add_mconfig(machine_config &config)
468468
m_isabus->drq2_callback().set(m_dma8237, FUNC(am9517a_device::dreq2_w));
469469
m_isabus->drq3_callback().set(m_dma8237, FUNC(am9517a_device::dreq3_w));
470470
m_isabus->iochck_callback().set(FUNC(ibm5160_mb_device::iochck_w));
471+
m_isabus->iochrdy_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
471472

472473
/* sound hardware */
473474
SPEAKER(config, "mono").front_center();

0 commit comments

Comments
 (0)