2022-06-04 00:19:58 +00:00
|
|
|
/* SPDX-FileCopyrightText: © 2022 Decompollaborate */
|
|
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
|
2022-06-08 04:30:58 +00:00
|
|
|
#include "instructions/RabbitizerInstruction.h"
|
2022-06-04 00:19:58 +00:00
|
|
|
|
2022-06-04 16:43:54 +00:00
|
|
|
#include <assert.h>
|
2022-06-04 06:42:17 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2022-06-04 00:19:58 +00:00
|
|
|
|
2022-06-04 16:43:54 +00:00
|
|
|
|
2022-06-04 00:19:58 +00:00
|
|
|
int main() {
|
2022-06-04 02:39:10 +00:00
|
|
|
uint32_t word = 0x8D4A7E18;
|
2022-06-08 04:30:58 +00:00
|
|
|
RabbitizerInstruction instr;
|
2022-06-04 06:42:17 +00:00
|
|
|
char *buffer;
|
2022-06-04 16:43:54 +00:00
|
|
|
int extraLJust = 10;
|
2022-06-04 00:19:58 +00:00
|
|
|
|
2022-06-08 04:30:58 +00:00
|
|
|
RabbitizerInstruction_init(&instr, word);
|
2022-06-04 00:19:58 +00:00
|
|
|
|
2022-06-08 04:30:58 +00:00
|
|
|
RabbitizerInstruction_processUniqueId(&instr);
|
2022-06-04 05:24:59 +00:00
|
|
|
|
2022-06-08 04:30:58 +00:00
|
|
|
buffer = malloc(RabbitizerInstruction_getSizeForBuffer(&instr, 0, extraLJust) + 1);
|
2022-06-04 16:43:54 +00:00
|
|
|
assert(buffer != NULL);
|
2022-06-04 06:42:17 +00:00
|
|
|
|
2022-06-08 04:30:58 +00:00
|
|
|
RabbitizerInstruction_disassemble(&instr, buffer, NULL, 0, extraLJust);
|
2022-06-04 00:19:58 +00:00
|
|
|
|
|
|
|
printf("%08X: %s\n", word, buffer);
|
|
|
|
|
2022-06-04 06:42:17 +00:00
|
|
|
free(buffer);
|
2022-06-08 04:30:58 +00:00
|
|
|
RabbitizerInstruction_destroy(&instr);
|
2022-06-04 00:19:58 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|