~ubuntu-branches/ubuntu/wily/hwinfo/wily

« back to all changes in this revision

Viewing changes to src/x86emu/ops2.c

  • Committer: Bazaar Package Importer
  • Author(s): William Vera
  • Date: 2009-06-08 22:18:36 UTC
  • mfrom: (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090608221836-1ss2hutt4xhq414c
Tags: 16.0-1
* New upstream release
* Renamed libhd15 to libhd16 according to new soname.
* Updated the watch file

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
REMARKS:
51
51
Handles illegal opcodes.
52
52
****************************************************************************/
53
 
static void x86emuOp2_illegal_op(
54
 
        u8 op2)
55
 
{
56
 
        START_OF_INSTR();
57
 
        DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
58
 
        TRACE_REGS();
59
 
        printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
60
 
                M.x86.R_CS, M.x86.R_IP-2,op2);
 
53
static void x86emuOp2_illegal_op(u8 op2)
 
54
{
 
55
  START_OF_INSTR();
 
56
  DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
 
57
  TRACE_REGS();
 
58
  printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n", M.x86.R_CS, M.x86.R_IP-2,op2);
 
59
  HALT_SYS();
 
60
  END_OF_INSTR();
 
61
}
 
62
 
 
63
/****************************************************************************
 
64
REMARKS:
 
65
Handles opcode 0x0f,0x01
 
66
****************************************************************************/
 
67
static void x86emuOp2_opc_01(u8 op2)
 
68
{
 
69
  int mod, rl, rh;
 
70
  u16 *destreg;
 
71
 
 
72
  /* dummy implementation: smsw always returns 0 */
 
73
 
 
74
  START_OF_INSTR();
 
75
  FETCH_DECODE_MODRM(mod, rh, rl);
 
76
 
 
77
  if(rh == 4 && mod == 3) {
 
78
    DECODE_PRINTF("SMSW\t");
 
79
    destreg = DECODE_RM_WORD_REGISTER(rl);
 
80
    DECODE_PRINTF("\n");
 
81
    *destreg = 0;
 
82
    TRACE_AND_STEP();
 
83
    DECODE_CLEAR_SEGOVR();
 
84
  }
 
85
  else {
 
86
    DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
 
87
    TRACE_REGS();
 
88
    printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n", M.x86.R_CS, M.x86.R_IP-2,op2);
61
89
    HALT_SYS();
62
 
    END_OF_INSTR();
63
 
}
 
90
  }
 
91
 
 
92
  END_OF_INSTR();
 
93
}
 
94
 
 
95
/****************************************************************************
 
96
REMARKS:
 
97
Handles opcode 0x0f,0x08
 
98
****************************************************************************/
 
99
static void x86emuOp2_invd(u8 op2)
 
100
{
 
101
  START_OF_INSTR();
 
102
  DECODE_PRINTF("INVD\n");
 
103
  TRACE_AND_STEP();
 
104
  DECODE_CLEAR_SEGOVR();
 
105
  END_OF_INSTR();
 
106
}
 
107
 
 
108
/****************************************************************************
 
109
REMARKS:
 
110
Handles opcode 0x0f,0x09
 
111
****************************************************************************/
 
112
static void x86emuOp2_wbinvd(u8 op2)
 
113
{
 
114
  START_OF_INSTR();
 
115
  DECODE_PRINTF("WBINVD\n");
 
116
  TRACE_AND_STEP();
 
117
  DECODE_CLEAR_SEGOVR();
 
118
  END_OF_INSTR();
 
119
}
 
120
 
 
121
/****************************************************************************
 
122
REMARKS:
 
123
Handles opcode 0x0f,0x30
 
124
****************************************************************************/
 
125
static void x86emuOp2_wrmsr(u8 op2)
 
126
{
 
127
  /* dummy implementation, does nothing */
 
128
 
 
129
  START_OF_INSTR();
 
130
  DECODE_PRINTF("WRMSR\n");
 
131
  TRACE_AND_STEP();
 
132
  DECODE_CLEAR_SEGOVR();
 
133
  END_OF_INSTR();
 
134
}
 
135
 
 
136
/****************************************************************************
 
137
REMARKS:
 
138
Handles opcode 0x0f,0x32
 
139
****************************************************************************/
 
140
static void x86emuOp2_rdmsr(u8 op2)
 
141
{
 
142
  /* dummy implementation, always return 0 */
 
143
 
 
144
  START_OF_INSTR();
 
145
  DECODE_PRINTF("RDMSR\n");
 
146
  TRACE_AND_STEP();
 
147
  M.x86.R_EDX = 0;
 
148
  M.x86.R_EAX = 0;
 
149
  DECODE_CLEAR_SEGOVR();
 
150
  END_OF_INSTR();
 
151
}  
64
152
 
65
153
#define xorl(a,b)   ((a) && !(b)) || (!(a) && (b))
66
154
 
2532
2620
void (*x86emu_optab2[256])(u8) =
2533
2621
{
2534
2622
/*  0x00 */ x86emuOp2_illegal_op,  /* Group F (ring 0 PM)      */
2535
 
/*  0x01 */ x86emuOp2_illegal_op,  /* Group G (ring 0 PM)      */
 
2623
/*  0x01 */ x86emuOp2_opc_01,      /* Group G (ring 0 PM)      */
2536
2624
/*  0x02 */ x86emuOp2_illegal_op,  /* lar (ring 0 PM)          */
2537
2625
/*  0x03 */ x86emuOp2_illegal_op,  /* lsl (ring 0 PM)          */
2538
2626
/*  0x04 */ x86emuOp2_illegal_op,
2539
2627
/*  0x05 */ x86emuOp2_illegal_op,  /* loadall (undocumented)   */
2540
2628
/*  0x06 */ x86emuOp2_illegal_op,  /* clts (ring 0 PM)         */
2541
2629
/*  0x07 */ x86emuOp2_illegal_op,  /* loadall (undocumented)   */
2542
 
/*  0x08 */ x86emuOp2_illegal_op,  /* invd (ring 0 PM)         */
2543
 
/*  0x09 */ x86emuOp2_illegal_op,  /* wbinvd (ring 0 PM)       */
 
2630
/*  0x08 */ x86emuOp2_invd,        /* invd (ring 0 PM)         */
 
2631
/*  0x09 */ x86emuOp2_wbinvd,      /* wbinvd (ring 0 PM)       */
2544
2632
/*  0x0a */ x86emuOp2_illegal_op,
2545
2633
/*  0x0b */ x86emuOp2_illegal_op,
2546
2634
/*  0x0c */ x86emuOp2_illegal_op,
2582
2670
/*  0x2e */ x86emuOp2_illegal_op,
2583
2671
/*  0x2f */ x86emuOp2_illegal_op,
2584
2672
 
2585
 
/*  0x30 */ x86emuOp2_illegal_op,
 
2673
/*  0x30 */ x86emuOp2_wrmsr,
2586
2674
/*  0x31 */ x86emuOp2_illegal_op,
2587
 
/*  0x32 */ x86emuOp2_illegal_op,
 
2675
/*  0x32 */ x86emuOp2_rdmsr,
2588
2676
/*  0x33 */ x86emuOp2_illegal_op,
2589
2677
/*  0x34 */ x86emuOp2_illegal_op,
2590
2678
/*  0x35 */ x86emuOp2_illegal_op,