Skip to content

Commit d808882

Browse files
committed
s390/boot/physmem: Convert to use flag output macros
Use flag output macros in inline asm to allow for better code generation if the compiler has support for the flag output constraint. Reviewed-by: Juergen Christ <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 0eb597b commit d808882

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

arch/s390/boot/physmem_info.c

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <asm/sections.h>
1010
#include <asm/setup.h>
1111
#include <asm/sclp.h>
12+
#include <asm/asm.h>
1213
#include <asm/uv.h>
1314
#include "decompressor.h"
1415
#include "boot.h"
@@ -59,13 +60,13 @@ static int __diag260(unsigned long rx1, unsigned long rx2)
5960
{
6061
unsigned long reg1, reg2, ry;
6162
union register_pair rx;
63+
int cc, exception;
6264
psw_t old;
63-
int rc;
6465

6566
rx.even = rx1;
6667
rx.odd = rx2;
6768
ry = 0x10; /* storage configuration */
68-
rc = -1; /* fail */
69+
exception = 1;
6970
asm volatile(
7071
" mvc 0(16,%[psw_old]),0(%[psw_pgm])\n"
7172
" epsw %[reg1],%[reg2]\n"
@@ -74,20 +75,22 @@ static int __diag260(unsigned long rx1, unsigned long rx2)
7475
" larl %[reg1],1f\n"
7576
" stg %[reg1],8(%[psw_pgm])\n"
7677
" diag %[rx],%[ry],0x260\n"
77-
" ipm %[rc]\n"
78-
" srl %[rc],28\n"
78+
" lhi %[exc],0\n"
7979
"1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n"
80-
: [reg1] "=&d" (reg1),
80+
CC_IPM(cc)
81+
: CC_OUT(cc, cc),
82+
[exc] "+d" (exception),
83+
[reg1] "=&d" (reg1),
8184
[reg2] "=&a" (reg2),
82-
[rc] "+&d" (rc),
8385
[ry] "+&d" (ry),
8486
"+Q" (get_lowcore()->program_new_psw),
8587
"=Q" (old)
8688
: [rx] "d" (rx.pair),
8789
[psw_old] "a" (&old),
8890
[psw_pgm] "a" (&get_lowcore()->program_new_psw)
89-
: "cc", "memory");
90-
return rc == 0 ? ry : -1;
91+
: CC_CLOBBER_LIST("memory"));
92+
cc = exception ? -1 : CC_TRANSFORM(cc);
93+
return cc == 0 ? ry : -1;
9194
}
9295

9396
static int diag260(void)
@@ -148,9 +151,10 @@ static int diag500_storage_limit(unsigned long *max_physmem_end)
148151
static int tprot(unsigned long addr)
149152
{
150153
unsigned long reg1, reg2;
151-
int rc = -EFAULT;
154+
int cc, exception;
152155
psw_t old;
153156

157+
exception = 1;
154158
asm volatile(
155159
" mvc 0(16,%[psw_old]),0(%[psw_pgm])\n"
156160
" epsw %[reg1],%[reg2]\n"
@@ -159,19 +163,21 @@ static int tprot(unsigned long addr)
159163
" larl %[reg1],1f\n"
160164
" stg %[reg1],8(%[psw_pgm])\n"
161165
" tprot 0(%[addr]),0\n"
162-
" ipm %[rc]\n"
163-
" srl %[rc],28\n"
166+
" lhi %[exc],0\n"
164167
"1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n"
165-
: [reg1] "=&d" (reg1),
168+
CC_IPM(cc)
169+
: CC_OUT(cc, cc),
170+
[exc] "+d" (exception),
171+
[reg1] "=&d" (reg1),
166172
[reg2] "=&a" (reg2),
167-
[rc] "+&d" (rc),
168173
"=Q" (get_lowcore()->program_new_psw.addr),
169174
"=Q" (old)
170175
: [psw_old] "a" (&old),
171176
[psw_pgm] "a" (&get_lowcore()->program_new_psw),
172177
[addr] "a" (addr)
173-
: "cc", "memory");
174-
return rc;
178+
: CC_CLOBBER_LIST("memory"));
179+
cc = exception ? -EFAULT : CC_TRANSFORM(cc);
180+
return cc;
175181
}
176182

177183
static unsigned long search_mem_end(void)

0 commit comments

Comments
 (0)