* Entry point. */
| 22 | * Entry point. |
| 23 | */ |
| 24 | void entry(const void *addr, const uint8_t *instr, size_t size, |
| 25 | const char *_asm) |
| 26 | { |
| 27 | static mutex_t mutex = MUTEX_INITIALIZER; |
| 28 | if (mutex_lock(&mutex) < 0) |
| 29 | return; |
| 30 | |
| 31 | clearerr(stderr); |
| 32 | fprintf(stderr, RED "%.16lx" WHITE ": " YELLOW, addr); |
| 33 | int i; |
| 34 | for (i = 0; i < size; i++) |
| 35 | { |
| 36 | fprintf(stderr, "%.2x ", instr[i]); |
| 37 | if (i == 7 && size > 8) |
| 38 | fprintf(stderr, GREEN "%s" WHITE "\n " |
| 39 | YELLOW, _asm); |
| 40 | } |
| 41 | if (i <= 8) |
| 42 | { |
| 43 | for (; i < 8; i++) |
| 44 | fputs(" ", stderr); |
| 45 | fprintf(stderr, GREEN "%s", _asm); |
| 46 | } |
| 47 | fputs(WHITE "\n", stderr); |
| 48 | fflush(stderr); |
| 49 | |
| 50 | mutex_unlock(&mutex); |
| 51 | } |
| 52 | |
| 53 | /* |
| 54 | * Init. |
nothing calls this directly
no test coverage detected