diff --git a/src/cpu/core_dyn_x86/dyn_fpu.h b/src/cpu/core_dyn_x86/dyn_fpu.h index cabfeb83..06e3efe0 100644 --- a/src/cpu/core_dyn_x86/dyn_fpu.h +++ b/src/cpu/core_dyn_x86/dyn_fpu.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2005 The DOSBox Team + * Copyright (C) 2002-2007 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 @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dyn_fpu.h,v 1.2 2006-09-19 16:27:58 c2woody Exp $ */ +/* $Id: dyn_fpu.h,v 1.3 2007-06-14 17:47:24 c2woody Exp $ */ #include "dosbox.h" #if C_FPU diff --git a/src/cpu/core_dyn_x86/dyn_fpu_dh.h b/src/cpu/core_dyn_x86/dyn_fpu_dh.h index 17af7d1f..a769e3dc 100644 --- a/src/cpu/core_dyn_x86/dyn_fpu_dh.h +++ b/src/cpu/core_dyn_x86/dyn_fpu_dh.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2005 The DOSBox Team + * Copyright (C) 2002-2007 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 @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dyn_fpu_dh.h,v 1.3 2007-06-12 20:22:07 c2woody Exp $ */ +/* $Id: dyn_fpu_dh.h,v 1.4 2007-06-14 17:47:24 c2woody Exp $ */ #include "dosbox.h" #if C_FPU diff --git a/src/cpu/core_dynrec.cpp b/src/cpu/core_dynrec.cpp index 0cc2cbf6..33d783eb 100644 --- a/src/cpu/core_dynrec.cpp +++ b/src/cpu/core_dynrec.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2006 The DOSBox Team + * Copyright (C) 2002-2007 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 diff --git a/src/cpu/core_dynrec/cache.h b/src/cpu/core_dynrec/cache.h index 6fdc537b..5a7d40a2 100644 --- a/src/cpu/core_dynrec/cache.h +++ b/src/cpu/core_dynrec/cache.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2006 The DOSBox Team + * Copyright (C) 2002-2007 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 diff --git a/src/cpu/core_dynrec/decoder.h b/src/cpu/core_dynrec/decoder.h index ffa6faa3..13c47b41 100644 --- a/src/cpu/core_dynrec/decoder.h +++ b/src/cpu/core_dynrec/decoder.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2006 The DOSBox Team + * Copyright (C) 2002-2007 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 diff --git a/src/cpu/core_dynrec/decoder_basic.h b/src/cpu/core_dynrec/decoder_basic.h index afb606bb..d0cd4e2a 100644 --- a/src/cpu/core_dynrec/decoder_basic.h +++ b/src/cpu/core_dynrec/decoder_basic.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2006 The DOSBox Team + * Copyright (C) 2002-2007 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 diff --git a/src/cpu/core_dynrec/decoder_opcodes.h b/src/cpu/core_dynrec/decoder_opcodes.h index 4fd7d76a..7ebe59a5 100644 --- a/src/cpu/core_dynrec/decoder_opcodes.h +++ b/src/cpu/core_dynrec/decoder_opcodes.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2006 The DOSBox Team + * Copyright (C) 2002-2007 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 diff --git a/src/cpu/core_dynrec/dyn_fpu.h b/src/cpu/core_dynrec/dyn_fpu.h index 4f042e89..6d7ad518 100644 --- a/src/cpu/core_dynrec/dyn_fpu.h +++ b/src/cpu/core_dynrec/dyn_fpu.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2005 The DOSBox Team + * Copyright (C) 2002-2007 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 diff --git a/src/cpu/core_dynrec/operators.h b/src/cpu/core_dynrec/operators.h index 03aa714c..221f8b89 100644 --- a/src/cpu/core_dynrec/operators.h +++ b/src/cpu/core_dynrec/operators.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2006 The DOSBox Team + * Copyright (C) 2002-2007 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 diff --git a/src/cpu/core_dynrec/risc_x64.h b/src/cpu/core_dynrec/risc_x64.h index c18e31c9..aa7bc2b9 100644 --- a/src/cpu/core_dynrec/risc_x64.h +++ b/src/cpu/core_dynrec/risc_x64.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2006 The DOSBox Team + * Copyright (C) 2002-2007 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 @@ -88,16 +88,15 @@ static INLINE void gen_memaddr(HostReg reg,void* data) { // move a 32bit (dword==true) or 16bit (dword==false) value from memory into dest_reg -// 16bit moves must preserve the upper 16bit of the destination register +// 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); } - // move a 16bit constant value into dest_reg -// the upper 16bit of the destination register must be preserved +// the upper 16bit of the destination register may be destroyed static void gen_mov_word_to_reg_imm(HostReg dest_reg,Bit16u imm) { cache_addb(0x66); cache_addb(0xb8+dest_reg); // mov reg,imm @@ -118,16 +117,18 @@ static void gen_mov_word_from_reg(HostReg src_reg,void* dest,bool dword) { } // move an 8bit value from memory into dest_reg -// the upper 24bit of the destination register must be preserved +// the upper 24bit of the destination register can be destroyed +// 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_memaddr(dest_reg,data); } // move an 8bit value from memory into dest_reg -// the upper 16bit of the destination register must be preserved -// this function is allowed to load 16bit from memory as well if the host architecture -// does not provide 8bit register access for function parameter operands (FC_OP1/FC_OP2) +// the upper 24bit of the destination register can be destroyed +// 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] @@ -135,16 +136,18 @@ static void gen_mov_byte_to_reg_low_canuseword(HostReg dest_reg,void* data) { } // move an 8bit constant value into dest_reg -// the upper 16bit of the destination register must be preserved +// the upper 24bit of the destination register can be destroyed +// 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_imm(HostReg dest_reg,Bit8u imm) { cache_addb(0xb0+dest_reg); // mov reg,imm cache_addb(imm); } // move an 8bit constant value into dest_reg -// the upper 16bit of the destination register must be preserved -// this function is allowed to load 16bit from memory as well if the host architecture -// does not provide 8bit register access for function parameter operands (FC_OP1/FC_OP2) +// the upper 24bit of the destination register can be destroyed +// 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_imm_canuseword(HostReg dest_reg,Bit8u imm) { cache_addb(0x66); cache_addb(0xb8+dest_reg); // mov reg,imm @@ -239,27 +242,6 @@ static void gen_add_direct_word(void* dest,Bit32u imm,bool dword) { if (dword) cache_addd((Bit32u)imm); else cache_addw((Bit16u)imm); } -/* -// 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(0,dest,1); - cache_addb(imm); -} - -// add a 32bit (dword==true) or 16bit (dword==false) constant value to a memory value -static void gen_add_direct_word(void* dest,Bit32u imm,bool dword) { - if ((imm<128) && dword) { - gen_add_direct_byte(dest,(Bit8s)imm); - return; - } - if (!dword) cache_addb(0x66); - cache_addw(0x81); // add [data],imm - gen_memaddr(0,dest,dword?1:2); - if (dword) cache_addd((Bit32u)imm); - else cache_addw((Bit16u)imm); -} -*/ // subtract an 8bit constant value from a memory value static void gen_sub_direct_byte(void* dest,Bit8s imm) { @@ -282,27 +264,7 @@ static void gen_sub_direct_word(void* dest,Bit32u imm,bool dword) { if (dword) cache_addd((Bit32u)imm); else cache_addw((Bit16u)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(5,dest,1); - cache_addb(imm); -} -// subtract a 32bit (dword==true) or 16bit (dword==false) constant value from a memory value -static void gen_sub_direct_word(void* dest,Bit32u imm,bool dword) { - if ((imm<128) && dword) { - gen_sub_direct_byte(dest,(Bit8s)imm); - return; - } - if (!dword) cache_addb(0x66); - cache_addb(0x81); // sub [data],imm - gen_memaddr(5,dest,dword?1:2); - if (dword) cache_addd((Bit32u)imm); - else cache_addw((Bit16u)imm); -} -*/ // effective address calculation, destination is dest_reg @@ -569,17 +531,6 @@ static Bit64u gen_create_branch_on_nonzero(HostReg reg,bool dword) { return ((Bit64u)cache.pos-1); } -// short conditional jump (+-127 bytes) if register -// (as set by a boolean operation) is nonzero -// the destination is set by gen_fill_branch() later -static Bit64u gen_create_branch_on_nonzero_bool(HostReg reg) { - cache_addb(0x0a); // or reg,reg - cache_addb(0xc0+reg+(reg<<3)); - - cache_addw(0x0075); // jnz addr - return ((Bit64u)cache.pos-1); -} - // calculate relative offset and fill it into the location pointed to by data static void gen_fill_branch(DRC_PTR_SIZE_IM data) { #if C_DEBUG diff --git a/src/cpu/core_dynrec/risc_x86.h b/src/cpu/core_dynrec/risc_x86.h index dc47aca3..98dd3b60 100644 --- a/src/cpu/core_dynrec/risc_x86.h +++ b/src/cpu/core_dynrec/risc_x86.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2006 The DOSBox Team + * Copyright (C) 2002-2007 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 @@ -79,7 +79,7 @@ static void gen_mov_regs(HostReg reg_dst,HostReg reg_src) { } // move a 32bit (dword==true) or 16bit (dword==false) value from memory into dest_reg -// 16bit moves must preserve the upper 16bit of the destination register +// 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_addw(0x058b+(dest_reg<<11)); // mov reg,[data] @@ -87,7 +87,7 @@ static void gen_mov_word_to_reg(HostReg dest_reg,void* data,bool dword) { } // move a 16bit constant value into dest_reg -// the upper 16bit of the destination register must be preserved +// the upper 16bit of the destination register may be destroyed static void gen_mov_word_to_reg_imm(HostReg dest_reg,Bit16u imm) { cache_addb(0x66); cache_addb(0xb8+dest_reg); // mov reg,imm @@ -108,16 +108,18 @@ static void gen_mov_word_from_reg(HostReg src_reg,void* dest,bool dword) { } // move an 8bit value from memory into dest_reg -// the upper 16bit of the destination register must be preserved +// the upper 24bit of the destination register can be destroyed +// 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_addw(0x058a+(dest_reg<<11)); // mov reg,[data] cache_addd((Bit32u)data); } // move an 8bit value from memory into dest_reg -// the upper 16bit of the destination register must be preserved -// this function is allowed to load 16bit from memory as well if the host architecture -// does not provide 8bit register access for function parameter operands (FC_OP1/FC_OP2) +// the upper 24bit of the destination register can be destroyed +// 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_addw(0x058b+(dest_reg<<11)); // mov reg,[data] @@ -125,16 +127,18 @@ static void gen_mov_byte_to_reg_low_canuseword(HostReg dest_reg,void* data) { } // move an 8bit constant value into dest_reg -// the upper 16bit of the destination register must be preserved +// the upper 24bit of the destination register can be destroyed +// 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_imm(HostReg dest_reg,Bit8u imm) { cache_addb(0xb0+dest_reg); // mov reg,imm cache_addb(imm); } // move an 8bit constant value into dest_reg -// the upper 16bit of the destination register must be preserved -// this function is allowed to load 16bit from memory as well if the host architecture -// does not provide 8bit register access for function parameter operands (FC_OP1/FC_OP2) +// the upper 24bit of the destination register can be destroyed +// 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_imm_canuseword(HostReg dest_reg,Bit8u imm) { cache_addb(0x66); cache_addb(0xb8+dest_reg); // mov reg,imm @@ -369,17 +373,6 @@ static Bit32u gen_create_branch_on_nonzero(HostReg reg,bool dword) { return ((Bit32u)cache.pos-1); } -// short conditional jump (+-127 bytes) if register -// (as set by a boolean operation) is nonzero -// the destination is set by gen_fill_branch() later -static Bit32u gen_create_branch_on_nonzero_bool(HostReg reg) { - cache_addb(0x0a); // or reg,reg - cache_addb(0xc0+reg+(reg<<3)); - - cache_addw(0x0075); // jnz addr - return ((Bit32u)cache.pos-1); -} - // calculate relative offset and fill it into the location pointed to by data static void gen_fill_branch(DRC_PTR_SIZE_IM data) { #if C_DEBUG