]> git.ipfire.org Git - thirdparty/zlib-ng.git/commit
IBM Z DFLTCC: fix STFLE usage
authorIlya Leoshkevich <iii@linux.ibm.com>
Mon, 3 Jun 2019 14:47:14 +0000 (16:47 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Tue, 4 Jun 2019 08:59:40 +0000 (10:59 +0200)
commit563263bb1c508cf74314f8d623477898ea7a996a
treeaddfac17d7de8a3ac1bb87b704d4afd3f0932fda
parente257d870dd95ae8a9b9b8eb4b1bd37f6a506a997
IBM Z DFLTCC: fix STFLE usage

QEMU maintainers have found and issue related to incorrect usage of
STFLE instruction [1], which is used to get features supported by the
machine. There are three potential problems with the current usage:

- R0 must contain the number of requested doublewords *minus one*. The
existing code lacks the "minus one" part.
- Older machines may not fill all the doublewords - this is fixed by
calling `memset`.
- STFLE updates R0, but we don't tell the compiler about this - this is
fixed by using a `+` constraint.
- Not really a problem, but it's enough to load 8 bits into R0, so its
type was changed to `uint8_t`. Also, STFLE only writes to `facilities`
variable, therefore memory clobber is unnecessary.

[1] https://lists.gnu.org/archive/html/qemu-devel/2019-06/msg00113.html
arch/s390/dfltcc_common.c