Skip to content

Commit 50348fa

Browse files
hcahcadavem330
authored andcommitted
net/iucv: get rid of register asm usage
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 statements in iucv 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. Acked-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ff8424b commit 50348fa

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

net/iucv/iucv.c

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -286,19 +286,19 @@ static union iucv_param *iucv_param_irq[NR_CPUS];
286286
*/
287287
static inline int __iucv_call_b2f0(int command, union iucv_param *parm)
288288
{
289-
register unsigned long reg0 asm ("0");
290-
register unsigned long reg1 asm ("1");
291-
int ccode;
289+
int cc;
292290

293-
reg0 = command;
294-
reg1 = (unsigned long)parm;
295291
asm volatile(
296-
" .long 0xb2f01000\n"
297-
" ipm %0\n"
298-
" srl %0,28\n"
299-
: "=d" (ccode), "=m" (*parm), "+d" (reg0), "+a" (reg1)
300-
: "m" (*parm) : "cc");
301-
return ccode;
292+
" lgr 0,%[reg0]\n"
293+
" lgr 1,%[reg1]\n"
294+
" .long 0xb2f01000\n"
295+
" ipm %[cc]\n"
296+
" srl %[cc],28\n"
297+
: [cc] "=&d" (cc), "+m" (*parm)
298+
: [reg0] "d" ((unsigned long)command),
299+
[reg1] "d" ((unsigned long)parm)
300+
: "cc", "0", "1");
301+
return cc;
302302
}
303303

304304
static inline int iucv_call_b2f0(int command, union iucv_param *parm)
@@ -319,19 +319,21 @@ static inline int iucv_call_b2f0(int command, union iucv_param *parm)
319319
*/
320320
static int __iucv_query_maxconn(void *param, unsigned long *max_pathid)
321321
{
322-
register unsigned long reg0 asm ("0");
323-
register unsigned long reg1 asm ("1");
324-
int ccode;
322+
unsigned long reg1 = (unsigned long)param;
323+
int cc;
325324

326-
reg0 = IUCV_QUERY;
327-
reg1 = (unsigned long) param;
328325
asm volatile (
326+
" lghi 0,%[cmd]\n"
327+
" lgr 1,%[reg1]\n"
329328
" .long 0xb2f01000\n"
330-
" ipm %0\n"
331-
" srl %0,28\n"
332-
: "=d" (ccode), "+d" (reg0), "+d" (reg1) : : "cc");
329+
" ipm %[cc]\n"
330+
" srl %[cc],28\n"
331+
" lgr %[reg1],1\n"
332+
: [cc] "=&d" (cc), [reg1] "+&d" (reg1)
333+
: [cmd] "K" (IUCV_QUERY)
334+
: "cc", "0", "1");
333335
*max_pathid = reg1;
334-
return ccode;
336+
return cc;
335337
}
336338

337339
static int iucv_query_maxconn(void)

0 commit comments

Comments
 (0)