2019-12-14 22:33:57 +01:00
|
|
|
//---
|
|
|
|
// fxos.load: Data file lexers and loaders
|
|
|
|
//---
|
|
|
|
|
|
|
|
#ifndef LIBFXOS_LOAD_H
|
|
|
|
#define LIBFXOS_LOAD_H
|
|
|
|
|
|
|
|
#include <fxos/util.h>
|
2019-12-28 17:18:13 +01:00
|
|
|
#include <fxos/target.h>
|
2020-02-15 18:42:14 +01:00
|
|
|
#include <fxos/symbols.h>
|
2019-12-14 22:33:57 +01:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
namespace FxOS {
|
|
|
|
|
|
|
|
using Header = std::map<std::string, std::string>;
|
|
|
|
|
|
|
|
/* Load the header of a data file.
|
|
|
|
@file Data file, assumed with an fxos header type-specific contents
|
|
|
|
@offset Will be set to the byte offset where content starts
|
|
|
|
@line Will be set to the liner number where content starts
|
|
|
|
|
|
|
|
This function is used when reading all data files for fxos. The header
|
|
|
|
indicates the file type, thus the syntax of the contents. Some metadata can
|
|
|
|
also be specified here.
|
|
|
|
|
|
|
|
The parameters [offset] and [line] are set to reflect the location in the
|
|
|
|
file where the raw content starts. These parameters are used to initialize
|
|
|
|
the lexers in all other load functions. */
|
2019-12-15 18:40:05 +01:00
|
|
|
Header load_header(Buffer const &file, size_t &offset, int &line);
|
2019-12-14 22:33:57 +01:00
|
|
|
|
2019-12-28 17:18:13 +01:00
|
|
|
/* Load an assembly instruction table for the disassembler. This function
|
|
|
|
directly feeds the disassembler and does not return anything.
|
|
|
|
|
|
|
|
@file Data file, presumably analyzed with lex_header()
|
|
|
|
@offset Offset of assembly data in the file (as set by load_header)
|
|
|
|
@line Line where assembly data starts in the file (idem) */
|
2020-02-16 21:22:21 +01:00
|
|
|
int load_asm(Buffer const &file, size_t offset, size_t line);
|
2019-12-28 17:18:13 +01:00
|
|
|
|
|
|
|
/* Load a target description into the target database. This function returns
|
|
|
|
the complete target description */
|
|
|
|
TargetDescription load_target(Buffer const &file, size_t offset, size_t line);
|
2019-12-14 22:33:57 +01:00
|
|
|
|
2020-02-15 18:42:14 +01:00
|
|
|
/* Load a symbol table. This function returns the full table, which may contain
|
|
|
|
duplicates or unused syscall numbers and addresses. */
|
|
|
|
SymbolTable load_symbols(Buffer const &file, size_t offset, size_t line);
|
|
|
|
|
2019-12-14 22:33:57 +01:00
|
|
|
} /* namespace FxOS */
|
|
|
|
|
|
|
|
#endif /* LIBFXOS_LOAD_H */
|