diff -Nru dosemu2-2.0~pre8-7126/debian/changelog dosemu2-2.0~pre8-7130/debian/changelog --- dosemu2-2.0~pre8-7126/debian/changelog 2021-11-30 23:02:50.000000000 +0000 +++ dosemu2-2.0~pre8-7130/debian/changelog 2021-12-01 23:03:10.000000000 +0000 @@ -1,8 +1,8 @@ -dosemu2 (2.0~pre8-7126-02a38bb56+202111302302~ubuntu20.04.1) focal; urgency=low +dosemu2 (2.0~pre8-7130-f0331ba25+202112012303~ubuntu20.04.1) focal; urgency=low * Auto build. - -- Launchpad Package Builder Tue, 30 Nov 2021 23:02:50 +0000 + -- Launchpad Package Builder Wed, 01 Dec 2021 23:03:10 +0000 dosemu2 (2.0~pre8-2) disco; urgency=low diff -Nru dosemu2-2.0~pre8-7126/debian/git-build-recipe.manifest dosemu2-2.0~pre8-7130/debian/git-build-recipe.manifest --- dosemu2-2.0~pre8-7126/debian/git-build-recipe.manifest 2021-11-30 23:02:50.000000000 +0000 +++ dosemu2-2.0~pre8-7130/debian/git-build-recipe.manifest 2021-12-01 23:03:10.000000000 +0000 @@ -1,2 +1,2 @@ -# git-build-recipe format 0.4 deb-version {debupstream}-7126-02a38bb56+202111302302 -lp:dosemu2 git-commit:02a38bb56acda4ad435d46c9bdbb5de3d5173404 +# git-build-recipe format 0.4 deb-version {debupstream}-7130-f0331ba25+202112012303 +lp:dosemu2 git-commit:f0331ba25fd3e72514c841965967385a81cc774c diff -Nru dosemu2-2.0~pre8-7126/src/base/core/coopth.c dosemu2-2.0~pre8-7130/src/base/core/coopth.c --- dosemu2-2.0~pre8-7126/src/base/core/coopth.c 2021-11-30 23:02:49.000000000 +0000 +++ dosemu2-2.0~pre8-7130/src/base/core/coopth.c 2021-12-01 23:03:10.000000000 +0000 @@ -571,7 +571,8 @@ } int coopth_create_multi_internal(const char *name, int len, - coopth_func_t func, const struct coopth_be_ops *ops) + coopth_func_t func, + const struct coopth_be_ops *ops) { int i, num; @@ -587,8 +588,8 @@ thr->len = (i == 0 ? len : 1); thr->func = func; thr->ops = ops; + call_prep(thr); } - call_prep(&coopthreads[num]); return num; } @@ -1051,13 +1052,15 @@ assert(!can); } -static struct coopth_t *on_thread(void) +static struct coopth_t *on_thread(unsigned id) { int i; for (i = 0; i < threads_active; i++) { int tid = active_tids[i]; struct coopth_t *thr = &coopthreads[tid]; assert(thr->cur_thr > 0); + if (thr->ops->id != id) + continue; if (thr->ops->is_active(CIDX2(tid, thr->cur_thr - 1))) return thr; } @@ -1328,7 +1331,7 @@ } /* desperate cleanup attempt, not extremely reliable */ -int coopth_flush_internal(void (*helper)(void)) +int coopth_flush_internal(unsigned id, void (*helper)(void)) { struct coopth_t *thr; assert(!_coopth_is_in_thread_nowarn() || is_detached()); @@ -1336,7 +1339,7 @@ struct coopth_per_thread_t *pth; /* the sleeping threads are unlikely to be found here. * This is mainly to flush zombies. */ - thr = on_thread(); + thr = on_thread(id); if (!thr) break; pth = current_thr(thr); @@ -1411,9 +1414,9 @@ g_printf("coopth: leaked %i threads\n", threads_total); } -int coopth_wants_sleep(void) +int coopth_wants_sleep_internal(unsigned id) { - struct coopth_t *thr = on_thread(); + struct coopth_t *thr = on_thread(id); struct coopth_per_thread_t *pth; if (!thr) return 0; diff -Nru dosemu2-2.0~pre8-7126/src/base/dev/vga/vgaemu.c dosemu2-2.0~pre8-7130/src/base/dev/vga/vgaemu.c --- dosemu2-2.0~pre8-7126/src/base/dev/vga/vgaemu.c 2021-11-30 23:02:49.000000000 +0000 +++ dosemu2-2.0~pre8-7130/src/base/dev/vga/vgaemu.c 2021-12-01 23:03:10.000000000 +0000 @@ -1146,7 +1146,10 @@ * simulated. */ ret = instr_emu(scp, pmode, 0); if (!ret) { - error_once("instruction simulation failure\n%s\n", DPMI_show_state(scp)); + if (pmode) + error_once("instruction simulation failure\n%s\n", DPMI_show_state(scp)); + else + error_once0("instruction simulation failure\n"); vga_emu_adjust_protection(vga_page, page_fault, RW, 1); } } diff -Nru dosemu2-2.0~pre8-7126/src/base/emu-i386/coopth_vm86.c dosemu2-2.0~pre8-7130/src/base/emu-i386/coopth_vm86.c --- dosemu2-2.0~pre8-7126/src/base/emu-i386/coopth_vm86.c 2021-11-30 23:02:49.000000000 +0000 +++ dosemu2-2.0~pre8-7130/src/base/emu-i386/coopth_vm86.c 2021-12-01 23:03:10.000000000 +0000 @@ -107,6 +107,7 @@ .to_sleep = to_sleep, .sleep = do_sleep, .get_dbg_val = get_dbg_val, + .id = COOPTH_BE_VM86, }; static void coopth_hlt(Bit16u offs, HLT_ARG(arg)) @@ -236,7 +237,12 @@ int coopth_flush_vm86(void) { - return coopth_flush_internal(vm86_helper); + return coopth_flush_internal(COOPTH_BE_VM86, vm86_helper); +} + +int coopth_wants_sleep_vm86(void) +{ + return coopth_wants_sleep_internal(COOPTH_BE_VM86); } void coopth_set_ctx_checker_vm86(int (*checker)(void)) diff -Nru dosemu2-2.0~pre8-7126/src/base/emu-i386/do_vm86.c dosemu2-2.0~pre8-7130/src/base/emu-i386/do_vm86.c --- dosemu2-2.0~pre8-7126/src/base/emu-i386/do_vm86.c 2021-11-30 23:02:49.000000000 +0000 +++ dosemu2-2.0~pre8-7130/src/base/emu-i386/do_vm86.c 2021-12-01 23:03:10.000000000 +0000 @@ -614,7 +614,7 @@ if (signal_pending()) return; /* if thread wants some sleep, we can't fuck it in a busy loop */ - if (coopth_wants_sleep()) + if (coopth_wants_sleep_vm86()) return; /* some subsystems doesn't want this optimization loop as well */ if (retval == HLT_RET_SPECIAL) diff -Nru dosemu2-2.0~pre8-7126/src/dosext/dpmi/coopth_pm.c dosemu2-2.0~pre8-7130/src/dosext/dpmi/coopth_pm.c --- dosemu2-2.0~pre8-7126/src/dosext/dpmi/coopth_pm.c 2021-11-30 23:02:49.000000000 +0000 +++ dosemu2-2.0~pre8-7130/src/dosext/dpmi/coopth_pm.c 2021-12-01 23:03:10.000000000 +0000 @@ -36,6 +36,7 @@ Bit16u hlt_off; unsigned offs; void (*post)(sigcontext_t *); + int leader:1; }; #define INVALID_HLT 0xffffffff @@ -83,6 +84,7 @@ .to_sleep = to_sleep, .sleep = do_sleep, .get_dbg_val = get_dbg_val, + .id = COOPTH_BE_PM, }; static int do_start_custom(int tid, sigcontext_t *scp) @@ -95,14 +97,14 @@ return 0; } -static void coopth_auto_hlt(Bit16u offs, void *sc, void *arg) +static void coopth_auto_hlt_pm(Bit16u offs, void *sc, void *arg) { sigcontext_t *scp = sc; struct co_pm *thr = arg; - int tid = thr - coopthpm; + int tid = (thr - coopthpm) + (offs >> 1); assert(tid >= 0 && tid < MAX_COOPTHREADS); - switch (offs) { + switch (offs & 1) { case 0: do_start_custom(tid, scp); break; @@ -143,10 +145,37 @@ if (num == -1) return -1; thr = &coopthpm[num]; - ret = register_handler(hlt_state, name, coopth_auto_hlt, thr, 2); + thr->leader = 1; + ret = register_handler(hlt_state, name, coopth_auto_hlt_pm, thr, 2); thr->offs = offs; thr->hlt_off = ret; // for some future unregister thr->post = post; *hlt_off = ret + offs; return num; } + +int coopth_create_pm_multi(const char *name, coopth_func_t func, + void (*post)(sigcontext_t *), void *hlt_state, unsigned offs, + int len, unsigned int *hlt_off, int r_offs[]) +{ + int num; + struct co_pm *thr; + Bit16u ret; + int i; + + num = coopth_create_multi_internal(name, len, func, &ops); + if (num == -1) + return -1; + thr = &coopthpm[num]; + thr->leader = 1; + ret = register_handler(hlt_state, name, coopth_auto_hlt_pm, thr, 2 * len); + for (i = 0; i < len; i++) { + thr = &coopthpm[num + i]; + thr->offs = offs; + thr->hlt_off = ret; + thr->post = post; + r_offs[i] = i * 2; + } + *hlt_off = ret + offs; + return num; +} diff -Nru dosemu2-2.0~pre8-7126/src/dosext/dpmi/coopth_pm.h dosemu2-2.0~pre8-7130/src/dosext/dpmi/coopth_pm.h --- dosemu2-2.0~pre8-7126/src/dosext/dpmi/coopth_pm.h 2021-11-30 23:02:49.000000000 +0000 +++ dosemu2-2.0~pre8-7130/src/dosext/dpmi/coopth_pm.h 2021-12-01 23:03:10.000000000 +0000 @@ -5,4 +5,8 @@ void (*post)(sigcontext_t *), void *hlt_state, unsigned offs, unsigned int *hlt_off); +int coopth_create_pm_multi(const char *name, coopth_func_t func, + void (*post)(sigcontext_t *), void *hlt_state, unsigned offs, + int len, unsigned int *hlt_off, int r_offs[]); + #endif diff -Nru dosemu2-2.0~pre8-7126/src/dosext/dpmi/msdos/msdos.c dosemu2-2.0~pre8-7130/src/dosext/dpmi/msdos/msdos.c --- dosemu2-2.0~pre8-7126/src/dosext/dpmi/msdos/msdos.c 2021-11-30 23:02:49.000000000 +0000 +++ dosemu2-2.0~pre8-7130/src/dosext/dpmi/msdos/msdos.c 2021-12-01 23:03:10.000000000 +0000 @@ -914,26 +914,6 @@ } return MSDOS_DONE; } - case 0x01 ... 0x08: /* These are dos functions which */ - case 0x0b ... 0x0e: /* are not required memory copy, */ - case 0x19: /* and segment register translation. */ - case 0x2a ... 0x2e: - case 0x30 ... 0x34: - case 0x36: - case 0x37: - case 0x3e: - case 0x42: - case 0x45: - case 0x46: - case 0x4d: - case 0x4f: /* find next */ - case 0x54: - case 0x58: - case 0x59: - case 0x5c: /* lock */ - case 0x66 ... 0x68: - case 0xF8: /* OEM SET vector */ - break; case 0x00: /* DOS terminate */ old_dos_terminate(scp, intr, rmreg, rm_mask); RMPRESERVE2(cs, ip); diff -Nru dosemu2-2.0~pre8-7126/src/include/coopth_be.h dosemu2-2.0~pre8-7130/src/include/coopth_be.h --- dosemu2-2.0~pre8-7126/src/include/coopth_be.h 2021-11-30 23:02:49.000000000 +0000 +++ dosemu2-2.0~pre8-7130/src/include/coopth_be.h 2021-12-01 23:03:10.000000000 +0000 @@ -18,6 +18,8 @@ #error COOPTH_POOL_SIZE too small #endif +enum { COOPTH_BE_VM86, COOPTH_BE_PM }; + struct coopth_be_ops { int (*is_active)(int tid, int idx); void (*callf)(int tid, int idx); @@ -26,6 +28,7 @@ int (*to_sleep)(void); void (*sleep)(void); uint64_t (*get_dbg_val)(int tid, int idx); + unsigned id; }; struct cstart_ret { @@ -39,14 +42,17 @@ }; int coopth_create_internal(const char *name, - coopth_func_t func, const struct coopth_be_ops *ops); + coopth_func_t func, + const struct coopth_be_ops *ops); int coopth_create_multi_internal(const char *name, int len, - coopth_func_t func, const struct coopth_be_ops *ops); + coopth_func_t func, + const struct coopth_be_ops *ops); struct cstart_ret coopth_start_internal(int tid, void *arg, void (*retf)(int tid, int idx)); int coopth_start_custom_internal(int tid, void *arg); void coopth_join_internal(int tid, void (*helper)(void)); -int coopth_flush_internal(void (*helper)(void)); +int coopth_flush_internal(unsigned id, void (*helper)(void)); struct crun_ret coopth_run_thread_internal(int tid); +int coopth_wants_sleep_internal(unsigned id); #endif diff -Nru dosemu2-2.0~pre8-7126/src/include/coopth.h dosemu2-2.0~pre8-7130/src/include/coopth.h --- dosemu2-2.0~pre8-7126/src/include/coopth.h 2021-11-30 23:02:49.000000000 +0000 +++ dosemu2-2.0~pre8-7130/src/include/coopth.h 2021-12-01 23:03:10.000000000 +0000 @@ -55,7 +55,7 @@ void coopth_done(void); void coopth_run(void); void coopth_run_tid(int tid); -int coopth_wants_sleep(void); +int coopth_wants_sleep_vm86(void); void coopth_set_ctx_checker_vm86(int (*checker)(void)); void coopth_cancel_disable(void); void coopth_cancel_enable(void); diff -Nru dosemu2-2.0~pre8-7126/src/include/dosemu_debug.h dosemu2-2.0~pre8-7130/src/include/dosemu_debug.h --- dosemu2-2.0~pre8-7126/src/include/dosemu_debug.h 2021-11-30 23:02:49.000000000 +0000 +++ dosemu2-2.0~pre8-7130/src/include/dosemu_debug.h 2021-12-01 23:03:10.000000000 +0000 @@ -75,13 +75,20 @@ /* unconditional message into debug log and stderr */ void error(const char *fmt, ...) FORMAT(printf, 1, 2); -#define error_once(s, ... ) { \ +#define error_once(s, ... ) do { \ static int __warned; \ if (!__warned) { \ __warned = 1; \ error(s, __VA_ARGS__); \ } \ -} +} while(0) +#define error_once0(s) do { \ + static int __warned; \ + if (!__warned) { \ + __warned = 1; \ + error(s); \ + } \ +} while(0) void verror(const char *fmt, va_list args); void vprint(const char *fmt, va_list args);