3 static const union words
{
6 } base
= { .c
= "0123456789abcdefghijklmnopqrstuvwxyzABCD" },
7 init
= { .c
= "._,-'-._,-'-._,-'-._,-'-._,-'-._,-'-._,-" };
9 static void stmg_no_wrap(void)
11 union words buf
= init
;
12 register unsigned long a
asm("5") = base
.i
[0];
13 register unsigned long b
asm("6") = base
.i
[1];
14 register unsigned long c
asm("7") = base
.i
[2];
16 /* No-wrap around case; copies 24 bytes from BASE to BUF */
17 asm ("stmg %[a], %[c], %[buf]"
19 : [a
] "d"(a
), "d"(b
), [c
] "d"(c
)
23 fwrite(buf
.c
, sizeof(buf
), 1, stdout
);
26 static void stmg_wrap(void)
28 union words buf
= init
;
29 register unsigned long sp
asm("15");
30 register unsigned long a
asm("0") = base
.i
[2];
31 register unsigned long b
asm("1") = base
.i
[3];
32 register unsigned long c
asm("2") = base
.i
[4];
34 /* Wrap around case: avoid changing r15, but ensure it's stored */
35 asm ("stmg 15, %[c], %[buf]"
36 : [buf
] "=S"(buf
), "=d"(sp
)
37 : "d"(a
), "d"(b
), [c
] "d"(c
)
39 buf
.i
[0] ^= sp
^ base
.i
[1];
42 fwrite(buf
.c
, sizeof(buf
), 1, stdout
);