minor cleanup
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2887
This commit is contained in:
		
							parent
							
								
									a5ac3216ba
								
							
						
					
					
						commit
						bc067b8752
					
				
					 11 changed files with 41 additions and 97 deletions
				
			
		|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue