s390guy / SATK

Toolkit for creating baremetal programs targeting mainframe compatible systems
GNU General Public License v3.0
42 stars 6 forks source link

PoO -02 changed fifteen existing instructions into long displacement instructions #31

Closed srorso closed 2 years ago

srorso commented 2 years ago

The following fifteen instructions that pre-date the introduction of the long-displacement facility were changed to long-displacement instructions when the long-displacement facility was introduced (June 2003):

Search "RSA2" (15 hits in 1 file of 1 searched)
  C:\common\Hercules\SATK\asma\msl\s390x-insn.msl (15 hits)
    Line  589: inst LCTLG  EB2F RSA2    P      # LOAD CONTROL (64)
    Line  607: inst LMG    EB04 RSA2           # LOAD MULTIPLE (64)
    Line  608: inst LMH    EB96 RSA2           # LOAD MULTIPLE HIGH
    Line  645: inst RLL    EB1D RSA2           # ROTATE LEFT SINGLE LOGICAL (32)
    Line  646: inst RLLG   EB1C RSA2           # ROTATE LEFT SINGLE LOGICAL (64)
    Line  654: inst SLAG   EB0B RSA2           # SHIFT LEFT SINGLE (64)
    Line  663: inst SLLG   EB0D RSA2           # SHIFT LEFT SINGLE LOGICAL (64)
    Line  664: inst SRAG   EB0A RSA2           # SHIFT RIGHT SINGLE (64)
    Line  665: inst SRLG   EB0C RSA2           # SHIFT RIGHT SINGLE LOGICAL (64)
    Line  667: inst STCTG  EB25 RSA2           # STORE CONTROL (64)
    Line  670: inst STMG   EB24 RSA2           # STORE MULTIPLE (64)
    Line  671: inst STMH   EB26 RSA2           # STORE MULTIPLE HIGH
    Line  683: inst TRACG  EB0F RSA2    P      # TRACE (64)
    Line 1207: inst CLCLU  EB8F RSA2           # COMPARE LOGICAL LONG UNICODE
    Line 1208: inst MVCLU  EB8E RSA2           # MOVE LONG UNICODE

If one tries to use them as long displacement instructions, i.e., with a displacement that requires more than 12 bits, one of the following error message is generated:

D2 field value outside of range for 12-bit field ( 0 - 4095 ): 12450
operand 3 could not resolve implied base register for location: ABS:0x7F0C0

I believe that -02 eliminated the need for the RSA2 instruction format in ASMA.

Note that in the sample, LMG, LMH, STMG, and STMH do not trigger the error because I patched s390x-insn.msl to treat those four instructions as RSYA.

ztest-997.zip

Fish-Git commented 2 years ago

I'm curious, Steve, why you're using addr = 64 instead of addr = 31?

So you can more easily see what I'm referring to, here is your listing converted to PDF:

And here's the same thing with ASMA configured *()** with addr = 31 instead:


*()**  There should be a asma.cfg file in your SATK's "site" directory where you can enter your desired overriding ASMA default options. Here's what mine looks like:

As you can see, the only ASMA option I chose to override was the addr option, documented on page 15 of the ASMA manual:

-a/--addr SIZE

The -a or –-addr option overrides in the listing, the address size specified within the MSL for the target CPU. Only four values are accepted: 16, 24, 31, or 64. The option applies to the statement area of the listing and the optional image file dump.

ASMA Specific Behavior: This option influences the size of address fields used by the assembler listing. If you prefer to standardize on a single address field size, use the command line argument to override values resulting from the target CPU's definition.

In my experience, one never has any real need to use 64-bit wide addresses in assembly listing!  

srorso commented 2 years ago

Hi Fish, to be honest, I hadn't really noticed the listing was a bit wide, or didn't worry about it. I'll play with that.

And you're right, I don't need 64-bit addresses in the listing. Thanks for the info...most helpful.

s390guy commented 2 years ago

I have committed MSL changes for the change in instruction formats documented in PoO -03. Also made some corrections of errors found while researching the long-displacement facility in general.

Steve, after validation of the changes, please post here or close the issue. Thanks for the effort in reporting this.

srorso commented 2 years ago

Hi Harold,

I have validated my programming; the changes work well. I also re-ran the test case ztest-997 just in case there was something unique to my environment. That worked well as well.

Many thanks for the quick and thorough resolution!

-Steve