Add a description of how immediate actions should be encoded.

Also sets the action list type to unsigned short (uint16_t) which
I think is the most appropriate type for s390x (x86 uses uint8_t
and other platforms use uint32_t).
This commit is contained in:
Michael Munday 2016-11-29 16:29:42 -05:00
parent 36479af87a
commit d97dea2e3f
2 changed files with 15 additions and 2 deletions

View File

@ -9,7 +9,7 @@
#include <string.h>
#include <stdlib.h>
#define DASM_ARCH "s390"
#define DASM_ARCH "s390x"
#ifndef DASM_EXTERN
#define DASM_EXTERN(a,b,c,d) 0
@ -49,7 +49,7 @@ enum {
#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos))
/* Action list type. */
typedef const unsigned int *dasm_ActList;
typedef const unsigned short *dasm_ActList;
/* Per-section structure. */
typedef struct dasm_Section {

View File

@ -970,6 +970,19 @@ local function parse_template(params, template, nparams, pos)
end
end
-- TODO
-- 12-bit displacements (DISP12) and 16-bit immediates (IMM16) can be put at
-- one of two locations relative to the end of the instruction.
-- To make decoding easier we should insert the actions for these immediately
-- after the halfword they modify.
-- For example, take the instruction ahik, which is laid out as follows (each
-- char is 4 bits):
-- o = op code, r = register, i = immediate
-- oorr iiii 00oo
-- This should be emitted as oorr, followed by the immediate action, followed by
-- 00oo.
wputpos(pos, op)
end
function op_template(params, template, nparams)