S390 should change the meaning of -m31
Michael Matz
matz@suse.de
Thu Sep 30 16:05:18 GMT 2021
Hello,
On Wed, 29 Sep 2021, Jesus Antonio via Gcc wrote:
> m31 is semantically the same as the m32 option.
>
>
> The m31 option allows for 32 bit addressing and that is confusing since
> the m31 option in S390 would mean 2 GiB space addressing
Indeed that's exactly what it means, and what it's supposed to mean. On
s390, in AMODE(31) the toplevel bit of an (32bit) address is either
ignored or an indicator to switch back to 24bit addresses from the s360
times. Either way that leaves 31 bits to generate the virtual address.
On s390 you indeed have a 2GB address space, not more.
> Code used:
>
> volatile uint64_t *gib_test = (volatile uint64_t *)0x7FFFFFFF;
> memset(gib_test, 1, 4096);
>
>
> Hercules dump:
>
> r 0x7FFFFFFF-0x800001FF
> R:000000007FFFFFFF:K:06=01 .
I'm not sure what you believe to have demonstrated here. The (virtual or
physical) address 0x7FFFFFFF is either (in AMODE(24)) equivalent to
0x00ffffff or to 0xffffffff (in AMODE(31)), either way, the top byte of
the addressable range ...
> R:000000008000000F:K:06=01 01010101 01010101 01010101 010101 ................
... while address 0x80000001 is equivalent to address 0x1 (in AMODE(24)
and AMODE(31)). Again, the top bit (or bits in AMODE(24)) are ignored.
So, you've built a memset that wraps around the line (AMODE(24)) or the
bar (AMODE(32)). Perhaps unusual and not what you expected, but as
designed by IBM.
> The option i used was m31 of course, however this option is misleading
> since it allows 32 bit mode, and there is no m32 so you have to use m31
> - just lots of misleading options.
The -mXX options are supposed to reflect the address space's size, not the
size of the general purpose registers. An option that reflect AMODE(24)
would also be called -m24, despite the registers still being 32bit in
size.
Ciao,
Michael.
More information about the Gcc
mailing list