On Tue, May 8, 2012 at 4:12 AM, ilove junkmail <[email protected]>wrote:

> Hi,
>
> I'm a beginner in marss. I was trying to run a 32-bit image on marss. But
> every time I tried, I'll get a lot of invalid opcode in the log file, and
> marss will eventually crash by some related assertions. I have looked into
> the opcode types. Most of them are no longer supported in x86_64. And the
> others includes far jumps, load far pointers, ins/outs, and SSE4 three-byte
> instructions. I'm wondering is there any easy way to get around this
> problem? or I should implement all the missing parts of ptlsim decoder.
>
> Currently we don't support 32 bit because of such reasons.  Support for
ins/outs instructions were added in 0.3 release and also some 0xc2 opcode
based long jumps are also supported.  Regarding issues with SSE4
instructions, there are lot of new instructions added in SSE4.  To support
some of those instructions we need to add new 'micro-ops' in simulation
framework which will compute the real output of simulated instruction.

Implementing support for new instruction is not too difficult.  There are
basic steps you need to follow:
1. Find the details of instruction from x86 manuals (either from Intel or
AMD).  This instruction detail gives a pseudo-code on what this instruction
does.
2. Based on pseudo-code from manual, try to break down instruction into one
or more 'micro-ops' available in simulation framework.  Take a look at
ptlhwdef.h for list of all micro-ops.  For example, if your instruction
load data from memory and subtract from register and store result into that
register, this instruction can break down into two micro-ops: First OP_ld
to load data from memory to temporary register, and Second OP_sub to
subtract value in temp register and arch register.
3. In decoder file, add a 'case 0xXX' statement and implement your
instruction using micro-ops.

For step 3, there are many support function available:
  - DECODE() - This macro is used to decode instruction operands into
arch-register or memory location.
  - EndOfDecode() - This macro check if instruction is valid or not. Call
this before adding any 'micro-op' to TraceDecoder stream.
  - operand_load() - This function is used to load data from memory into
architecture or temporary registers.
  - alu_reg_or_mem() - This function performs ALU operations between
register and memory operands.
  - MakeInvalid() - If you find that instruction opcodes are invalid then
call this marco to set 'invalid' flags

If you have to add a new micro-op then add the micro-op in ptlhwdef.h and
ptlhwdef.cpp file. You'll also need to update core models opcode delay
structures to specify delay of your new micro-ops.  Then in 'uopimpl.cpp'
file add function that execute new micro-op.

Its a lengthy process but once you understand how things are connected its
easy to add new instructions.  Let me know if you get stuck somewhere.

- Avadh

 Regards,
> Nick
>
>
> _______________________________________________
> http://www.marss86.org
> Marss86-Devel mailing list
> [email protected]
> https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel
>
>
_______________________________________________
http://www.marss86.org
Marss86-Devel mailing list
[email protected]
https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel

Reply via email to