From: Heiko Carstens Date: Mon, 21 Jun 2021 20:19:28 +0000 (+0200) Subject: s390/dasd: use register pair instead of register asm X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=d4a01902eb59e478ab7c7d36d7bb90d94a315f89;p=uclinux-h8%2Flinux.git s390/dasd: use register pair instead of register asm Using register asm statements has been proven to be very error prone, especially when using code instrumentation where gcc may add function calls, which clobbers register contents in an unexpected way. Therefore get rid of register asm statement in dasd code, even though there is currently nothing wrong with it. This way we know for sure that the above mentioned bug class won't be introduced here. Reviewed-by: Stefan Haberland Signed-off-by: Heiko Carstens Signed-off-by: Vasily Gorbik --- diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index fd42a5fffaed..6bb775236c16 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c @@ -69,25 +69,24 @@ static const u8 DASD_DIAG_CMS1[] = { 0xc3, 0xd4, 0xe2, 0xf1 };/* EBCDIC CMS1 */ * resulting condition code and DIAG return code. */ static inline int __dia250(void *iob, int cmd) { - register unsigned long reg2 asm ("2") = (unsigned long) iob; + union register_pair rx = { .even = (unsigned long)iob, }; typedef union { struct dasd_diag_init_io init_io; struct dasd_diag_rw_io rw_io; } addr_type; - int rc; + int cc; - rc = 3; + cc = 3; asm volatile( - " diag 2,%2,0x250\n" - "0: ipm %0\n" - " srl %0,28\n" - " or %0,3\n" + " diag %[rx],%[cmd],0x250\n" + "0: ipm %[cc]\n" + " srl %[cc],28\n" "1:\n" EX_TABLE(0b,1b) - : "+d" (rc), "=m" (*(addr_type *) iob) - : "d" (cmd), "d" (reg2), "m" (*(addr_type *) iob) - : "3", "cc"); - return rc; + : [cc] "+&d" (cc), [rx] "+&d" (rx.pair), "+m" (*(addr_type *)iob) + : [cmd] "d" (cmd) + : "cc"); + return cc | rx.odd; } static inline int dia250(void *iob, int cmd)