| 132 | } |
| 133 | |
| 134 | int main(int ac, char **av) |
| 135 | { |
| 136 | int rc = -1; |
| 137 | char buf[256]; |
| 138 | int index; |
| 139 | char* disasm_cmd = 0; |
| 140 | int c; |
| 141 | |
| 142 | #define BATCH 10000000 |
| 143 | opterr = 0; |
| 144 | |
| 145 | while ((c = getopt(ac, av, "qspb")) != -1) |
| 146 | { |
| 147 | switch (c) |
| 148 | { |
| 149 | case 'q': |
| 150 | cs_mode_local = CS_MODE_QPX; |
| 151 | break; |
| 152 | case 's': |
| 153 | cs_mode_local = CS_MODE_SPE; |
| 154 | break; |
| 155 | case 'p': |
| 156 | cs_mode_local = CS_MODE_PS; |
| 157 | break; |
| 158 | case 'b': |
| 159 | littleendian = false; |
| 160 | break; |
| 161 | default: |
| 162 | usage(av[0]); |
| 163 | goto cleanup; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | if (optind >= ac) |
| 168 | { |
| 169 | usage(av[0]); |
| 170 | goto cleanup; |
| 171 | } |
| 172 | |
| 173 | disasm_cmd = av[optind]; |
| 174 | |
| 175 | powerpc_init(cs_mode_local); |
| 176 | |
| 177 | if(!strcasecmp(disasm_cmd, "repl")) { |
| 178 | printf("REPL mode!\n"); |
| 179 | printf("example inputs (write the words as if after endian fetch):\n"); |
| 180 | printf("93e1fffc\n"); |
| 181 | printf("9421ffe0\n"); |
| 182 | printf("7c3fb380\n"); |
| 183 | printf("38a00000\n"); |
| 184 | while(1) { |
| 185 | printf("disassemble> "); |
| 186 | |
| 187 | /* get line */ |
| 188 | if(NULL == fgets(buf, sizeof(buf), stdin)) { |
| 189 | printf("ERROR: fgets()\n"); |
| 190 | continue; |
| 191 | } |
nothing calls this directly
no test coverage detected