Previous 15994 Revisions Next

r6723 Wednesday 23rd December, 2009 at 03:19:55 UTC by Barry Rodewald
[i386] Basic implementation of LSL instruction. Fixed REP when used with a segment override. (also sent to MAMEdev)
[src/emu/cpu/i386]i386op16.c i386op32.c i386ops.c i386ops.h

src/emu/cpu/i386/i386op16.c
r6722r6723
31053105   }
31063106}
31073107
3108static void I386OP(lsl_r16_rm16)(i386_state *cpustate)  // Opcode 0x0f 0x03
3109{
3110   UINT8 modrm = FETCH(cpustate);
3111   UINT32 limit;
3112   I386_SREG seg;
3113   
3114   if(PROTECTED_MODE)
3115   {
3116      memset(&seg, 0, sizeof(seg));
3117      seg.selector = LOAD_RM16(modrm);
3118      if(seg.selector == 0)
3119      {
3120         SetZF(0);  // not a valid segment
3121      }
3122      else
3123      {
3124         // TODO: check segment type
3125         i386_load_protected_mode_segment(cpustate,&seg);
3126         limit = seg.limit;
3127         STORE_REG16(modrm,limit & 0x0000ffff);
3128         SetZF(1);
3129      }
3130   }
3131   else
3132      i386_trap(cpustate,6, 0);
3133}
3134
31083135static void I386OP(bound_r16_m16_m16)(i386_state *cpustate)   // Opcode 0x62
31093136{
31103137   UINT8 modrm;
src/emu/cpu/i386/i386ops.h
r6722r6723
288288   { 0x01,      OP_2BYTE|OP_I386,         I386OP(group0F01_16),         I386OP(group0F01_32),      },
289289   { 0x01,      OP_2BYTE|OP_I486,         I486OP(group0F01_16),         I486OP(group0F01_32),      },
290290   { 0x02,      OP_2BYTE|OP_I386,         I386OP(unimplemented),         I386OP(unimplemented),      },
291   { 0x03,      OP_2BYTE|OP_I386,         I386OP(unimplemented),         I386OP(unimplemented),      },
291   { 0x03,      OP_2BYTE|OP_I386,         I386OP(lsl_r16_rm16),         I386OP(lsl_r32_rm32),      },
292292   { 0x06,      OP_2BYTE|OP_I386,         I386OP(clts),               I386OP(clts),            },
293293   { 0x08,      OP_2BYTE|OP_I486,         I486OP(invd),               I486OP(invd),            },
294294   { 0x09,      OP_2BYTE|OP_I486,         I486OP(wbinvd),               I486OP(wbinvd),            },
src/emu/cpu/i386/i386ops.c
r6722r6723
10301030   opcode = FETCH(cpustate);
10311031   switch(opcode) {
10321032      case 0x26:
1033       cpustate->segment_override=1;
1034      cpustate->segment_prefix=ES;
1033       cpustate->segment_override=ES;
1034      cpustate->segment_prefix=1;
10351035      break;
10361036      case 0x2e:
1037       cpustate->segment_override=1;
1038      cpustate->segment_prefix=CS;
1037       cpustate->segment_override=CS;
1038      cpustate->segment_prefix=1;
10391039      break;
10401040      case 0x36:
1041       cpustate->segment_override=1;
1042      cpustate->segment_prefix=SS;
1041       cpustate->segment_override=SS;
1042      cpustate->segment_prefix=1;
10431043      break;
10441044      case 0x3e:
1045       cpustate->segment_override=1;
1046      cpustate->segment_prefix=DS;
1045       cpustate->segment_override=DS;
1046      cpustate->segment_prefix=1;
10471047      break;
10481048      case 0x64:
1049       cpustate->segment_override=1;
1050      cpustate->segment_prefix=FS;
1049       cpustate->segment_override=FS;
1050      cpustate->segment_prefix=1;
10511051      break;
10521052      case 0x65:
1053       cpustate->segment_override=1;
1054      cpustate->segment_prefix=GS;
1053       cpustate->segment_override=GS;
1054      cpustate->segment_prefix=1;
10551055      break;
10561056      case 0x66:
10571057      cpustate->operand_size ^= 1;
src/emu/cpu/i386/i386op32.c
r6722r6723
29232923   }
29242924}
29252925
2926static void I386OP(lsl_r32_rm32)(i386_state *cpustate)  // Opcode 0x0f 0x03
2927{
2928   UINT8 modrm = FETCH(cpustate);
2929   UINT32 limit;
2930   I386_SREG seg;
2931
2932   if(PROTECTED_MODE)
2933   {
2934      memset(&seg, 0, sizeof(seg));
2935      seg.selector = LOAD_RM32(modrm);
2936      if(seg.selector == 0)
2937      {
2938         SetZF(0);  // not a valid segment
2939      }
2940      else
2941      {
2942         // TODO: check segment type
2943         i386_load_protected_mode_segment(cpustate,&seg);
2944         limit = seg.limit;
2945         STORE_REG32(modrm,limit);
2946         SetZF(1);
2947      }
2948   }
2949   else
2950      i386_trap(cpustate,6, 0);
2951}
2952
29262953static void I386OP(bound_r32_m32_m32)(i386_state *cpustate)   // Opcode 0x62
29272954{
29282955   UINT8 modrm;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team