Skip to content

Commit 1406c17

Browse files
committed
Merge remote-tracking branch 'origin/master' into svga_blank_reset
2 parents a1789e1 + b55c7b9 commit 1406c17

23 files changed

+297
-163
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if(MUNT_EXTERNAL)
3535
endif()
3636

3737
project(86Box
38-
VERSION 4.1
38+
VERSION 4.1.1
3939
DESCRIPTION "Emulator of x86-based systems"
4040
HOMEPAGE_URL "https://86box.net"
4141
LANGUAGES C CXX)

debian/changelog

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
86box (4.1) UNRELEASED; urgency=medium
1+
86box (4.1.1) UNRELEASED; urgency=medium
22

33
* Bump release.
44

5-
-- Jasmine Iwanek <[email protected]> Mon, 16 Oct 2023 20:24:46 +0200
5+
-- Jasmine Iwanek <[email protected]> Fri, 23 Feb 2024 07:23:12 +0100

src/chipset/umc_8890.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ um8890_shadow(umc_8890_t *dev)
8181

8282
if ((dev->mem_state[1] ^ dev->pci_conf[0x5f]) & 0x0c) {
8383
mem_set_mem_state_both(0xe0000, 0x10000, state);
84-
dev->mem_state[1] = (dev->mem_state[2] & 0xf0) | (dev->pci_conf[0x5f] & 0x0f);
84+
dev->mem_state[1] = (dev->mem_state[1] & 0xf0) | (dev->pci_conf[0x5f] & 0x0f);
8585
}
8686

8787
flag = (dev->pci_conf[0x5f] & 0xc0) >> 6;

src/cpu/386.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,10 @@ exec386_2386(int32_t cycs)
280280

281281
cpu_state.pc++;
282282
cpu_state.eflags &= ~(RF_FLAG);
283+
if (opcode == 0xf0)
284+
in_lock = 1;
283285
x86_2386_opcodes[(opcode | cpu_state.op32) & 0x3ff](fetchdat);
286+
in_lock = 0;
284287
if (x86_was_reset)
285288
break;
286289
}

src/cpu/386_common.c

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ int opcode_length[256] = { 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 1, 3, /*
123123
/* 0 = no, 1 = always, 2 = depends on second opcode, 3 = depends on mod/rm */
124124
int lock_legal[256] = { 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 2, /* 0x0x */
125125
1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, /* 0x1x */
126-
1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, /* 0x2x */
127-
1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x3x */
126+
1, 1, 1, 1, 1, 1, 4, 0, 1, 1, 1, 1, 1, 1, 4, 0, /* 0x2x */
127+
1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, /* 0x3x */
128128
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x4x */
129129
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x5x */
130-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x6x */
130+
0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x6x */
131131
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x7x */
132132
3, 3, 3, 3, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x8x */
133133
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x9x */
@@ -423,6 +423,50 @@ x386_common_log(const char *fmt, ...)
423423
# define x386_common_log(fmt, ...)
424424
#endif
425425

426+
int
427+
is_lock_legal(uint32_t fetchdat)
428+
{
429+
int legal;
430+
fetch_dat_t fetch_dat;
431+
432+
fetch_dat.fd = fetchdat;
433+
434+
legal = lock_legal[fetch_dat.b[0]];
435+
if (legal == 1)
436+
legal = ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
437+
else if (legal == 2) {
438+
legal = lock_legal_0f[fetch_dat.b[1]];
439+
if (legal == 1)
440+
legal = ((fetch_dat.b[2] >> 6) != 0x03); /* reg,reg is illegal */
441+
else if (legal == 3) {
442+
legal = lock_legal_ba[(fetch_dat.b[2] >> 3) & 0x07];
443+
if (legal == 1)
444+
legal = ((fetch_dat.b[2] >> 6) != 0x03); /* reg,imm is illegal */
445+
}
446+
} else if (legal == 3) switch(fetch_dat.b[0]) {
447+
case 0x80 ... 0x83:
448+
legal = lock_legal_80[(fetch_dat.b[1] >> 3) & 0x07];
449+
if (legal == 1)
450+
legal = ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
451+
break;
452+
case 0xf6 ... 0xf7:
453+
legal = lock_legal_f6[(fetch_dat.b[1] >> 3) & 0x07];
454+
if (legal == 1)
455+
legal = ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
456+
break;
457+
case 0xfe ... 0xff:
458+
legal = lock_legal_fe[(fetch_dat.b[1] >> 3) & 0x07];
459+
if (legal == 1)
460+
legal = ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
461+
break;
462+
default:
463+
legal = 0;
464+
break;
465+
}
466+
467+
return legal;
468+
}
469+
426470
/*Prefetch emulation is a fairly simplistic model:
427471
- All instruction bytes must be fetched before it starts.
428472
- Cycles used for non-instruction memory accesses are counted and subtracted

src/cpu/808x.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ static uint32_t *opseg[4];
5656
static x86seg *_opseg[4];
5757

5858
static int noint = 0;
59-
static int in_lock = 0;
6059
static int cpu_alu_op, pfq_size;
6160

6261
static uint32_t cpu_src = 0, cpu_dest = 0;
@@ -545,7 +544,6 @@ reset_808x(int hard)
545544
{
546545
biu_cycles = 0;
547546
in_rep = 0;
548-
in_lock = 0;
549547
completed = 1;
550548
repeating = 0;
551549
clear_lock = 0;

src/cpu/cpu.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,4 +829,8 @@ extern int lock_legal_80[8];
829829
extern int lock_legal_f6[8];
830830
extern int lock_legal_fe[8];
831831

832+
extern int in_lock;
833+
834+
extern int is_lock_legal(uint32_t fetchdat);
835+
832836
#endif /*EMU_CPU_H*/

src/cpu/x86.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ int hlt_reset_pending;
8080

8181
int fpu_cycles = 0;
8282

83+
int in_lock = 0;
84+
8385
#ifdef ENABLE_X86_LOG
8486
void dumpregs(int);
8587

@@ -351,6 +353,8 @@ reset_common(int hard)
351353
if (!is286)
352354
reset_808x(hard);
353355

356+
in_lock = 0;
357+
354358
cpu_cpurst_on_sr = 0;
355359
}
356360

src/cpu/x86_ops_misc.h

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -731,46 +731,15 @@ static int
731731
opLOCK(uint32_t fetchdat)
732732
{
733733
int legal;
734-
fetch_dat_t fetch_dat;
735734
fetchdat = fastreadl_fetch(cs + cpu_state.pc);
736735
if (cpu_state.abrt)
737736
return 0;
738737
cpu_state.pc++;
739738

740-
fetch_dat.fd = fetchdat;
739+
legal = is_lock_legal(fetchdat);
741740

742-
legal = lock_legal[fetch_dat.b[0]];
743-
if (legal == 1)
744-
legal = ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
745-
else if (legal == 2) {
746-
legal = lock_legal_0f[fetch_dat.b[1]];
747-
if (legal == 1)
748-
legal = ((fetch_dat.b[2] >> 6) != 0x03); /* reg,reg is illegal */
749-
else if (legal == 3) {
750-
legal = lock_legal_ba[(fetch_dat.b[2] >> 3) & 0x07];
751-
if (legal == 1)
752-
legal = ((fetch_dat.b[2] >> 6) != 0x03); /* reg,imm is illegal */
753-
}
754-
} else if (legal == 3) switch(fetch_dat.b[0]) {
755-
case 0x80 ... 0x83:
756-
legal = lock_legal_80[(fetch_dat.b[1] >> 3) & 0x07];
757-
if (legal == 1)
758-
legal = ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
759-
break;
760-
case 0xf6 ... 0xf7:
761-
legal = lock_legal_f6[(fetch_dat.b[1] >> 3) & 0x07];
762-
if (legal == 1)
763-
legal = ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
764-
break;
765-
case 0xfe ... 0xff:
766-
legal = lock_legal_fe[(fetch_dat.b[1] >> 3) & 0x07];
767-
if (legal == 1)
768-
legal = ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
769-
break;
770-
default:
771-
legal = 0;
772-
break;
773-
}
741+
if (legal == 4)
742+
pclog("PREFIX: F0 %08X\n", fetchdat);
774743

775744
ILLEGAL_ON(legal == 0);
776745

0 commit comments

Comments
 (0)