| 257 | } |
| 258 | |
| 259 | int main(int argc, char * argv[]) |
| 260 | { |
| 261 | if (argc < 4) { |
| 262 | std::cout << "Usage: <function name> <function params> <target selector>\n" << std::flush; |
| 263 | return -1; |
| 264 | } |
| 265 | |
| 266 | #if defined (__AVX2__) |
| 267 | std::cout << "AVX2 enabled\n"; |
| 268 | #endif |
| 269 | |
| 270 | const uint32_t selector = normalizeEndianess(std::stol(argv[3], nullptr, 16)); |
| 271 | const SmallString functionName(argv[1]); |
| 272 | const SmallString functionParams(argv[2]); |
| 273 | |
| 274 | if (functionName.length + functionParams.length >= 115) { |
| 275 | std::cout << "Total length of <function name> and <function params> must be under 115 bytes."; |
| 276 | return -1; |
| 277 | } |
| 278 | |
| 279 | if (sizeof(char) != 1 || sizeof(uint64_t) != 8) { |
| 280 | std::cout << "Incompatible architecture\n"; |
| 281 | return -1; |
| 282 | } |
| 283 | |
| 284 | std::cout << "Function name: " << argv[1] << "\n"; |
| 285 | std::cout << "Function params: " << argv[2] << "\n"; |
| 286 | std::cout << "Target selector: " << functionSelectorToHex(normalizeEndianess(selector)) << "\n"; |
| 287 | |
| 288 | if (functionName.length <= 64 && functionParams.length <= 64) { |
| 289 | mine<64>(functionName, functionParams, selector); |
| 290 | } else { |
| 291 | mine<0>(functionName, functionParams, selector); |
| 292 | } |
| 293 | |
| 294 | return 0; |
| 295 | } |
nothing calls this directly
no test coverage detected