Hello community, here is the log from the commit of package dosbox for openSUSE:Factory checked in at 2017-04-11 09:44:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dosbox (Old) and /work/SRC/openSUSE:Factory/.dosbox.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "dosbox" Tue Apr 11 09:44:32 2017 rev:29 rq:485194 version:0.74 Changes: -------- --- /work/SRC/openSUSE:Factory/dosbox/dosbox.changes 2013-12-19 12:08:11.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.dosbox.new/dosbox.changes 2017-04-11 09:44:36.269816358 +0200 @@ -1,0 +2,10 @@ +Mon Feb 13 12:13:08 UTC 2017 - lnussel@suse.de + +- add patches from Fedora + * 0001-Apply-patch-by-gulikoza-to-add-support-for-absolute-.patch + * 0001-update-64bit-recompiler-core-to-handle-OSX-memory-ad.patch + * 0001-Workaround-clang-confusing-itself-compile-error-resu.patch + * dosbox-0.74-formatsecurity.patch + * dosbox-0.74-init-crash.patch + +------------------------------------------------------------------- New: ---- 0001-Apply-patch-by-gulikoza-to-add-support-for-absolute-.patch 0001-Workaround-clang-confusing-itself-compile-error-resu.patch 0001-update-64bit-recompiler-core-to-handle-OSX-memory-ad.patch dosbox-0.74-formatsecurity.patch dosbox-0.74-init-crash.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dosbox.spec ++++++ --- /var/tmp/diff_new_pack.ARZn9K/_old 2017-04-11 09:44:37.041707319 +0200 +++ /var/tmp/diff_new_pack.ARZn9K/_new 2017-04-11 09:44:37.045706754 +0200 @@ -1,7 +1,7 @@ # # spec file for package dosbox # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -41,7 +41,24 @@ Source1: dosbox.desktop Source2: dosbox.png Patch: dosbox-0.71-manpage.diff -Patch2: gcc46.patch +Patch1: gcc46.patch +# from Fedora +# fix a crash in the joy-button mapping init when compiled with gcc-4.8 +Patch2: dosbox-0.74-init-crash.patch +# from Fedora +# fix format-security +Patch3: dosbox-0.74-formatsecurity.patch +# from Fedora +# We apply these two mainly so that patch5 applies cleanly, they're +# bugfixes that don't really apply to us (OS X and clang compilation) +# but they're safe and one allegedly gives a small speed improvement +Patch4: 0001-update-64bit-recompiler-core-to-handle-OSX-memory-ad.patch +Patch5: 0001-Workaround-clang-confusing-itself-compile-error-resu.patch +# from Fedora +# fix crash in many things when built with GCC 5 +# http://sourceforge.net/p/dosbox/bugs/413/ +# backport of http://sourceforge.net/p/dosbox/code-0/3951/ +Patch6: 0001-Apply-patch-by-gulikoza-to-add-support-for-absolute-.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -51,9 +68,7 @@ Linux file system and is therefore very easy to use. %prep -%setup -q -%patch -p1 -%patch2 +%autosetup -p1 %build autoreconf -f -i @@ -62,6 +77,9 @@ %configure make %{?_smp_mflags} +%check +make check + %install make DESTDIR=%{buildroot} install # we copy the docu ourself ++++++ 0001-Apply-patch-by-gulikoza-to-add-support-for-absolute-.patch ++++++
From 80889f640aeb2dd85cdd1f007f8d682345aa5f78 Mon Sep 17 00:00:00 2001 From: qbix79
Date: Mon, 2 Nov 2015 18:09:06 +0000 Subject: [PATCH] Apply patch by gulikoza to add support for absolute 64 addresssing.
git-svn-id: http://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3951 ed541006-0bf7-43e9-8c4d-6fc63c346d47 --- src/cpu/core_dynrec/risc_x64.h | 147 +++++++++++++++++++++++------------------ 1 file changed, 81 insertions(+), 66 deletions(-) diff --git a/src/cpu/core_dynrec/risc_x64.h b/src/cpu/core_dynrec/risc_x64.h index 0f1d949..44ccf5a 100644 --- a/src/cpu/core_dynrec/risc_x64.h +++ b/src/cpu/core_dynrec/risc_x64.h @@ -82,45 +82,98 @@ static void gen_mov_regs(HostReg reg_dst,HostReg reg_src) { cache_addb(0xc0+(reg_dst<<3)+reg_src); } +// move a 64bit constant value into a full register +static void gen_mov_reg_qword(HostReg dest_reg,Bit64u imm) { + cache_addb(0x48); + cache_addb(0xb8+dest_reg); // mov dest_reg,imm + cache_addq(imm); +} -static INLINE void gen_reg_memaddr(HostReg reg,void* data) { - Bit64s diff = (Bit64s)data-((Bit64s)cache.pos+5); + +// This function generates an instruction with register addressing and a memory location +static INLINE void gen_reg_memaddr(HostReg reg,void* data,Bit8u op,Bit8u prefix=0) { + Bit64s diff = (Bit64s)data-((Bit64s)cache.pos+(prefix?7:6)); // if ((diff<0x80000000LL) && (diff>-0x80000000LL)) { //clang messes itself up on this... if ( (diff>>63) == (diff>>31) ) { //signed bit extend, test to see if value fits in a Bit32s + // mov reg,[rip+diff] (or similar, depending on the op) to fetch *data + if(prefix) cache_addb(prefix); + cache_addb(op); cache_addb(0x05+(reg<<3)); // RIP-relative addressing is offset after the instruction cache_addd((Bit32u)(((Bit64u)diff)&0xffffffffLL)); } else if ((Bit64u)data<0x100000000LL) { + // mov reg,[data] (or similar, depending on the op) when absolute address of data is <4GB + if(prefix) cache_addb(prefix); + cache_addb(op); cache_addw(0x2504+(reg<<3)); cache_addd((Bit32u)(((Bit64u)data)&0xffffffffLL)); } else { - E_Exit("DRC64:Unhandled memory reference"); + // load 64-bit data into tmp_reg and do mov reg,[tmp_reg] (or similar, depending on the op) + HostReg tmp_reg = HOST_EAX; + if(reg == HOST_EAX) tmp_reg = HOST_ECX; + + cache_addb(0x50+tmp_reg); // push rax/rcx + gen_mov_reg_qword(tmp_reg,(Bit64u)data); + + if(prefix) cache_addb(prefix); + cache_addb(op); + cache_addb(tmp_reg+(reg<<3)); + + cache_addb(0x58+tmp_reg); // pop rax/rcx } } -static INLINE void gen_memaddr(Bitu op,void* data,Bitu off) { - Bit64s diff; - diff = (Bit64s)data-((Bit64s)cache.pos+off+5); +// Same as above, but with immediate addressing and a memory location +static INLINE void gen_memaddr(Bitu modreg,void* data,Bitu off,Bitu imm,Bit8u op,Bit8u prefix=0) { + Bit64s diff = (Bit64s)data-((Bit64s)cache.pos+off+(prefix?7:6)); // if ((diff<0x80000000LL) && (diff>-0x80000000LL)) { if ( (diff>>63) == (diff>>31) ) { // RIP-relative addressing is offset after the instruction - cache_addb(op+1); - cache_addd((Bit32u)(((Bit64u)diff)&0xffffffffLL)); + if(prefix) cache_addb(prefix); + cache_addw(op+((modreg+1)<<8)); + cache_addd((Bit32u)(((Bit64u)diff)&0xffffffffLL)); + + switch(off) { + case 1: cache_addb(((Bit8u)imm&0xff)); break; + case 2: cache_addw(((Bit16u)imm&0xffff)); break; + case 4: cache_addd(((Bit32u)imm&0xffffffff)); break; + } + } else if ((Bit64u)data<0x100000000LL) { - cache_addb(op); + if(prefix) cache_addb(prefix); + cache_addw(op+(modreg<<8)); cache_addb(0x25); cache_addd((Bit32u)(((Bit64u)data)&0xffffffffLL)); + + switch(off) { + case 1: cache_addb(((Bit8u)imm&0xff)); break; + case 2: cache_addw(((Bit16u)imm&0xffff)); break; + case 4: cache_addd(((Bit32u)imm&0xffffffff)); break; + } + } else { - E_Exit("DRC64:Unhandled memory reference"); + HostReg tmp_reg = HOST_EAX; + + cache_addb(0x50+tmp_reg); // push rax + gen_mov_reg_qword(tmp_reg,(Bit64u)data); + + if(prefix) cache_addb(prefix); + cache_addw(op+((modreg-4+tmp_reg)<<8)); + + switch(off) { + case 1: cache_addb(((Bit8u)imm&0xff)); break; + case 2: cache_addw(((Bit16u)imm&0xffff)); break; + case 4: cache_addd(((Bit32u)imm&0xffffffff)); break; + } + + cache_addb(0x58+tmp_reg); // pop rax } } // move a 32bit (dword==true) or 16bit (dword==false) value from memory into dest_reg // 16bit moves may destroy the upper 16bit of the destination register -static void gen_mov_word_to_reg(HostReg dest_reg,void* data,bool dword) { - if (!dword) cache_addb(0x66); - cache_addb(0x8b); // mov reg,[data] - gen_reg_memaddr(dest_reg,data); +static void gen_mov_word_to_reg(HostReg dest_reg,void* data,bool dword,Bit8u prefix=0) { + gen_reg_memaddr(dest_reg,data,0x8b,(dword?prefix:0x66)); // mov reg,[data] } // move a 16bit constant value into dest_reg @@ -138,10 +191,8 @@ static void gen_mov_dword_to_reg_imm(HostReg dest_reg,Bit32u imm) { } // move 32bit (dword==true) or 16bit (dword==false) of a register into memory -static void gen_mov_word_from_reg(HostReg src_reg,void* dest,bool dword) { - if (!dword) cache_addb(0x66); - cache_addb(0x89); // mov [data],reg - gen_reg_memaddr(src_reg,dest); +static void gen_mov_word_from_reg(HostReg src_reg,void* dest,bool dword,Bit8u prefix=0) { + gen_reg_memaddr(src_reg,dest,0x89,(dword?prefix:0x66)); // mov [data],reg } // move an 8bit value from memory into dest_reg @@ -149,8 +200,7 @@ static void gen_mov_word_from_reg(HostReg src_reg,void* dest,bool dword) { // this function does not use FC_OP1/FC_OP2 as dest_reg as these // registers might not be directly byte-accessible on some architectures static void gen_mov_byte_to_reg_low(HostReg dest_reg,void* data) { - cache_addb(0x8a); // mov reg,[data] - gen_reg_memaddr(dest_reg,data); + gen_reg_memaddr(dest_reg,data,0x8a); // mov reg, byte [data] } // move an 8bit value from memory into dest_reg @@ -158,9 +208,7 @@ static void gen_mov_byte_to_reg_low(HostReg dest_reg,void* data) { // this function can use FC_OP1/FC_OP2 as dest_reg which are // not directly byte-accessible on some architectures static void gen_mov_byte_to_reg_low_canuseword(HostReg dest_reg,void* data) { - cache_addb(0x66); - cache_addb(0x8b); // mov reg,[data] - gen_reg_memaddr(dest_reg,data); + gen_reg_memaddr(dest_reg,data,0x8b,0x66); // mov reg, word [data] } // move an 8bit constant value into dest_reg @@ -184,8 +232,7 @@ static void gen_mov_byte_to_reg_low_imm_canuseword(HostReg dest_reg,Bit8u imm) { // move the lowest 8bit of a register into memory static void gen_mov_byte_from_reg_low(HostReg src_reg,void* dest) { - cache_addb(0x88); // mov [data],reg - gen_reg_memaddr(src_reg,dest); + gen_reg_memaddr(src_reg,dest,0x88); // mov byte [data],reg } @@ -208,8 +255,7 @@ static void gen_extend_word(bool sign,HostReg reg) { // add a 32bit value from memory to a full register static void gen_add(HostReg reg,void* op) { - cache_addb(0x03); // add reg,[data] - gen_reg_memaddr(reg,op); + gen_reg_memaddr(reg,op,0x03); // add reg,[data] } // add a 32bit constant value to a full register @@ -228,31 +274,20 @@ static void gen_and_imm(HostReg reg,Bit32u imm) { // move a 32bit constant value into memory static void gen_mov_direct_dword(void* dest,Bit32u imm) { - cache_addb(0xc7); // mov [data],imm - gen_memaddr(0x04,dest,4); - cache_addd(imm); + gen_memaddr(0x4,dest,4,imm,0xc7); // mov [data],imm } -// move a 64bit constant value into a full register -static void gen_mov_reg_qword(HostReg dest_reg,Bit64u imm) { - cache_addb(0x48); - cache_addb(0xb8+dest_reg); // mov dest_reg,imm - cache_addq(imm); -} // move an address into memory static void INLINE gen_mov_direct_ptr(void* dest,DRC_PTR_SIZE_IM imm) { gen_mov_reg_qword(HOST_EAX,imm); - cache_addb(0x48); - gen_mov_word_from_reg(HOST_EAX,dest,true); + gen_mov_word_from_reg(HOST_EAX,dest,true,0x48); // 0x48 prefixes full 64-bit mov } // add an 8bit constant value to a memory value static void gen_add_direct_byte(void* dest,Bit8s imm) { - cache_addb(0x83); // add [data],imm - gen_memaddr(0x4,dest,1); - cache_addb(imm); + gen_memaddr(0x4,dest,1,imm,0x83); // add [data],imm } // add a 32bit (dword==true) or 16bit (dword==false) constant value to a memory value @@ -261,22 +296,12 @@ static void gen_add_direct_word(void* dest,Bit32u imm,bool dword) { gen_add_direct_byte(dest,(Bit8s)imm); return; } - if (!dword) cache_addb(0x66); - cache_addb(0x81); // add [data],imm - if (dword) { - gen_memaddr(0x4,dest,4); // size of following immediate value - cache_addd((Bit32u)imm); - } else { - gen_memaddr(0x4,dest,2); // size of following immediate value - cache_addw((Bit16u)imm); - } + gen_memaddr(0x4,dest,(dword?4:2),imm,0x81,(dword?0:0x66)); // add [data],imm } // subtract an 8bit constant value from a memory value static void gen_sub_direct_byte(void* dest,Bit8s imm) { - cache_addb(0x83); // sub [data],imm - gen_memaddr(0x2c,dest,1); - cache_addb(imm); + gen_memaddr(0x2c,dest,1,imm,0x83); } // subtract a 32bit (dword==true) or 16bit (dword==false) constant value from a memory value @@ -285,15 +310,7 @@ static void gen_sub_direct_word(void* dest,Bit32u imm,bool dword) { gen_sub_direct_byte(dest,(Bit8s)imm); return; } - if (!dword) cache_addb(0x66); - cache_addw(0x81); // sub [data],imm - if (dword) { - gen_memaddr(0x2c,dest,4); // size of following immediate value - cache_addd((Bit32u)imm); - } else { - gen_memaddr(0x2c,dest,2); // size of following immediate value - cache_addw((Bit16u)imm); - } + gen_memaddr(0x2c,dest,(dword?4:2),imm,0x81,(dword?0:0x66)); // sub [data],imm } @@ -510,12 +527,10 @@ static void INLINE gen_load_param_mem(Bitu mem,Bitu param) { break; #if defined (_MSC_VER) case 2: // mov r8,[mem] - cache_addb(0x49); - gen_mov_word_to_reg(0,(void*)mem,true); + gen_mov_word_to_reg(0,(void*)mem,true,0x49); // 0x49, use x64 rX regs break; case 3: // mov r9,[mem] - cache_addb(0x49); - gen_mov_word_to_reg(1,(void*)mem,true); + gen_mov_word_to_reg(1,(void*)mem,true,0x49); // 0x49, use x64 rX regs break; #else case 2: // mov rdx,[mem] -- 2.7.0 ++++++ 0001-Workaround-clang-confusing-itself-compile-error-resu.patch ++++++
From 783249a7da83ed6eec62935d8ba7431d7cce652c Mon Sep 17 00:00:00 2001 From: qbix79
Date: Wed, 21 Jan 2015 20:50:40 +0000 Subject: [PATCH] Workaround clang confusing itself (compile error), results in a small speed up in general (thanks for helping wjp). clang compiled x64 dynrec core appears to be unstable though. (-O0 seems to help)
git-svn-id: http://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3894 ed541006-0bf7-43e9-8c4d-6fc63c346d47 --- src/cpu/core_dynrec/risc_x64.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cpu/core_dynrec/risc_x64.h b/src/cpu/core_dynrec/risc_x64.h index 58f9d2e..0f1d949 100644 --- a/src/cpu/core_dynrec/risc_x64.h +++ b/src/cpu/core_dynrec/risc_x64.h @@ -85,7 +85,8 @@ static void gen_mov_regs(HostReg reg_dst,HostReg reg_src) { static INLINE void gen_reg_memaddr(HostReg reg,void* data) { Bit64s diff = (Bit64s)data-((Bit64s)cache.pos+5); - if ((diff<0x80000000LL) && (diff>-0x80000000LL)) { +// if ((diff<0x80000000LL) && (diff>-0x80000000LL)) { //clang messes itself up on this... + if ( (diff>>63) == (diff>>31) ) { //signed bit extend, test to see if value fits in a Bit32s cache_addb(0x05+(reg<<3)); // RIP-relative addressing is offset after the instruction cache_addd((Bit32u)(((Bit64u)diff)&0xffffffffLL)); @@ -100,7 +101,8 @@ static INLINE void gen_reg_memaddr(HostReg reg,void* data) { static INLINE void gen_memaddr(Bitu op,void* data,Bitu off) { Bit64s diff; diff = (Bit64s)data-((Bit64s)cache.pos+off+5); - if ((diff<0x80000000LL) && (diff>-0x80000000LL)) { +// if ((diff<0x80000000LL) && (diff>-0x80000000LL)) { + if ( (diff>>63) == (diff>>31) ) { // RIP-relative addressing is offset after the instruction cache_addb(op+1); cache_addd((Bit32u)(((Bit64u)diff)&0xffffffffLL)); -- 2.7.0 ++++++ 0001-update-64bit-recompiler-core-to-handle-OSX-memory-ad.patch ++++++
From a78cff8329edb4105a3f9ff40386231efb3c85f6 Mon Sep 17 00:00:00 2001 From: c2woody
Date: Sat, 22 Jan 2011 16:15:34 +0000 Subject: [PATCH] update 64bit recompiler core to handle OSX (memory addressing, stack alignment) from gulikoza
git-svn-id: http://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3674 ed541006-0bf7-43e9-8c4d-6fc63c346d47
---
src/cpu/core_dynrec/risc_x64.h | 128 ++++++++++++++++++++++++++++-------------
1 file changed, 89 insertions(+), 39 deletions(-)
diff --git a/src/cpu/core_dynrec/risc_x64.h b/src/cpu/core_dynrec/risc_x64.h
index 8013785..4395382 100644
--- a/src/cpu/core_dynrec/risc_x64.h
+++ b/src/cpu/core_dynrec/risc_x64.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2010 The DOSBox Team
+ * Copyright (C) 2002-2011 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -84,7 +84,7 @@ static void gen_mov_regs(HostReg reg_dst,HostReg reg_src) {
}
-static INLINE void gen_memaddr(HostReg reg,void* data) {
+static INLINE void gen_reg_memaddr(HostReg reg,void* data) {
Bit64s diff = (Bit64s)data-((Bit64s)cache.pos+5);
if ((diff<0x80000000LL) && (diff>-0x80000000LL)) {
cache_addb(0x05+(reg<<3));
@@ -98,13 +98,28 @@ static INLINE void gen_memaddr(HostReg reg,void* data) {
}
}
+static INLINE void gen_memaddr(Bitu op,void* data,Bitu off) {
+ Bit64s diff;
+ diff = (Bit64s)data-((Bit64s)cache.pos+off+5);
+ if ((diff<0x80000000LL) && (diff>-0x80000000LL)) {
+ // RIP-relative addressing is offset after the instruction
+ cache_addb(op+1);
+ cache_addd((Bit32u)(((Bit64u)diff)&0xffffffffLL));
+ } else if ((Bit64u)data<0x100000000LL) {
+ cache_addb(op);
+ cache_addb(0x25);
+ cache_addd((Bit32u)(((Bit64u)data)&0xffffffffLL));
+ } else {
+ E_Exit("DRC64:Unhandled memory reference");
+ }
+}
// move a 32bit (dword==true) or 16bit (dword==false) value from memory into dest_reg
// 16bit moves may destroy the upper 16bit of the destination register
static void gen_mov_word_to_reg(HostReg dest_reg,void* data,bool dword) {
if (!dword) cache_addb(0x66);
cache_addb(0x8b); // mov reg,[data]
- gen_memaddr(dest_reg,data);
+ gen_reg_memaddr(dest_reg,data);
}
// move a 16bit constant value into dest_reg
@@ -125,7 +140,7 @@ static void gen_mov_dword_to_reg_imm(HostReg dest_reg,Bit32u imm) {
static void gen_mov_word_from_reg(HostReg src_reg,void* dest,bool dword) {
if (!dword) cache_addb(0x66);
cache_addb(0x89); // mov [data],reg
- gen_memaddr(src_reg,dest);
+ gen_reg_memaddr(src_reg,dest);
}
// move an 8bit value from memory into dest_reg
@@ -134,7 +149,7 @@ static void gen_mov_word_from_reg(HostReg src_reg,void* dest,bool dword) {
// registers might not be directly byte-accessible on some architectures
static void gen_mov_byte_to_reg_low(HostReg dest_reg,void* data) {
cache_addb(0x8a); // mov reg,[data]
- gen_memaddr(dest_reg,data);
+ gen_reg_memaddr(dest_reg,data);
}
// move an 8bit value from memory into dest_reg
@@ -144,7 +159,7 @@ static void gen_mov_byte_to_reg_low(HostReg dest_reg,void* data) {
static void gen_mov_byte_to_reg_low_canuseword(HostReg dest_reg,void* data) {
cache_addb(0x66);
cache_addb(0x8b); // mov reg,[data]
- gen_memaddr(dest_reg,data);
+ gen_reg_memaddr(dest_reg,data);
}
// move an 8bit constant value into dest_reg
@@ -169,7 +184,7 @@ static void gen_mov_byte_to_reg_low_imm_canuseword(HostReg dest_reg,Bit8u imm) {
// move the lowest 8bit of a register into memory
static void gen_mov_byte_from_reg_low(HostReg src_reg,void* dest) {
cache_addb(0x88); // mov [data],reg
- gen_memaddr(src_reg,dest);
+ gen_reg_memaddr(src_reg,dest);
}
@@ -193,7 +208,7 @@ static void gen_extend_word(bool sign,HostReg reg) {
// add a 32bit value from memory to a full register
static void gen_add(HostReg reg,void* op) {
cache_addb(0x03); // add reg,[data]
- gen_memaddr(reg,op);
+ gen_reg_memaddr(reg,op);
}
// add a 32bit constant value to a full register
@@ -212,9 +227,8 @@ static void gen_and_imm(HostReg reg,Bit32u imm) {
// move a 32bit constant value into memory
static void gen_mov_direct_dword(void* dest,Bit32u imm) {
- cache_addw(0x04c7); // mov [data],imm
- cache_addb(0x25);
- cache_addd((Bit32u)(((Bit64u)dest)&0xffffffffLL));
+ cache_addb(0xc7); // mov [data],imm
+ gen_memaddr(0x04,dest,4);
cache_addd(imm);
}
@@ -235,9 +249,8 @@ static void INLINE gen_mov_direct_ptr(void* dest,DRC_PTR_SIZE_IM imm) {
// add an 8bit constant value to a memory value
static void gen_add_direct_byte(void* dest,Bit8s imm) {
- cache_addw(0x0483); // add [data],imm
- cache_addb(0x25);
- cache_addd((Bit32u)(((Bit64u)dest)&0xffffffffLL));
+ cache_addb(0x83); // add [data],imm
+ gen_memaddr(0x4,dest,1);
cache_addb(imm);
}
@@ -248,18 +261,20 @@ static void gen_add_direct_word(void* dest,Bit32u imm,bool dword) {
return;
}
if (!dword) cache_addb(0x66);
- cache_addw(0x0481); // add [data],imm
- cache_addb(0x25);
- cache_addd((Bit32u)(((Bit64u)dest)&0xffffffffLL));
- if (dword) cache_addd((Bit32u)imm);
- else cache_addw((Bit16u)imm);
+ cache_addb(0x81); // add [data],imm
+ if (dword) {
+ gen_memaddr(0x4,dest,4); // size of following immediate value
+ cache_addd((Bit32u)imm);
+ } else {
+ gen_memaddr(0x4,dest,2); // size of following immediate value
+ cache_addw((Bit16u)imm);
+ }
}
// subtract an 8bit constant value from a memory value
static void gen_sub_direct_byte(void* dest,Bit8s imm) {
- cache_addw(0x2c83); // sub [data],imm
- cache_addb(0x25);
- cache_addd((Bit32u)(((Bit64u)dest)&0xffffffffLL));
+ cache_addb(0x83); // sub [data],imm
+ gen_memaddr(0x2c,dest,1);
cache_addb(imm);
}
@@ -270,11 +285,14 @@ static void gen_sub_direct_word(void* dest,Bit32u imm,bool dword) {
return;
}
if (!dword) cache_addb(0x66);
- cache_addw(0x2c81); // sub [data],imm
- cache_addb(0x25);
- cache_addd((Bit32u)(((Bit64u)dest)&0xffffffffLL));
- if (dword) cache_addd((Bit32u)imm);
- else cache_addw((Bit16u)imm);
+ cache_addw(0x81); // sub [data],imm
+ if (dword) {
+ gen_memaddr(0x2c,dest,4); // size of following immediate value
+ cache_addd((Bit32u)imm);
+ } else {
+ gen_memaddr(0x2c,dest,2); // size of following immediate value
+ cache_addw((Bit16u)imm);
+ }
}
@@ -324,10 +342,18 @@ static INLINE void gen_lea(HostReg dest_reg,Bitu scale,Bits imm) {
// generate a call to a parameterless function
static void INLINE gen_call_function_raw(void * func) {
+ cache_addb(0x48);
+ cache_addw(0xec83);
+ cache_addb(0x08); // sub rsp,0x08 (align stack to 16 byte boundary)
+
cache_addb(0x48);
cache_addb(0xb8); // mov reg,imm64
cache_addq((Bit64u)func);
cache_addw(0xd0ff);
+
+ cache_addb(0x48);
+ cache_addw(0xc483);
+ cache_addb(0x08); // add rsp,0x08 (reset alignment)
}
// generate a call to a function with paramcount parameters
@@ -350,9 +376,13 @@ static Bit64u INLINE gen_call_function_setup(void * func,Bitu paramcount,bool fa
cache_addw(0xc483); // add rsp,0x08
cache_addb(0x08);
+ // stack is 16 byte aligned now
+
+
cache_addb(0x50); // push rax (==old rsp)
- Bit64u proc_addr=(Bit64u)cache.pos;
+ // returned address relates to where the address is stored in gen_call_function_raw
+ Bit64u proc_addr=(Bit64u)cache.pos-4;
// Do the actual call to the procedure
cache_addb(0x48);
@@ -596,6 +626,8 @@ static void gen_return_function(void) {
#ifdef DRC_FLAGS_INVALIDATION
// called when a call to a function can be replaced by a
// call to a simpler function
+// check gen_call_function_raw and gen_call_function_setup
+// for the targeted code
static void gen_fill_function_ptr(Bit8u * pos,void* fct_ptr,Bitu flags_type) {
#ifdef DRC_FLAGS_INVALIDATION_DCODE
// try to avoid function calls but rather directly fill in code
@@ -604,36 +636,46 @@ static void gen_fill_function_ptr(Bit8u * pos,void* fct_ptr,Bitu flags_type) {
case t_ADDw:
case t_ADDd:
*(Bit32u*)(pos+0)=0xf001f889; // mov eax,edi; add eax,esi
- *(Bit32u*)(pos+4)=0x909006eb; // skip
+ *(Bit32u*)(pos+4)=0x90900eeb; // skip
*(Bit32u*)(pos+8)=0x90909090;
+ *(Bit32u*)(pos+12)=0x90909090;
+ *(Bit32u*)(pos+16)=0x90909090;
break;
case t_ORb:
case t_ORw:
case t_ORd:
*(Bit32u*)(pos+0)=0xf009f889; // mov eax,edi; or eax,esi
- *(Bit32u*)(pos+4)=0x909006eb; // skip
+ *(Bit32u*)(pos+4)=0x90900eeb; // skip
*(Bit32u*)(pos+8)=0x90909090;
+ *(Bit32u*)(pos+12)=0x90909090;
+ *(Bit32u*)(pos+16)=0x90909090;
break;
case t_ANDb:
case t_ANDw:
case t_ANDd:
*(Bit32u*)(pos+0)=0xf021f889; // mov eax,edi; and eax,esi
- *(Bit32u*)(pos+4)=0x909006eb; // skip
+ *(Bit32u*)(pos+4)=0x90900eeb; // skip
*(Bit32u*)(pos+8)=0x90909090;
+ *(Bit32u*)(pos+12)=0x90909090;
+ *(Bit32u*)(pos+16)=0x90909090;
break;
case t_SUBb:
case t_SUBw:
case t_SUBd:
*(Bit32u*)(pos+0)=0xf029f889; // mov eax,edi; sub eax,esi
- *(Bit32u*)(pos+4)=0x909006eb; // skip
+ *(Bit32u*)(pos+4)=0x90900eeb; // skip
*(Bit32u*)(pos+8)=0x90909090;
+ *(Bit32u*)(pos+12)=0x90909090;
+ *(Bit32u*)(pos+16)=0x90909090;
break;
case t_XORb:
case t_XORw:
case t_XORd:
*(Bit32u*)(pos+0)=0xf031f889; // mov eax,edi; xor eax,esi
- *(Bit32u*)(pos+4)=0x909006eb; // skip
+ *(Bit32u*)(pos+4)=0x90900eeb; // skip
*(Bit32u*)(pos+8)=0x90909090;
+ *(Bit32u*)(pos+12)=0x90909090;
+ *(Bit32u*)(pos+16)=0x90909090;
break;
case t_CMPb:
case t_CMPw:
@@ -641,37 +683,45 @@ static void gen_fill_function_ptr(Bit8u * pos,void* fct_ptr,Bitu flags_type) {
case t_TESTb:
case t_TESTw:
case t_TESTd:
- *(Bit32u*)(pos+0)=0x90900aeb; // skip
+ *(Bit32u*)(pos+0)=0x909012eb; // skip
*(Bit32u*)(pos+4)=0x90909090;
*(Bit32u*)(pos+8)=0x90909090;
+ *(Bit32u*)(pos+12)=0x90909090;
+ *(Bit32u*)(pos+16)=0x90909090;
break;
case t_INCb:
case t_INCw:
case t_INCd:
*(Bit32u*)(pos+0)=0xc0fff889; // mov eax,edi; inc eax
- *(Bit32u*)(pos+4)=0x909006eb; // skip
+ *(Bit32u*)(pos+4)=0x90900eeb; // skip
*(Bit32u*)(pos+8)=0x90909090;
+ *(Bit32u*)(pos+12)=0x90909090;
+ *(Bit32u*)(pos+16)=0x90909090;
break;
case t_DECb:
case t_DECw:
case t_DECd:
*(Bit32u*)(pos+0)=0xc8fff889; // mov eax,edi; dec eax
- *(Bit32u*)(pos+4)=0x909006eb; // skip
+ *(Bit32u*)(pos+4)=0x90900eeb; // skip
*(Bit32u*)(pos+8)=0x90909090;
+ *(Bit32u*)(pos+12)=0x90909090;
+ *(Bit32u*)(pos+16)=0x90909090;
break;
case t_NEGb:
case t_NEGw:
case t_NEGd:
*(Bit32u*)(pos+0)=0xd8f7f889; // mov eax,edi; neg eax
- *(Bit32u*)(pos+4)=0x909006eb; // skip
+ *(Bit32u*)(pos+4)=0x90900eeb; // skip
*(Bit32u*)(pos+8)=0x90909090;
+ *(Bit32u*)(pos+12)=0x90909090;
+ *(Bit32u*)(pos+16)=0x90909090;
break;
default:
- *(Bit64u*)(pos+2)=(Bit64u)fct_ptr; // fill function pointer
+ *(Bit64u*)(pos+6)=(Bit64u)fct_ptr; // fill function pointer
break;
}
#else
- *(Bit64u*)(pos+2)=(Bit64u)fct_ptr;
+ *(Bit64u*)(pos+6)=(Bit64u)fct_ptr; // fill function pointer
#endif
}
#endif
--
2.7.0
++++++ dosbox-0.74-formatsecurity.patch ++++++
diff -up dosbox-0.74/src/gui/sdlmain.cpp.orig dosbox-0.74/src/gui/sdlmain.cpp
--- dosbox-0.74/src/gui/sdlmain.cpp.orig 2013-12-18 15:06:41.227839719 +0100
+++ dosbox-0.74/src/gui/sdlmain.cpp 2013-12-18 15:07:14.434769053 +0100
@@ -1529,7 +1529,7 @@ static void show_warning(char const * co
if ( !sdl.inited && SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) < 0 ) textonly = true;
sdl.inited = true;
#endif
- printf(message);
+ printf("%s", message);
if(textonly) return;
if(!sdl.surface) sdl.surface = SDL_SetVideoMode(640,400,0,0);
if(!sdl.surface) return;
++++++ dosbox-0.74-init-crash.patch ++++++
diff -up dosbox-0.74/src/gui/sdl_mapper.cpp~ dosbox-0.74/src/gui/sdl_mapper.cpp
--- dosbox-0.74/src/gui/sdl_mapper.cpp~ 2010-05-10 20:58:06.000000000 +0200
+++ dosbox-0.74/src/gui/sdl_mapper.cpp 2013-05-10 20:53:02.133112189 +0200
@@ -2384,9 +2384,11 @@ void MAPPER_StartUp(Section * sec) {
mapper.sticks.num=0;
mapper.sticks.num_groups=0;
Bitu i;
- for (i=0; i<16; i++) {
+ for (i=0; i
participants (1)
-
root@hilbert.suse.de