Initial commit: GKERN glyph kernel
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#include "../common/glyph_types.h"
|
||||
#include "../common/glyph_decode.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 2) return 1;
|
||||
FILE *f = fopen(argv[1], "rb"); if (!f) return 1;
|
||||
GobjHeader hdr; fread(&hdr, sizeof(GobjHeader), 1, f);
|
||||
uint32_t *code = malloc(hdr.code_len * sizeof(uint32_t)); fread(code, sizeof(uint32_t), hdr.code_len, f); fclose(f);
|
||||
printf("; Disassembly of %s (%u instructions)\n", argv[1], hdr.code_len);
|
||||
for (uint32_t i = 0; i < hdr.code_len; i++) {
|
||||
GlyphInstr ins = glyph_decode(code[i]);
|
||||
uint8_t op_a, op_b; glyph_decode_ops(ins.opcode_local, &op_a, &op_b);
|
||||
printf("%04u: [0x%08X] F%02u.%u %%r%u, %%r%u\n", i, code[i], ins.family_id, ins.sub_id, op_a, op_b);
|
||||
}
|
||||
free(code); return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user