-
TODO: mmix-ld
-
TODO: Compilation pipeline
-
TODO: bin/
-
TODO: binfmt
The heap will be organized as memory blocks inside the pool segment of the
executable. This needs some cooperation from the user: The convention (as
defined by the mmixware documentation) is that M_8[:Pool_Segment] points
to the first unallocated region within the pool address space. User
programs utilizing address space from the pool segment must obey this rule
by 'allocating' memory by modifying M_8[:Pool_Segment] appropriately. The
library assumes that this pointer is OCTA aligned.
-
Neither mmixal, nor GNU guarantee that the contents of the temporary register
$255is preserved after aJMP,PUSHJinstruction, orLDApseudo instruction. The assembler is free to use$255to construct an absolute address if the target label cannot be reached by a near jump. Thus, when calling a library subroutine the contents of$255might not be preserved. -
Similarly, the library might use
:MM:tinternally. Thus, when calling a library subroutine - even a nonG-variant - the contents of:MM:tmight not be preserved. (Subroutines generally try to preserve the contents of:MM:t, though).
The library avoids unnecessary allocation of global registers by not using
LDA instructions at the expense of a slight runtime overhead. The library
allocates 3 global registers (GREGs) for internal use and an additional
global register :MM:t for calling library routines (see next section).
Suroutines come in a number of different variants.
- Subroutines without a trailing
J, will terminate the program with an error message (or call an error handler if specified). Variants with a trailingJ, will jump to:rJ+#4on succes and to:rJ+#0on failure (some variants that would return a boolean value jump to:rJ+#4fortrueand to:rJ+#0forfalseinstead.) This can be used to implement customized error handling. An example:
% Try to allocate a block of memory:
SET $1,[...]
PUSHJ $0,:MM:Pool:AllocJ
JMP 1F
... % Allocation was successful, continue normally.
1H ... % Allocation failed, error handling.
- Subroutines that have at most one argument and at most one return
parameter come also in a variant with a trailing
Gwhich indicates that values are passed through the library specific temporary global register:MM:t. An example:
% Try to allocate a block of memory:
t IS :MM:t
SET t,[...]
PUSHJ t,:MM:Pool:AllocG
% Address of allocated memory in t
Copyright (C) 2013-2018 Matthias Maier <[email protected]>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.