Commit Graph

21 Commits

Author SHA1 Message Date
Michael Munday
308fa09b6f Fix warning in dasm_s390x.h. 2016-12-09 14:35:21 -05:00
niravthakkar
aa096eda0e Minor fix 2016-12-09 19:46:12 +05:30
niravthakkar
cf4813f4ab Added SS-b support in C 2016-12-09 19:24:55 +05:30
Michael Munday
106718249e Add support for SS-a instructions.
I've also changed the template parser so that it can handle suffixes
which are longer than 1 character. The suffix for SS-a instructions
is "SS-a". We could change this again later.
2016-12-07 16:56:00 -05:00
Michael Munday
e3ab67aed4 Support forward local branches. 2016-12-06 11:57:48 -05:00
Michael Munday
73ad6dc77d Add support for jumps to local labels.
Currently limited to 16-bits ONLY.

Allows code like:

|1:
| ...
| j <1
2016-12-05 17:27:24 -05:00
Michael Munday
9745e9df26 Get DASM_SECTION argument from the correct place. 2016-12-05 12:35:13 -05:00
Michael Munday
1dd736f09a Auto-format dasm_s390x.h (again).
This time explicitly ban tabs.

indent -i2 -brs -cli0 -br -ce -npcs -nbc -di1 -npsl -ncs -nut dasm_s390x.h
2016-12-02 15:14:37 -05:00
Michael Munday
3ec573e750 Add support for .align directive. 2016-12-02 15:13:04 -05:00
Michael Munday
7181c391bd Add C code to handle IMM16. 2016-12-02 14:20:59 -05:00
Michael Munday
2324be897e Reduce indentation level of big switch statement.
A style thing. I find it easier to read this way.

i.e. do:

while(1) {
  if (blah) {
    ...
    continue;
  }
  ... // big switch statement
}

instead of:

while(1) {
  if (blah) {
    ...
  } else {
    ... // big switch statement
  }
}
2016-12-02 13:50:09 -05:00
Michael Munday
fc2b633532 Auto-format dasm_s390x.h.
I did this mostly to get rid of the annoying tabs/spaces mix in this
file. It has the side effect of forcing newlines before statements
which I think is a better style (and not particularly inconsistent
with the original which used both styles). Other than that I've tried
to match the original style as closely as possible.

Generated with this command:

indent -i2 -brs -cli0 -br -ce -npcs -nbc -di1 -npsl -ncs dasm_s390x.h
2016-12-02 13:41:45 -05:00
Michael Munday
621ae87058 Cleanup and fix compilation. 2016-12-02 13:06:03 -05:00
niravthakkar
3d5c692e13 Minor change: Cleanup 2016-12-02 17:39:00 +05:30
niravthakkar
f0dd40dc50 Adding support for Immediate add mode
The masking in immediate mode might not be proper. I could understand that you had masked 12bits and then 8bits to get the displacement in place for 20-bit displacement ( cp[-2] |= n&0xfff;          cp[-1] |= (n>>4)&0xff00;)  But in my case I need all the 32bits, so not sure how to go about it. Currently I have just used "n" since no point in "and with 0xffff" But I am getting core dump. Please Let me know your comments on these.
2016-12-02 17:37:20 +05:30
Michael Munday
6ae327df75 Add support for RXY instructions (20-bit displacements). 2016-12-01 19:26:30 -05:00
Michael Munday
77f283c328 Allow symbols to be used for 12-bit displacements.
The parse_mem_bx function now returns a function to call to add an
action to the action list to handle the evaluation of the
displacement. This allows us to delay adding said action until
after we have emitted the actions for the instruction encodings
themselves.

Code like this should now work:

int x = 24
| st r1, x(sp)
2016-12-01 17:09:45 -05:00
Michael Munday
cf225d27cc Fix C code in header file and handle br template.
This means that code like this can now be generated on s390x:

| ar r2, r3
| br r14

Still need to add support for immediates, memory, labels, other
instructions and so on.
2016-11-30 14:11:01 -05:00
Michael Munday
d97dea2e3f 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).
2016-11-29 16:29:42 -05:00
Michael Munday
36479af87a Add stubs for parsing memory operands and delete unwanted code.
Each memory operand will be a single parameter so we also need
to update the instruction encoding nargs field.
2016-11-29 15:24:11 -05:00
niravthakkar
9583ba36de Created s390x header file
Currently copy of ppc.h, which is same as arm64.h, and added the architecture definition
2016-11-10 19:00:51 +05:30