Exemple #1
0
static void
ex(const char *s, ...)
{
  tino_va_list	list;

  tino_va_start(list, s);
  vex(210, &list, "error", errno);
  /* never reached	*/
}
Exemple #2
0
static void
to(const char *s, ...)
{
  tino_va_list	list;

  tino_va_start(list, s);
  vex(211, &list, "timeout", 0);
  /* never reached	*/
}
Exemple #3
0
static void
fin(int ret, const char *s, ...)
{
  tino_va_list	list;

  tino_va_start(list, s);
  vex(ret, &list, "info", 0);
  /* never reached	*/
}
Exemple #4
0
template <typename TBuffer> inline typename TBuffer::cursor_t TR_X86OpCode::OpCode_t::encode(typename TBuffer::cursor_t cursor, uint8_t rexbits) const
   {
   TBuffer buffer(cursor);
   if (isX87())
      {
      buffer.append(opcode);
      // Heuristics for X87 second byte opcode
      // It could be eliminated if GCC/MSVC fully support initializer list
      buffer.append((uint8_t)((modrm_opcode << 5) | (modrm_form << 3) | immediate_size));
      return buffer;
      }
   // Prefixes
   TR::Instruction::REX rex(rexbits);
   rex.W = rex_w;
   // Use AVX if possible
   if (supportsAVX() && TR::CodeGenerator::getX86ProcessorInfo().supportsAVX())
      {
      TR::Instruction::VEX<3> vex(rex, modrm_opcode);
      vex.m = escape;
      vex.L = vex_l;
      vex.p = prefixes;
      vex.opcode = opcode;
      if(vex.CanBeShortened())
         {
         buffer.append(TR::Instruction::VEX<2>(vex));
         }
      else
         {
         buffer.append(vex);
         }
      }
   else
      {
      switch (prefixes)
         {
         case PREFIX___:
            break;
         case PREFIX_66:
            buffer.append('\x66');
            break;
         case PREFIX_F2:
            buffer.append('\xf2');
            break;
         case PREFIX_F3:
            buffer.append('\xf3');
            break;
         default:
            break;
         }
      // REX
      if (rex.value() || rexbits)
         {
         buffer.append(rex);
         }
      // OpCode escape
      switch (escape)
         {
         case ESCAPE_____:
            break;
         case ESCAPE_0F__:
            buffer.append('\x0f');
            break;
         case ESCAPE_0F38:
            buffer.append('\x0f');
            buffer.append('\x38');
            break;
         case ESCAPE_0F3A:
            buffer.append('\x0f');
            buffer.append('\x3a');
            break;
         default:
            break;
         }
      // OpCode
      buffer.append(opcode);
      // ModRM
      if (modrm_form)
         {
         buffer.append(TR::Instruction::ModRM(modrm_opcode));
         }
      }
   return buffer;
   }