register.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 168 行
JAVA
168 行
/**
* $Id: Register.java,v 1.1 2003/11/25 11:42:28 epr Exp $
*/
package org.jnode.assembler.x86;
/**
* <description>
*
* @author epr
*/
public class Register
implements X86Constants {
public static final Register AL = new Register("al", REG_AL, REG8, 0);
public static final Register AH = new Register("ah", REG8, REG8, 4);
public static final Register AX = new Register("ax", REG_AX, REG16, 0);
public static final Register EAX = new Register("eax", REG_EAX, REG32, 0);
public static final Register BL = new Register("bl", REG8, REG8, 3);
public static final Register BH = new Register("bh", REG8, REG8, 7);
public static final Register BX = new Register("bx", REG16, REG16, 3);
public static final Register EBX = new Register("ebx", REG32, REG32, 3);
public static final Register CL = new Register("cl", REG_CL, REG8, 1);
public static final Register CH = new Register("ch", REG8, REG8, 5);
public static final Register CX = new Register("cx", REG_CX, REG16, 1);
public static final Register ECX = new Register("ecx", REG_ECX, REG32, 1);
public static final Register DL = new Register("dl", REG8, REG8, 2);
public static final Register DH = new Register("dh", REG8, REG8, 6);
public static final Register DX = new Register("dx", REG_DX, REG16, 2);
public static final Register EDX = new Register("edx", REG32, REG32, 2);
public static final Register SP = new Register("sp", REG16, REG16, 4);
public static final Register ESP = new Register("esp", REG32, REG32, 4);
public static final Register BP = new Register("bp", REG16, REG16, 5);
public static final Register EBP = new Register("ebp", REG32, REG32, 5);
public static final Register SI = new Register("si", REG16, REG16, 6);
public static final Register ESI = new Register("esi", REG32, REG32, 6);
public static final Register DI = new Register("di", REG16, REG16, 7);
public static final Register EDI = new Register("edi", REG32, REG32, 7);
/* Segment registers */
public static final Register CS = new Register("cs", REG_CS, REG_SREG, 1);
public static final Register DS = new Register("ds", REG_DESS, REG_SREG, 3);
public static final Register ES = new Register("es", REG_DESS, REG_SREG, 0);
public static final Register SS = new Register("ss", REG_DESS, REG_SREG, 2);
public static final Register FS = new Register("fs", REG_FSGS, REG_SREG, 4);
public static final Register GS = new Register("gs", REG_FSGS, REG_SREG, 5);
public static final Register SEGR6 = new Register("segr6", REG_SEG67, REG_SREG, 6);
public static final Register SEGR7 = new Register("segr7", REG_SEG67, REG_SREG, 7);
/* Control registers */
public static final Register CR0 = new Register("cr0", REG_CREG, REG_CREG, 0);
public static final Register CR1 = new Register("cr1", REG_CREG, REG_CREG, 1);
public static final Register CR2 = new Register("cr2", REG_CREG, REG_CREG, 2);
public static final Register CR3 = new Register("cr3", REG_CREG, REG_CREG, 3);
public static final Register CR4 = new Register("cr4", REG_CREG, REG_CREG, 4);
public static final Register CR5 = new Register("cr5", REG_CREG, REG_CREG, 5);
public static final Register CR6 = new Register("cr6", REG_CREG, REG_CREG, 6);
public static final Register CR7 = new Register("cr7", REG_CREG, REG_CREG, 7);
/* Debug registers */
public static final Register DR0 = new Register("dr0", REG_DREG, REG_DREG, 0);
public static final Register DR1 = new Register("dr1", REG_DREG, REG_DREG, 1);
public static final Register DR2 = new Register("dr2", REG_DREG, REG_DREG, 2);
public static final Register DR3 = new Register("dr3", REG_DREG, REG_DREG, 3);
public static final Register DR4 = new Register("dr4", REG_DREG, REG_DREG, 4);
public static final Register DR5 = new Register("dr5", REG_DREG, REG_DREG, 5);
public static final Register DR6 = new Register("dr6", REG_DREG, REG_DREG, 6);
public static final Register DR7 = new Register("dr7", REG_DREG, REG_DREG, 7);
/* Test registers */
public static final Register TR0 = new Register("tr0", REG_TREG, REG_TREG, 0);
public static final Register TR1 = new Register("tr1", REG_TREG, REG_TREG, 1);
public static final Register TR2 = new Register("tr2", REG_TREG, REG_TREG, 2);
public static final Register TR3 = new Register("tr3", REG_TREG, REG_TREG, 3);
public static final Register TR4 = new Register("tr4", REG_TREG, REG_TREG, 4);
public static final Register TR5 = new Register("tr5", REG_TREG, REG_TREG, 5);
public static final Register TR6 = new Register("tr6", REG_TREG, REG_TREG, 6);
public static final Register TR7 = new Register("tr7", REG_TREG, REG_TREG, 7);
/* Floating-point registers */
public static final Register ST0 = new Register("st0", FPU0, FPUREG, 0);
public static final Register ST1 = new Register("st1", FPUREG, FPUREG, 1);
public static final Register ST2 = new Register("st2", FPUREG, FPUREG, 2);
public static final Register ST3 = new Register("st3", FPUREG, FPUREG, 3);
public static final Register ST4 = new Register("st4", FPUREG, FPUREG, 4);
public static final Register ST5 = new Register("st5", FPUREG, FPUREG, 5);
public static final Register ST6 = new Register("st6", FPUREG, FPUREG, 6);
public static final Register ST7 = new Register("st7", FPUREG, FPUREG, 7);
/* MMX registers */
public static final Register MM0 = new Register("mm0", MMXREG, MMXREG, 0);
public static final Register MM1 = new Register("mm1", MMXREG, MMXREG, 1);
public static final Register MM2 = new Register("mm2", MMXREG, MMXREG, 2);
public static final Register MM3 = new Register("mm3", MMXREG, MMXREG, 3);
public static final Register MM4 = new Register("mm4", MMXREG, MMXREG, 4);
public static final Register MM5 = new Register("mm5", MMXREG, MMXREG, 5);
public static final Register MM6 = new Register("mm6", MMXREG, MMXREG, 6);
public static final Register MM7 = new Register("mm7", MMXREG, MMXREG, 7);
/* SSE registers */
public static final Register XMM0 = new Register("xmm0", XMMREG, XMMREG, 0);
public static final Register XMM1 = new Register("xmm1", XMMREG, XMMREG, 1);
public static final Register XMM2 = new Register("xmm2", XMMREG, XMMREG, 2);
public static final Register XMM3 = new Register("xmm3", XMMREG, XMMREG, 3);
public static final Register XMM4 = new Register("xmm4", XMMREG, XMMREG, 4);
public static final Register XMM5 = new Register("xmm5", XMMREG, XMMREG, 5);
public static final Register XMM6 = new Register("xmm6", XMMREG, XMMREG, 6);
public static final Register XMM7 = new Register("xmm7", XMMREG, XMMREG, 7);
private String name;
private int type;
private int nr;
private int size;
public Register(String name, int type, int type2, int nr) {
this.name = name;
this.type = type;
this.nr = nr;
this.size = type & X86Constants.SIZE_MASK;
}
/**
* Returns the name.
* @return String
*/
public String getName() {
return name;
}
/**
* Returns the type.
* @return int
*/
public int getType() {
return type;
}
/**
* Returns the nr.
* @return int
*/
public int getNr() {
return nr;
}
/**
* Returns the size of this register
* @return int
* @see X86Constants#BITS8
* @see X86Constants#BITS16
* @see X86Constants#BITS32
* @see X86Constants#BITS64
* @see X86Constants#BITS80
*/
public int getSize() {
return size;
}
public String toString() {
return name;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?