Index | Thread | Search

From:
SASANO Takayoshi <uaa@mx5.nisiq.net>
Subject:
[UPDATE] dosbox-x-2024.07.01
To:
ports@openbsd.org
Date:
Sun, 01 Sep 2024 16:42:36 +0900

Download raw body.

Thread
  • SASANO Takayoshi:

    [UPDATE] dosbox-x-2024.07.01

Here is update for dosbox-x.

- patch-src_fpu_fpu_instructions_longdouble_h (removed)
  original code is fixed, no need to patch

- patch-src_hardware_esfmu_esfm_c (new)
  i386 build support, based on
  https://github.com/Kagamiin/ESFMu/commit/0994f3e83e1c6e0dc5689681e8d7b9cfd64558e9
  https://github.com/Kagamiin/ESFMu/commit/285631cd6f7243367c9721e735b45ddb6ced84e3

ok?

Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/dosbox-x/Makefile,v
diff -u -p -r1.4 Makefile
--- Makefile	20 Apr 2024 19:21:56 -0000	1.4
+++ Makefile	1 Sep 2024 07:38:18 -0000
@@ -1,9 +1,8 @@
 COMMENT=	x86 with DOS emulator targeted at playing games
 
-VERSION=	2024.03.01
+VERSION=	2024.07.01
 DISTNAME=	dosbox-x-v${VERSION}
 PKGNAME=	dosbox-x-${VERSION}
-REVISION=	0
 CATEGORIES=	games x11 emulators
 
 GH_ACCOUNT=	joncampbell123
Index: distinfo
===================================================================
RCS file: /cvs/ports/emulators/dosbox-x/distinfo,v
diff -u -p -r1.2 distinfo
--- distinfo	9 Mar 2024 13:03:21 -0000	1.2
+++ distinfo	1 Sep 2024 07:38:18 -0000
@@ -1,2 +1,2 @@
-SHA256 (dosbox-x-v2024.03.01.tar.gz) = KonTGW3cFTYfbcfmqxQr/pWUXZPVJ8/Wusyh96QBpRM=
-SIZE (dosbox-x-v2024.03.01.tar.gz) = 119593920
+SHA256 (dosbox-x-v2024.07.01.tar.gz) = I0YqM5gwP4VY6Glzr5ul09bVO9rzJOx0lhDyuvHdRJs=
+SIZE (dosbox-x-v2024.07.01.tar.gz) = 119702042
Index: patches/patch-src_fpu_fpu_instructions_longdouble_h
===================================================================
RCS file: patches/patch-src_fpu_fpu_instructions_longdouble_h
diff -N patches/patch-src_fpu_fpu_instructions_longdouble_h
--- patches/patch-src_fpu_fpu_instructions_longdouble_h	20 Apr 2024 19:21:56 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,123 +0,0 @@
-- Disable FP exceptions in a portable way
-  8b362df1f26fceeccb6f3b37bd26880e72db79b2
-- Update fpu_instructions_longdouble.h
-  53fe254c9ce25a48dbe11582416cbf3a49516dce
-
-Index: src/fpu/fpu_instructions_longdouble.h
---- src/fpu/fpu_instructions_longdouble.h.orig
-+++ src/fpu/fpu_instructions_longdouble.h
-@@ -16,31 +16,18 @@
-  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-  */
- 
-+#include <cfenv> /* for std::feholdexcept */
- #include <math.h> /* for isinf, etc */
- #include "cpu/lazyflags.h"
- 
--#ifdef __GNUC__
--# if defined(__MINGW32__) || (defined(MACOSX) && !defined(__arm64__))
--#  include "fpu_control_x86.h"
--# elif defined(ANDROID) || defined(__ANDROID__) || (defined(MACOSX) && defined(__arm64__)) || defined(EMSCRIPTEN) || defined(__powerpc__)
--/* ? */
--#  define _FPU_SETCW(x) /* dummy */
--# else
--#  include <fpu_control.h>
--# endif
--static inline void FPU_SyncCW(void) {
--    uint16_t tmp = fpu.cw | 0x80 | 0x3F; // HACK: Disable all FPU exceptions until DOSBox-X can catch and reflect FPU exceptions to the guest
--    _FPU_SETCW(tmp);
--}
--#else
--static inline void FPU_SyncCW(void) {
--    /* nothing */
--}
--#endif
--
- static void FPU_FINIT(void) {
-+	fenv_t buf;
-+
- 	fpu.cw.init();
--    FPU_SyncCW();
-+
-+	// HACK: Disable all FPU exceptions until DOSBox-X can catch and reflect FPU exceptions to the guest
-+	std::feholdexcept(&buf);
-+
-     fpu.sw.init();
- 	fpu.tags[0] = TAG_Empty;
- 	fpu.tags[1] = TAG_Empty;
-@@ -290,7 +277,8 @@ static void FPU_FBST(PhysPt addr) {
- #endif
- 
- static void FPU_FADD(Bitu op1, Bitu op2){
--    FPU_SyncCW();
-+	fenv_t buf;
-+	std::feholdexcept(&buf);
- 	// HACK: Set the denormal flag according to whether the source or final result is a denormalized number.
- 	//       This is vital if we don't want certain DOS programs to mis-detect our FPU emulation as an IIT clone chip when cputype == 286
- 	bool was_not_normal = isdenormal(fpu.regs_80[op1].v);
-@@ -324,7 +312,8 @@ static void FPU_FCOS(void){
- }
- 
- static void FPU_FSQRT(void){
--    FPU_SyncCW();
-+	fenv_t buf;
-+	std::feholdexcept(&buf);
- 	fpu.regs_80[TOP].v = sqrtl(fpu.regs_80[TOP].v);
- 	//flags and such :)
- 	return;
-@@ -343,35 +332,40 @@ static void FPU_FPTAN(void){
- 	return;
- }
- static void FPU_FDIV(Bitu st, Bitu other){
--    FPU_SyncCW();
-+	fenv_t buf;
-+	std::feholdexcept(&buf);
- 	fpu.regs_80[st].v = fpu.regs_80[st].v/fpu.regs_80[other].v;
- 	//flags and such :)
- 	return;
- }
- 
- static void FPU_FDIVR(Bitu st, Bitu other){
--    FPU_SyncCW();
-+	fenv_t buf;
-+	std::feholdexcept(&buf);
- 	fpu.regs_80[st].v = fpu.regs_80[other].v/fpu.regs_80[st].v;
- 	// flags and such :)
- 	return;
- }
- 
- static void FPU_FMUL(Bitu st, Bitu other){
--    FPU_SyncCW();
-+	fenv_t buf;
-+	std::feholdexcept(&buf);
- 	fpu.regs_80[st].v *= fpu.regs_80[other].v;
- 	//flags and such :)
- 	return;
- }
- 
- static void FPU_FSUB(Bitu st, Bitu other){
--    FPU_SyncCW();
-+	fenv_t buf;
-+	std::feholdexcept(&buf);
- 	fpu.regs_80[st].v = fpu.regs_80[st].v - fpu.regs_80[other].v;
- 	//flags and such :)
- 	return;
- }
- 
- static void FPU_FSUBR(Bitu st, Bitu other){
--    FPU_SyncCW();
-+	fenv_t buf;
-+	std::feholdexcept(&buf);
- 	fpu.regs_80[st].v = fpu.regs_80[other].v - fpu.regs_80[st].v;
- 	//flags and such :)
- 	return;
-@@ -562,7 +556,8 @@ static void FPU_FLDENV(PhysPt addr, bool op16){
- 		tag    = static_cast<uint16_t>(mem_readd(addr+8));
- 	}
- 	FPU_SetTag(tag);
--    FPU_SyncCW();
-+	fenv_t buf;
-+	std::feholdexcept(&buf);
- }
- 
- static void FPU_FSAVE(PhysPt addr, bool op16){
Index: patches/patch-src_hardware_esfmu_esfm_c
===================================================================
RCS file: patches/patch-src_hardware_esfmu_esfm_c
diff -N patches/patch-src_hardware_esfmu_esfm_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_hardware_esfmu_esfm_c	1 Sep 2024 07:38:18 -0000
@@ -0,0 +1,54 @@
+--- src/hardware/esfmu/esfm.c.orig.port	Tue Jul  2 12:45:26 2024
++++ src/hardware/esfmu/esfm.c	Sun Sep  1 15:19:38 2024
+@@ -1778,7 +1778,7 @@ ESFM_process_feedback(esfm_chip *chip)
+ 			eg_output = slot->in.eg_output;
+ 
+ 			// ASM optimizaions!
+-#if defined(__GNUC__) && defined(__x86_64__)
++#if defined(__GNUC__) && defined(__x86_64__) && !defined(_ESFMU_DISABLE_ASM_OPTIMIZATIONS)
+ 			asm (
+ 				"movzbq  %[wave], %%r8               \n\t"
+ 				"shll    $11, %%r8d                  \n\t"
+@@ -1843,13 +1843,15 @@ ESFM_process_feedback(esfm_chip *chip)
+ 				  [exprom] "m"   (exprom)
+ 				: "cc", "ax", "bx", "cx", "dx", "r8", "r9", "r10", "r11"
+ 			);
+-#elif defined(__GNUC__) && defined(__i386__)
++#elif defined(__GNUC__) && defined(__i386__) && !defined(_ESFMU_DISABLE_ASM_OPTIMIZATIONS)
+ 			uint32_t iter_counter;
+ 			int32_t wave_last;
++			size_t logsinrom_addr = (size_t)logsinrom;
++			size_t exprom_addr = (size_t)exprom;
+ 			asm (
+ 				"movzbl  %b[wave], %%eax             \n\t"
+ 				"shll    $11, %%eax                  \n\t"
+-				"leal    %[sinrom], %%edi            \n\t"
++				"movl    %[sinrom], %%edi            \n\t"
+ 				"addl    %%eax, %%edi                \n\t"
+ 				"shlw    $3, %[eg_out]               \n\t"
+ 				"xorl    %[out], %[out]              \n\t"
+@@ -1884,7 +1886,7 @@ ESFM_process_feedback(esfm_chip *chip)
+ 				// wave_out = exprom[level & 0xff] >> (level >> 8);
+ 				"movb    %%ah, %%cl                  \n\t"
+ 				"movzbl  %%al, %%eax                 \n\t"
+-				"leal    %[exprom], %[out]           \n\t"
++				"movl    %[exprom], %[out]           \n\t"
+ 				"movzwl  (%[out], %%eax, 2), %[out]  \n\t"
+ 				"shrl    %%cl, %[out]                \n\t"
+ 				// if (lookup & 0x8000) wave_out = -wave_out;
+@@ -1906,12 +1908,12 @@ ESFM_process_feedback(esfm_chip *chip)
+ 				: [p_off]  "m"   (phase_offset),
+ 				  [mod_in] "m"   (mod_in_shift),
+ 				  [wave]   "m"   (waveform),
+-				  [sinrom] "m"   (logsinrom),
+-				  [exprom] "m"   (exprom),
++				  [sinrom] "m"   (logsinrom_addr),
++				  [exprom] "m"   (exprom_addr),
+ 				  [i]      "m"   (iter_counter)
+ 				: "cc", "ax", "bx", "cx", "di"
+ 			);
+-#elif defined(__GNUC__) && defined(__arm__)
++#elif defined(__GNUC__) && defined(__arm__) && !defined(_ESFMU_DISABLE_ASM_OPTIMIZATIONS)
+ 			asm (
+ 				"movs    r3, #0                     \n\t"
+ 				"movs    %[out], #0                 \n\t"

-- 
SASANO Takayoshi (JG1UAA) <uaa@mx5.nisiq.net>