Advertisement
FlyFar

opcodes.h

May 17th, 2024
532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.12 KB | Cybersecurity | 0 0
  1. /*
  2.  * Copyright (c) 2004 by Archim
  3.  * All rights reserved.
  4.  *
  5.  * For License information please see LICENSE (that was unexpected wasn't it!).
  6.  *
  7.  *
  8.  */
  9.  
  10. #ifndef __i386
  11. struct sethi_opcode
  12. {
  13.   unsigned op:2;
  14.   unsigned regd:5;
  15.   unsigned op2:3;
  16.   unsigned imm:22;
  17. };
  18.  
  19. typedef struct sethi_opcode sethi_t;
  20.  
  21. struct or_opcode
  22. {
  23.  
  24.   unsigned op:2;
  25.   unsigned regd:5;
  26.   unsigned op3:6;
  27.   unsigned rs1:5;
  28.   unsigned i_fl:1;
  29.   unsigned imm:13;
  30.  
  31. };
  32.  
  33. typedef struct or_opcode or_t;
  34.  
  35.  
  36.  
  37. struct nop_opcode
  38. {
  39.   unsigned nopc:32;
  40. };
  41.  
  42. typedef struct nop_opcode nop_t;
  43.  
  44. struct jmp_opcode {
  45.   unsigned start:2;
  46.   unsigned regdest:5;
  47.   unsigned op3:6;
  48.   unsigned rs1:5;
  49.   unsigned i_fl:1;
  50.   unsigned simm13:13;
  51. };
  52.  
  53. typedef struct jmp_opcode jmp_t;
  54.  
  55.   sethi_t sethop;
  56.   or_t orop;
  57.   jmp_t jop;
  58.   nop_t nop;
  59.  
  60. #else
  61. // come on I did some of the work for you.
  62. struct jmpl_opcode{
  63. unsigned offs:16;
  64. unsigned dest:32;
  65.   unsigned sig:8;
  66. };
  67.  
  68. struct nop_opcode{
  69.   unsigned nopc:8;
  70. };
  71.  
  72. typedef struct jmpl_opcode jmpl_t;
  73. typedef struct nop_opcode nop_t;
  74.  
  75.  
  76. jmpl_t jmpl_op;
  77. nop_t nop_op;
  78.  
  79. #endif
  80.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement