Commit Graph

2266 Commits

Author SHA1 Message Date
Michael Munday
3ef1f21531 Add support for SIL instructions in DynASM. 2016-12-13 11:26:53 -05:00
Michael Munday
0b120ac64b Add partial implementation of vm_cpcall.
Currently works if the call returns 0. Haven't yet written the code
needed to handle the non-zero case.
2016-12-12 17:17:34 -05:00
Michael Munday
361a298371 Add lhi instruction and fix immediate parsing.
We were reading immediate values as hexadecimal values, really we
want the default to be decimal unless the immediate has a '0x' prefix.
2016-12-12 14:38:55 -05:00
niravthakkar
1c7a727f4a Correct the range of parameter, and merge the two case 2016-12-12 11:21:42 +05:30
Michael Munday
625aad5da0 Make LuaJIT compile on s390x.
I've disabled both the JIT and FFI for now. I've also stripped almost
all of the assembly out of vm_s390x.dasc, leaving only labels for the
most part. This is enough to get LuaJIT to compile but of course if
you try and run it it will explode.

The idea now is to re-add enough functionality to get a very basic
Lua program to run.
2016-12-09 16:28:39 -05:00
Michael Munday
111b62229a Define DASM_CHECKS when running tests. 2016-12-09 14:38:37 -05:00
Michael Munday
308fa09b6f Fix warning in dasm_s390x.h. 2016-12-09 14:35:21 -05:00
Michael Munday
052eb69750 Make host/buildvm_asm.c compile.
I've added a rough implementation of this code. It is untested but
does compile.
2016-12-09 14:32:02 -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
niravthakkar
9b9e1ea667 Added SS-b mode
Currently I am not able to test the functionality of this mode, need some help in that.
Also for the time being I have created different function for parsing, we can merge that later, just to make sure SS-a doesnt break, I have not merged this since I was not able to test it.
Let me know your comments on this
2016-12-09 19:18:02 +05:30
Michael Munday
1a06b651e2 Fix a couple of templates that were too short. 2016-12-08 16:00:59 -05:00
Michael Munday
d472a3cc1c Add support for .type directives. 2016-12-08 15:29:26 -05:00
Michael Munday
b98c92e142 Delete unused branch_type function. 2016-12-08 13:59:05 -05:00
ketank-new
1f034811a3 Updated comment for test jmp_fwd() 2016-12-08 10:22:28 +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
8281c33747 Comment out failing tests for now. 2016-12-07 14:06:37 -05:00
niravthakkar
127f0fd745 Adding RRD support
Currently only "maer" is  implemented. I am not able to get this working, don't know if I am missing out something, or we need to add some more functionality for RRD.
2016-12-07 20:21:06 +05:30
ketank-new
79cc499172 Update test_z_inst.c
Added comments to fwd_jmp
added test for RRD based test case add_rrd()---> functionality to be tested
added test for RR based test case load_test()--> test fails
2016-12-07 14:11:20 +05:30
ketank-new
22f4e6a170 Update test_z_inst.c
Added another test for forward jump
2016-12-07 13:13:55 +05:30
Michael Munday
a03638880c Re-order test function. 2016-12-06 15:45:06 -05:00
Michael Munday
155577093a Add test for PC-style labels.
These are labels which are given a numeric value. For example, the
following code would generate PC labels 0 to 4:

for (int i = 0; i < 5; i++) {
  |=>i:
}
2016-12-06 15:41:11 -05:00
Michael Munday
cdfb632a4f Add ADD HALFWORD IMMEDIATE (64-bit) instruction (aghi). 2016-12-06 15:39:04 -05:00
Michael Munday
c688a0a3ab Add support for brasl instruction.
Important for calling subroutines.
2016-12-06 14:38:11 -05:00
Michael Munday
3ae1c4fd6b Support floating point register arguments.
It would be nice to verify that floating-point/general-purpose
registers are indeed expected by the instruction, but for now treat
them both the same so we can use floating-point instructions.
2016-12-06 13:15:29 -05:00
Michael Munday
53b627b21c s/SP/sp/ in vm_s390x.dasc.
We support the pseudo-register sp now.
2016-12-06 12:47:23 -05:00
Michael Munday
e3ab67aed4 Support forward local branches. 2016-12-06 11:57:48 -05:00
Michael Munday
b24d490a42 Fix test table (needed comma at end of line to compile).
Also, re-align table columns.
2016-12-06 09:16:30 -05:00
niravthakkar
1362e9aee2 Minor Cleanup 2016-12-06 19:34:47 +05:30
niravthakkar
ba4343d9d1 Added support for Immediate mode 16 bit
Currently only afi instruction is encoded, will be adding other instructions too. For encoding we are running out of characters so was planning to append the complete modes (RXa or rxa) which one do you think is better, and also thinking of just adding remaining instruction modes as well, which we don't support as of now. Let me know if you want me to add those, or we will wait for sometime before we add those.
2016-12-06 19:17:54 +05:30
ketank-new
7c79bbc768 Update test_z_inst.c
Added test case for add immediate 16 bits RI-a 
Added test case for add immediate 32 bits RIL-a
2016-12-06 14:11:30 +05:30
niravthakkar
2156278508 Updated the addressing mode working
The case where immediate was passed as label was not covered initially, so updated it
2016-12-06 12:23:51 +05:30
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
410bdb8182 Minor cleanup of dasm_s390x.lua. 2016-12-05 15:00:40 -05:00
Michael Munday
be3efbc65a Add simple tests for RX and RXY style instructions.
Also changed the test function signature to int64_t fn(int64_t, int64_t)
to make it easier to test 64-bit operations.
2016-12-05 14:51:48 -05:00
Michael Munday
d9e61fe7a8 Shorten templates by four characters.
We only have 6-byte instructions, so we don't really need the ability
to encode 8-bytes.
2016-12-05 14:23:35 -05:00
Michael Munday
54199bd9bc Clean up test file and add script to run tests.
./run.sh will now execute the tests. It is a very simple setup
currently, and is limited to linux on s390x. Enough to get started
with.
2016-12-05 14:02:58 -05:00
Michael Munday
d7f7509894 Minor indentation fixes. 2016-12-05 12:35:13 -05:00
Michael Munday
9745e9df26 Get DASM_SECTION argument from the correct place. 2016-12-05 12:35:13 -05:00
ketank-new
17d91e2f0c Update test_z_inst.c
changed code to in the form of a test table
currently handles RR based , addition, subtraction and multiply test
2016-12-05 13:46:44 +05:30
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
niravthakkar
b97a7f7b44 Minor cleanup and modified 32 bit signed check
Modified 32 bit signed check  for the immediate value
2016-12-02 17:19:29 +05:30
ketank-new
f0cc29436c Update test_z_inst.c
added functionality to test different modes of same instruction type
2016-12-02 15:46:45 +05:30