📄 ucodestaticmethods.java
字号:
/* JPC: A x86 PC Hardware Emulator for a pure Java Virtual Machine Release Version 2.0 A project from the Physics Dept, The University of Oxford Copyright (C) 2007 Isis Innovation Limited This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Details (including contact information) can be found at: www.physics.ox.ac.uk/jpc*/package org.jpc.emulator.memory.codeblock.fastcompiler.real;
import org.jpc.emulator.processor.*;
import org.jpc.emulator.motherboard.*;
public class UCodeStaticMethods
{
private static final ProcessorException exceptionDE = new ProcessorException(Processor.PROC_EXCEPTION_DE, true);
protected static final boolean[] parityMap;
static
{
parityMap = new boolean[256];
for (int i=0; i<256; i++)
{
boolean val = true;
for (int j=0; j<8; j++)
if ((0x1 & (i >> j)) == 1)
val = !val;
parityMap[i] = val;
}
}
public static int eip_nef_EIP_UPDATE_eip_x86length(int eip, int x86length)
{
return eip + x86length;
}
public static int reg0_nef_LOAD0_AL_eax(int eax)
{
return eax & 0xff;
}
public static int reg0_nef_LOAD0_CL_ecx(int ecx)
{
return ecx & 0xff;
}
public static int reg0_nef_LOAD0_DL_edx(int edx)
{
return edx & 0xff;
}
public static int reg0_nef_LOAD0_BL_ebx(int ebx)
{
return ebx & 0xff;
}
public static int reg0_nef_LOAD0_AH_eax(int eax)
{
return (eax >>> 8) & 0xff;
}
public static int reg0_nef_LOAD0_CH_ecx(int ecx)
{
return (ecx >>> 8) & 0xff;
}
public static int reg0_nef_LOAD0_DH_edx(int edx)
{
return (edx >>> 8) & 0xff;
}
public static int reg0_nef_LOAD0_BH_ebx(int ebx)
{
return (ebx >>> 8) & 0xff;
}
public static int reg0_nef_LOAD0_AX_eax(int eax)
{
return eax & 0xffff;
}
public static int reg0_nef_LOAD0_CX_ecx(int ecx)
{
return ecx & 0xffff;
}
public static int reg0_nef_LOAD0_DX_edx(int edx)
{
return edx & 0xffff;
}
public static int reg0_nef_LOAD0_BX_ebx(int ebx)
{
return ebx & 0xffff;
}
public static int reg0_nef_LOAD0_SP_esp(int esp)
{
return esp & 0xffff;
}
public static int reg0_nef_LOAD0_BP_ebp(int ebp)
{
return ebp & 0xffff;
}
public static int reg0_nef_LOAD0_SI_esi(int esi)
{
return esi & 0xffff;
}
public static int reg0_nef_LOAD0_DI_edi(int edi)
{
return edi & 0xffff;
}
public static int reg0_nef_LOAD0_EAX_eax(int eax)
{
return eax;
}
public static int reg0_nef_LOAD0_ECX_ecx(int ecx)
{
return ecx;
}
public static int reg0_nef_LOAD0_EDX_edx(int edx)
{
return edx;
}
public static int reg0_nef_LOAD0_EBX_ebx(int ebx)
{
return ebx;
}
public static int reg0_nef_LOAD0_ESP_esp(int esp)
{
return esp;
}
public static int reg0_nef_LOAD0_EBP_ebp(int ebp)
{
return ebp;
}
public static int reg0_nef_LOAD0_ESI_esi(int esi)
{
return esi;
}
public static int reg0_nef_LOAD0_EDI_edi(int edi)
{
return edi;
}
public static int reg0_hef_LOAD0_ES_es(Segment es)
{
return 0xffff & es.getSelector();
}
public static int reg0_hef_LOAD0_CS_cs(Segment cs)
{
return 0xffff & cs.getSelector();
}
public static int reg0_hef_LOAD0_SS_ss(Segment ss)
{
return 0xffff & ss.getSelector();
}
public static int reg0_hef_LOAD0_DS_ds(Segment ds)
{
return 0xffff & ds.getSelector();
}
public static int reg0_hef_LOAD0_FS_fs(Segment fs)
{
return 0xffff & fs.getSelector();
}
public static int reg0_hef_LOAD0_GS_gs(Segment gs)
{
return 0xffff & gs.getSelector();
}
public static int reg0_nef_LOAD0_IB_immediate(int immediate)
{
return immediate & 0xff;
}
public static int reg0_nef_LOAD0_IW_immediate(int immediate)
{
return immediate & 0xffff;
}
public static int reg0_nef_LOAD0_ID_immediate(int immediate)
{
return immediate;
}
public static int reg0_hef_LOAD0_MEM_BYTE_seg0_addr0(Segment seg0, int addr0)
{
return 0xff & seg0.getByte(addr0);
}
public static int reg0_hef_LOAD0_MEM_WORD_seg0_addr0(Segment seg0, int addr0)
{
return 0xffff & seg0.getWord(addr0);
}
public static int reg0_hef_LOAD0_MEM_DWORD_seg0_addr0(Segment seg0, int addr0)
{
return seg0.getDoubleWord(addr0);
}
public static int reg0_nef_LOAD0_FLAGS_cflag_pflag_aflag_zflag_sflag_tflag_iflag_dflag_oflag_iopl_ntflag(int cflag, int pflag, int aflag, int zflag, int sflag, int tflag, int iflag, int dflag, int oflag, int iopl, int ntflag)
{
int eflags = 0;
eflags |= ntflag << 14;
eflags |= iopl << 12;
eflags |= oflag << 11;
eflags |= dflag << 10;
eflags |= iflag << 9;
eflags |= tflag << 8;
eflags |= sflag << 7;
eflags |= zflag << 6;
eflags |= aflag << 4;
eflags |= pflag << 2;
eflags |= cflag;
eflags |= 2;
return eflags;
}
public static int reg0_nef_LOAD0_ADDR_addr0(int addr0)
{
return addr0;
}
public static int reg1_nef_LOAD1_AL_eax(int eax)
{
return eax & 0xff;
}
public static int reg1_nef_LOAD1_CL_ecx(int ecx)
{
return ecx & 0xff;
}
public static int reg1_nef_LOAD1_DL_edx(int edx)
{
return edx & 0xff;
}
public static int reg1_nef_LOAD1_BL_ebx(int ebx)
{
return ebx & 0xff;
}
public static int reg1_nef_LOAD1_AH_eax(int eax)
{
return (eax >>> 8) & 0xff;
}
public static int reg1_nef_LOAD1_CH_ecx(int ecx)
{
return (ecx >>> 8) & 0xff;
}
public static int reg1_nef_LOAD1_DH_edx(int edx)
{
return (edx >>> 8) & 0xff;
}
public static int reg1_nef_LOAD1_BH_ebx(int ebx)
{
return (ebx >>> 8) & 0xff;
}
public static int reg1_nef_LOAD1_AX_eax(int eax)
{
return eax & 0xffff;
}
public static int reg1_nef_LOAD1_CX_ecx(int ecx)
{
return ecx & 0xffff;
}
public static int reg1_nef_LOAD1_DX_edx(int edx)
{
return edx & 0xffff;
}
public static int reg1_nef_LOAD1_BX_ebx(int ebx)
{
return ebx & 0xffff;
}
public static int reg1_nef_LOAD1_SP_esp(int esp)
{
return esp & 0xffff;
}
public static int reg1_nef_LOAD1_BP_ebp(int ebp)
{
return ebp & 0xffff;
}
public static int reg1_nef_LOAD1_SI_esi(int esi)
{
return esi & 0xffff;
}
public static int reg1_nef_LOAD1_DI_edi(int edi)
{
return edi & 0xffff;
}
public static int reg1_nef_LOAD1_EAX_eax(int eax)
{
return eax;
}
public static int reg1_nef_LOAD1_ECX_ecx(int ecx)
{
return ecx;
}
public static int reg1_nef_LOAD1_EDX_edx(int edx)
{
return edx;
}
public static int reg1_nef_LOAD1_EBX_ebx(int ebx)
{
return ebx;
}
public static int reg1_nef_LOAD1_ESP_esp(int esp)
{
return esp;
}
public static int reg1_nef_LOAD1_EBP_ebp(int ebp)
{
return ebp;
}
public static int reg1_nef_LOAD1_ESI_esi(int esi)
{
return esi;
}
public static int reg1_nef_LOAD1_EDI_edi(int edi)
{
return edi;
}
public static int reg1_nef_LOAD1_IB_immediate(int immediate)
{
return immediate & 0xff;
}
public static int reg1_nef_LOAD1_IW_immediate(int immediate)
{
return immediate & 0xffff;
}
public static int reg1_nef_LOAD1_ID_immediate(int immediate)
{
return immediate;
}
public static int reg1_hef_LOAD1_MEM_BYTE_seg0_addr0(Segment seg0, int addr0)
{
return 0xff & seg0.getByte(addr0);
}
public static int reg1_hef_LOAD1_MEM_WORD_seg0_addr0(Segment seg0, int addr0)
{
return 0xffff & seg0.getWord(addr0);
}
public static int reg1_hef_LOAD1_MEM_DWORD_seg0_addr0(Segment seg0, int addr0)
{
return seg0.getDoubleWord(addr0);
}
public static int reg2_nef_LOAD2_EAX_eax(int eax)
{
return eax;
}
public static int reg2_nef_LOAD2_AX_eax(int eax)
{
return 0xffff & eax;
}
public static int reg2_nef_LOAD2_AL_eax(int eax)
{
return 0xff & eax;
}
public static int reg2_nef_LOAD2_CL_ecx(int ecx)
{
return 0xff & ecx;
}
public static int reg2_nef_LOAD2_IB_immediate(int immediate)
{
return immediate & 0xff;
}
public static Segment seg0_nef_LOAD_SEG_CS_cs(Segment cs)
{
return cs;
}
public static Segment seg0_nef_LOAD_SEG_DS_ds(Segment ds)
{
return ds;
}
public static Segment seg0_nef_LOAD_SEG_ES_es(Segment es)
{
return es;
}
public static Segment seg0_nef_LOAD_SEG_FS_fs(Segment fs)
{
return fs;
}
public static Segment seg0_nef_LOAD_SEG_GS_gs(Segment gs)
{
return gs;
}
public static Segment seg0_nef_LOAD_SEG_SS_ss(Segment ss)
{
return ss;
}
public static int eax_nef_STORE0_AL_eax_reg0(int eax, int reg0)
{
return (eax & ~0xff) | (reg0 & 0xff);
}
public static int ecx_nef_STORE0_CL_ecx_reg0(int ecx, int reg0)
{
return (ecx & ~0xff) | (reg0 & 0xff);
}
public static int edx_nef_STORE0_DL_edx_reg0(int edx, int reg0)
{
return (edx & ~0xff) | (reg0 & 0xff);
}
public static int ebx_nef_STORE0_BL_ebx_reg0(int ebx, int reg0)
{
return (ebx & ~0xff) | (reg0 & 0xff);
}
public static int eax_nef_STORE0_AH_eax_reg0(int eax, int reg0)
{
return (eax & ~0xff00) | ((reg0 << 8) & 0xff00);
}
public static int ecx_nef_STORE0_CH_ecx_reg0(int ecx, int reg0)
{
return (ecx & ~0xff00) | ((reg0 << 8) & 0xff00);
}
public static int edx_nef_STORE0_DH_edx_reg0(int edx, int reg0)
{
return (edx & ~0xff00) | ((reg0 << 8) & 0xff00);
}
public static int ebx_nef_STORE0_BH_ebx_reg0(int ebx, int reg0)
{
return (ebx & ~0xff00) | ((reg0 << 8) & 0xff00);
}
public static int eax_nef_STORE0_AX_eax_reg0(int eax, int reg0)
{
return (eax & ~0xffff) | (reg0 & 0xffff);
}
public static int ecx_nef_STORE0_CX_ecx_reg0(int ecx, int reg0)
{
return (ecx & ~0xffff) | (reg0 & 0xffff);
}
public static int edx_nef_STORE0_DX_edx_reg0(int edx, int reg0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -