WikiLeaks - Vault 7: Projects

# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Athena

# nasm-2-doc_internal

- 1
- 2
- 3
- 4
- 5

Internals of the Netwide Assembler
==================================
The Netwide Assembler is intended to be a modular, re-usable x86
assembler, which can be embedded in other programs, for example as
the back end to a compiler.
The assembler is composed of modules. The interfaces between them
look like:
+--- preproc.c ----+
| |
+---- parser.c ----+
| | |
| float.c |
| |
+--- assemble.c ---+
| | |
nasm.c ---+ insnsa.c +--- nasmlib.c
| |
+--- listing.c ----+
| |
+---- labels.c ----+
| |
+--- outform.c ----+
| |
+----- *out.c -----+
In other words, each of `preproc.c', `parser.c', `assemble.c',
`labels.c', `listing.c', `outform.c' and each of the output format
modules `*out.c' are independent modules, which do not directly
inter-communicate except through the main program.
The Netwide *Disassembler* is not intended to be particularly
portable or reusable or anything, however. So I won't bother
documenting it here. :-)
nasmlib.c
---------
This is a library module; it contains simple library routines which
may be referenced by all other modules. Among these are a set of
wrappers around the standard `malloc' routines, which will report a
fatal error if they run out of memory, rather than returning NULL.
preproc.c
---------
This contains a macro preprocessor, which takes a file name as input
and returns a sequence of preprocessed source lines. The only symbol
exported from the module is `nasmpp', which is a data structure of
type `Preproc', declared in nasm.h. This structure contains pointers
to all the functions designed to be callable from outside the
module.
parser.c
--------

- 1
- 2
- 3
- 4
- 5