X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=disassembler%2Fmain.c;h=7fc8536384ec27c54259a02a9ac09532902b69b8;hb=1a0b297432349ca1ad02461f962dc805da1e6949;hp=8ae804077b7055552788cac7fffd80a346a0b958;hpb=2e928c1b94243e38477f113b92d78876a15439be;p=b43-tools.git diff --git a/disassembler/main.c b/disassembler/main.c index 8ae8040..7fc8536 100644 --- a/disassembler/main.c +++ b/disassembler/main.c @@ -11,6 +11,7 @@ * GNU General Public License for more details. */ +#include "main.h" #include "list.h" #include "util.h" #include "args.h" @@ -20,20 +21,6 @@ #include #include -#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) - -/* The header that fwcutter puts in to every .fw file */ -struct fw_header { - /* Type of the firmware data */ - uint8_t type; - /* Version number of the firmware data format */ - uint8_t ver; - uint8_t __padding[2]; - /* Size of the data. For ucode and PCM this is in bytes. - * For IV this is in number-of-ivs. */ - uint32_t size; -} __attribute__ ((__packed__)); - struct bin_instruction { unsigned int opcode; @@ -699,11 +686,11 @@ static int read_input(struct disassembler_context *ctx) fprintf(stderr, "Corrupt input file (not fwcutter output)\n"); goto err_close; } - if (hdr.type != 'u') { + if (hdr.type != FW_TYPE_UCODE) { fprintf(stderr, "Corrupt input file. Not a microcode image.\n"); goto err_close; } - if (hdr.ver != 1) { + if (hdr.ver != FW_HDR_VER) { fprintf(stderr, "Invalid input file header version.\n"); goto err_close; }