<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:#000000">Hi all. </div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:#000000"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:#000000">tl;dr: I would like to add a long x86 instruction which doesn't conform to any existing format that I know; I'm not sure where to start.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:#000000"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:#000000">I am attempting to add an instruction into X86, to be simulated in gem5. I've already added a simple, opcode-only instruction which I can successfully decode and run in gem5, so I am roughly familiar with .td files and how backends are built out of them.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:#000000"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:#000000">My goal now is to make a more complex instruction -- specifically, I need to add large operands. The format would look something like this:</div><div class="gmail_default" style=""><ul><li><font color="#000000" face="arial, helvetica, sans-serif">1 byte opcode (0x06, which I hijacked from PUSHES, which isn't implemented in gem5)</font></li><li><font color="#000000" face="arial, helvetica, sans-serif">n byte destination (memory location)</font></li><li><font color="#000000" face="arial, helvetica, sans-serif">n byte source (memory location)</font></li><li><font color="#000000" face="arial, helvetica, sans-serif">n byte source (memory location or  immediate)</font></li></ul><div><font color="#000000" face="arial, helvetica, sans-serif">If n=4, then the total opcode length is 13 bytes, which is under the 15 byte x86 limit.</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">As far as I know, this doesn't conform to any existing x86 format. Because that's the case, I'm not sure how to go about encoding an instruction like this; presumably, I can't use the existing I<..> class, which is what I'd used previously.</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">Can anyone point me in the general direction of what I will need to do to encode this rather arbitrary instruction format? Should I look into implementing a new Instruction class? Is there an easier way?</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">Thanks,</font></div><div><font color="#000000" face="arial, helvetica, sans-serif">Gus Smith, PSU</font></div></div></div>