summaryrefslogtreecommitdiff
path: root/masm/asm.h
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-10-09 12:07:59 -0400
committerFreya Murphy <freya@freyacat.org>2024-10-09 12:07:59 -0400
commitb663f827057fc9fb199293bc1920cf27315d1846 (patch)
tree477b481694ad50f28bac538bb9b301861b3af4d6 /masm/asm.h
parentupdate generator to support multipe isas, expand grammer syntax (diff)
downloadmips-b663f827057fc9fb199293bc1920cf27315d1846.tar.gz
mips-b663f827057fc9fb199293bc1920cf27315d1846.tar.bz2
mips-b663f827057fc9fb199293bc1920cf27315d1846.zip
refactor elf32 assembler, add support for multiple isa's in cmdline
Diffstat (limited to 'masm/asm.h')
-rw-r--r--masm/asm.h99
1 files changed, 0 insertions, 99 deletions
diff --git a/masm/asm.h b/masm/asm.h
index fecd335..e69de29 100644
--- a/masm/asm.h
+++ b/masm/asm.h
@@ -1,99 +0,0 @@
-/* Copyright (c) 2024 Freya Murphy */
-
-#ifndef __ASM_H__
-#define __ASM_H__
-
-#include <elf.h>
-
-#include "gen.h"
-
-///
-/// ELF string table
-///
-
-struct elf_str_table {
- // size of the ptr in bytes
- size_t size;
-
- // pointer that contains
- // the strings
- char *ptr;
-};
-
-/* initalize a string table */
-int strtab_init(struct elf_str_table *strtab);
-
-/* free a string table */
-void strtab_free(struct elf_str_table *strtab);
-
-/* get a string form the string table */
-int strtab_get_str(struct elf_str_table *strtab, const char *str, size_t *res);
-
-/* get or append a string into the string table */
-int strtab_write_str(struct elf_str_table *strtab, const char *str, size_t *res);
-
-///
-/// elf section
-///
-
-/* holds a section of the asm file (i.e. .text, .bss, .data) */
-struct elf_section {
- // section data *weak* pointer
- struct section *data;
-
- // index of the section in
- // the ELF shdr
- size_t shdr_idx;
-
- // relocation table
- size_t reltab_shidx;
- uint32_t reltab_len;
- Elf32_Rel *reltab;
-};
-
-///
-/// assembler
-///
-
-struct assembler {
- // the code generator
- struct generator gen;
-
- /// symbol table
- size_t symtab_shidx;
- size_t symtab_len;
- Elf32_Sym *symbols;
-
- // sh string table
- size_t strtab_shidx;
- struct elf_str_table strtab;
-
- // string table
- size_t shstrtab_shidx;
- struct elf_str_table shstrtab;
-
- /// sections
- uint32_t section_len;
- struct elf_section *sections;
-
- /// section header
- Elf32_Shdr *shdr;
- uint32_t shdr_len;
-};
-
-/* defines arguments to the assembler */
-struct assembler_arguments {
- char *in_file;
- char *out_file;
-};
-
-/* initalize the assembler */
-int assembler_init(struct assembler *assembler, const char *path);
-
-/* free the assembler */
-void assembler_free(struct assembler *assembler);
-
-/* assemble a file */
-int assemble_file(struct assembler_arguments args);
-
-#endif /* __ASM_H__ */