11 #include <linux/kernel.h>
13 #include <linux/ptrace.h>
14 #include <linux/prefetch.h>
16 #include <asm/processor.h>
17 #include <asm/uaccess.h>
18 #include <asm/cputable.h>
24 #define MSR_MASK 0xffffffff87c0ffffUL
26 #define MSR_MASK 0x87c0ffff
30 #define XER_SO 0x80000000U
31 #define XER_OV 0x40000000U
32 #define XER_CA 0x20000000U
38 extern int do_lfs(
int rn,
unsigned long ea);
39 extern int do_lfd(
int rn,
unsigned long ea);
40 extern int do_stfs(
int rn,
unsigned long ea);
41 extern int do_stfd(
int rn,
unsigned long ea);
42 extern int do_lvx(
int rn,
unsigned long ea);
43 extern int do_stvx(
int rn,
unsigned long ea);
44 extern int do_lxvd2x(
int rn,
unsigned long ea);
45 extern int do_stxvd2x(
int rn,
unsigned long ea);
51 static unsigned long truncate_if_32bit(
unsigned long msr,
unsigned long val)
54 if ((msr & MSR_64BIT) == 0)
65 unsigned int bo = (instr >> 21) & 0x1f;
71 if (((bo >> 1) & 1) ^ (regs->
ctr == 0))
74 if ((bo & 0x10) == 0) {
76 bi = (instr >> 16) & 0x1f;
77 if (((regs->
ccr >> (31 - bi)) & 1) != ((bo >> 3) & 1))
94 static unsigned long __kprobes dform_ea(
unsigned int instr,
struct pt_regs *regs)
99 ra = (instr >> 16) & 0x1f;
100 ea = (
signed short) instr;
103 if (instr & 0x04000000)
107 return truncate_if_32bit(regs->
msr, ea);
114 static unsigned long __kprobes dsform_ea(
unsigned int instr,
struct pt_regs *regs)
119 ra = (instr >> 16) & 0x1f;
120 ea = (
signed short) (instr & ~3);
123 if ((instr & 3) == 1)
127 return truncate_if_32bit(regs->
msr, ea);
134 static unsigned long __kprobes xform_ea(
unsigned int instr,
struct pt_regs *regs,
140 ra = (instr >> 16) & 0x1f;
141 rb = (instr >> 11) & 0x1f;
149 return truncate_if_32bit(regs->
msr, ea);
156 static inline unsigned long max_align(
unsigned long x)
158 x |=
sizeof(
unsigned long);
163 static inline unsigned long byterev_2(
unsigned long x)
165 return ((x >> 8) & 0xff) | ((x & 0xff) << 8);
168 static inline unsigned long byterev_4(
unsigned long x)
170 return ((x >> 24) & 0xff) | ((x >> 8) & 0xff00) |
171 ((x & 0xff00) << 8) | ((x & 0xff) << 24);
175 static inline unsigned long byterev_8(
unsigned long x)
177 return (byterev_4(x) << 32) | byterev_4(x >> 32);
181 static int __kprobes read_mem_aligned(
unsigned long *
dest,
unsigned long ea,
189 err =
__get_user(x, (
unsigned char __user *) ea);
192 err =
__get_user(x, (
unsigned short __user *) ea);
195 err =
__get_user(x, (
unsigned int __user *) ea);
199 err =
__get_user(x, (
unsigned long __user *) ea);
208 static int __kprobes read_mem_unaligned(
unsigned long *dest,
unsigned long ea,
212 unsigned long x,
b,
c;
216 for (; nb > 0; nb -=
c) {
220 err = read_mem_aligned(&b, ea, c);
223 x = (x << (8 *
c)) +
b;
234 static int __kprobes read_mem(
unsigned long *dest,
unsigned long ea,
int nb,
237 if (!address_ok(regs, ea, nb))
239 if ((ea & (nb - 1)) == 0)
240 return read_mem_aligned(dest, ea, nb);
241 return read_mem_unaligned(dest, ea, nb, regs);
244 static int __kprobes write_mem_aligned(
unsigned long val,
unsigned long ea,
251 err =
__put_user(val, (
unsigned char __user *) ea);
254 err =
__put_user(val, (
unsigned short __user *) ea);
257 err =
__put_user(val, (
unsigned int __user *) ea);
261 err =
__put_user(val, (
unsigned long __user *) ea);
268 static int __kprobes write_mem_unaligned(
unsigned long val,
unsigned long ea,
275 for (; nb > 0; nb -=
c) {
279 err = write_mem_aligned(val >> (nb - c) * 8, ea, c);
291 static int __kprobes write_mem(
unsigned long val,
unsigned long ea,
int nb,
294 if (!address_ok(regs, ea, nb))
296 if ((ea & (nb - 1)) == 0)
297 return write_mem_aligned(val, ea, nb);
298 return write_mem_unaligned(val, ea, nb, regs);
301 #ifdef CONFIG_PPC_FPU
306 static int __kprobes do_fp_load(
int rn,
int (*
func)(
int,
unsigned long),
307 unsigned long ea,
int nb,
311 unsigned long val[
sizeof(double) /
sizeof(
long)];
314 if (!address_ok(regs, ea, nb))
318 ptr = (
unsigned long) &val[0];
319 if (
sizeof(
unsigned long) == 8 || nb == 4) {
320 err = read_mem_unaligned(&val[0], ea, nb, regs);
321 ptr +=
sizeof(
unsigned long) - nb;
324 err = read_mem_unaligned(&val[0], ea, 4, regs);
326 err = read_mem_unaligned(&val[1], ea + 4, 4, regs);
333 static int __kprobes do_fp_store(
int rn,
int (*
func)(
int,
unsigned long),
334 unsigned long ea,
int nb,
338 unsigned long val[
sizeof(double) /
sizeof(
long)];
341 if (!address_ok(regs, ea, nb))
345 ptr = (
unsigned long) &val[0];
346 if (
sizeof(
unsigned long) == 8 || nb == 4) {
347 ptr +=
sizeof(
unsigned long) - nb;
348 err = (*func)(rn,
ptr);
351 err = write_mem_unaligned(val[0], ea, nb, regs);
354 err = (*func)(rn,
ptr);
357 err = write_mem_unaligned(val[0], ea, 4, regs);
359 err = write_mem_unaligned(val[1], ea + 4, 4, regs);
365 #ifdef CONFIG_ALTIVEC
367 static int __kprobes do_vec_load(
int rn,
int (*
func)(
int,
unsigned long),
368 unsigned long ea,
struct pt_regs *regs)
370 if (!address_ok(regs, ea & ~0xfUL, 16))
375 static int __kprobes do_vec_store(
int rn,
int (*
func)(
int,
unsigned long),
376 unsigned long ea,
struct pt_regs *regs)
378 if (!address_ok(regs, ea & ~0xfUL, 16))
385 static int __kprobes do_vsx_load(
int rn,
int (*
func)(
int,
unsigned long),
386 unsigned long ea,
struct pt_regs *regs)
389 unsigned long val[2];
391 if (!address_ok(regs, ea, 16))
395 err = read_mem_unaligned(&val[0], ea, 8, regs);
397 err = read_mem_unaligned(&val[1], ea + 8, 8, regs);
399 err = (*func)(rn, (
unsigned long) &val[0]);
403 static int __kprobes do_vsx_store(
int rn,
int (*
func)(
int,
unsigned long),
404 unsigned long ea,
struct pt_regs *regs)
407 unsigned long val[2];
409 if (!address_ok(regs, ea, 16))
413 err = (*func)(rn, (
unsigned long) &val[0]);
416 err = write_mem_unaligned(val[0], ea, 8, regs);
418 err = write_mem_unaligned(val[1], ea + 8, 8, regs);
423 #define __put_user_asmx(x, addr, err, op, cr) \
424 __asm__ __volatile__( \
425 "1: " op " %2,0,%3\n" \
428 ".section .fixup,\"ax\"\n" \
432 ".section __ex_table,\"a\"\n" \
433 PPC_LONG_ALIGN "\n" \
436 : "=r" (err), "=r" (cr) \
437 : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err))
439 #define __get_user_asmx(x, addr, err, op) \
440 __asm__ __volatile__( \
441 "1: "op" %1,0,%2\n" \
443 ".section .fixup,\"ax\"\n" \
447 ".section __ex_table,\"a\"\n" \
448 PPC_LONG_ALIGN "\n" \
451 : "=r" (err), "=r" (x) \
452 : "r" (addr), "i" (-EFAULT), "0" (err))
454 #define __cacheop_user_asmx(addr, err, op) \
455 __asm__ __volatile__( \
458 ".section .fixup,\"ax\"\n" \
462 ".section __ex_table,\"a\"\n" \
463 PPC_LONG_ALIGN "\n" \
467 : "r" (addr), "i" (-EFAULT), "0" (err))
471 long val = regs->
gpr[
rd];
473 regs->
ccr = (regs->
ccr & 0x0fffffff) | ((regs->
xer >> 3) & 0x10000000);
475 if (!(regs->
msr & MSR_64BIT))
479 regs->
ccr |= 0x80000000;
481 regs->
ccr |= 0x40000000;
483 regs->
ccr |= 0x20000000;
487 unsigned long val1,
unsigned long val2,
488 unsigned long carry_in)
490 unsigned long val = val1 + val2;
496 if (!(regs->
msr & MSR_64BIT)) {
497 val = (
unsigned int) val;
498 val1 = (
unsigned int) val1;
501 if (val < val1 || (carry_in && val == val1))
510 unsigned int crval, shift;
512 crval = (regs->
xer >> 31) & 1;
519 shift = (7 - crfld) * 4;
520 regs->
ccr = (regs->
ccr & ~(0xf << shift)) | (crval << shift);
523 static void __kprobes do_cmp_unsigned(
struct pt_regs *regs,
unsigned long v1,
524 unsigned long v2,
int crfld)
526 unsigned int crval, shift;
528 crval = (regs->
xer >> 31) & 1;
535 shift = (7 - crfld) * 4;
536 regs->
ccr = (regs->
ccr & ~(0xf << shift)) | (crval << shift);
542 #define MASK32(mb, me) ((0xffffffffUL >> (mb)) + \
543 ((signed long)-0x80000000L >> (me)) + ((me) >= (mb)))
545 #define MASK64_L(mb) (~0UL >> (mb))
546 #define MASK64_R(me) ((signed long)-0x8000000000000000L >> (me))
547 #define MASK64(mb, me) (MASK64_L(mb) + MASK64_R(me) + ((me) >= (mb)))
548 #define DATA32(x) (((x) & 0xffffffffUL) | (((x) & 0xffffffffUL) << 32))
550 #define DATA32(x) (x)
552 #define ROTATE(x, n) ((n) ? (((x) << (n)) | ((x) >> (8 * sizeof(long) - (n)))) : (x))
564 unsigned long int imm;
565 unsigned long int val, val2;
566 unsigned long int ea;
567 unsigned int cr,
mb, me, sh;
569 unsigned long old_ra, val3;
572 opcode = instr >> 26;
575 imm = (
signed short)(instr & 0xfffc);
576 if ((instr & 2) == 0)
579 regs->
nip = truncate_if_32bit(regs->
msr, regs->
nip);
582 if (branch_taken(instr, regs))
592 if (regs->
gpr[0] == 0x1ebe &&
597 regs->
gpr[9] = regs->
gpr[13];
598 regs->
gpr[10] = MSR_KERNEL;
599 regs->
gpr[11] = regs->
nip + 4;
601 regs->
gpr[13] = (
unsigned long) get_paca();
603 regs->
msr = MSR_KERNEL;
607 imm = instr & 0x03fffffc;
608 if (imm & 0x02000000)
610 if ((instr & 2) == 0)
613 regs->
link = truncate_if_32bit(regs->
msr, regs->
nip + 4);
614 imm = truncate_if_32bit(regs->
msr, imm);
618 switch ((instr >> 1) & 0x3ff) {
621 imm = (instr & 0x400)? regs->
ctr: regs->
link;
622 regs->
nip = truncate_if_32bit(regs->
msr, regs->
nip + 4);
623 imm = truncate_if_32bit(regs->
msr, imm);
626 if (branch_taken(instr, regs))
645 ra = (instr >> 16) & 0x1f;
646 rb = (instr >> 11) & 0x1f;
647 rd = (instr >> 21) & 0x1f;
648 ra = (regs->
ccr >> (31 -
ra)) & 1;
649 rb = (regs->
ccr >> (31 -
rb)) & 1;
650 val = (instr >> (6 + ra * 2 +
rb)) & 1;
651 regs->
ccr = (regs->
ccr & ~(1
UL << (31 -
rd))) |
657 switch ((instr >> 1) & 0x3ff) {
660 switch ((instr >> 21) & 3) {
662 asm volatile(
"lwsync" : : :
"memory");
665 asm volatile(
"ptesync" : : :
"memory");
683 rd = (instr >> 21) & 0x1f;
684 ra = (instr >> 16) & 0x1f;
685 rb = (instr >> 11) & 0x1f;
694 add_with_carry(regs, rd, ~regs->
gpr[ra], imm, 1);
698 imm = (
unsigned short) instr;
702 val = (
unsigned int)
val;
704 do_cmp_unsigned(regs, val, imm, rd >> 2);
714 do_cmp_signed(regs, val, imm, rd >> 2);
719 add_with_carry(regs, rd, regs->
gpr[ra], imm, 0);
724 add_with_carry(regs, rd, regs->
gpr[ra], imm, 0);
731 imm += regs->
gpr[
ra];
736 imm = ((
short) instr) << 16;
738 imm += regs->
gpr[
ra];
743 mb = (instr >> 6) & 0x1f;
744 me = (instr >> 1) & 0x1f;
751 mb = (instr >> 6) & 0x1f;
752 me = (instr >> 1) & 0x1f;
758 mb = (instr >> 6) & 0x1f;
759 me = (instr >> 1) & 0x1f;
760 rb = regs->
gpr[
rb] & 0x1f;
766 imm = (
unsigned short) instr;
771 imm = (
unsigned short) instr;
776 imm = (
unsigned short) instr;
781 imm = (
unsigned short) instr;
786 imm = (
unsigned short) instr;
792 imm = (
unsigned short) instr;
799 mb = ((instr >> 6) & 0x1f) | (instr & 0x20);
801 if ((instr & 0x10) == 0) {
802 sh = rb | ((instr & 2) << 4);
804 switch ((instr >> 2) & 3) {
806 regs->
gpr[
ra] = val & MASK64_L(mb);
809 regs->
gpr[
ra] = val & MASK64_R(mb);
812 regs->
gpr[
ra] = val & MASK64(mb, 63 - sh);
815 imm = MASK64(mb, 63 - sh);
821 sh = regs->
gpr[
rb] & 0x3f;
823 switch ((instr >> 1) & 7) {
825 regs->
gpr[
ra] = val & MASK64_L(mb);
828 regs->
gpr[
ra] = val & MASK64_R(mb);
835 switch ((instr >> 1) & 0x3ff) {
837 if (regs->
msr & MSR_PR)
842 if (regs->
msr & MSR_PR)
854 if (regs->
msr & MSR_PR)
856 imm = (instr & 0x10000)? 0x8002: 0xefffffffffffefffUL;
858 | (regs->
gpr[rd] & imm);
859 if ((imm & MSR_RI) == 0)
873 for (sh = 0; sh < 8; ++sh) {
874 if (instr & (0x80000 >> sh))
875 regs->
ccr = (regs->
ccr & ~imm) |
882 spr = (instr >> 11) & 0x3ff;
898 spr = (instr >> 11) & 0x3ff;
917 val2 = regs->
gpr[
rb];
925 do_cmp_signed(regs, val, val2, rd >> 2);
930 val2 = regs->
gpr[
rb];
934 val = (
unsigned int) val;
935 val2 = (
unsigned int) val2;
938 do_cmp_unsigned(regs, val, val2, rd >> 2);
945 add_with_carry(regs, rd, ~regs->
gpr[ra],
950 asm(
"mulhdu %0,%1,%2" :
"=r" (regs->
gpr[
rd]) :
951 "r" (regs->
gpr[ra]),
"r" (regs->
gpr[
rb]));
955 add_with_carry(regs, rd, regs->
gpr[ra],
960 asm(
"mulhwu %0,%1,%2" :
"=r" (regs->
gpr[
rd]) :
961 "r" (regs->
gpr[ra]),
"r" (regs->
gpr[
rb]));
969 asm(
"mulhd %0,%1,%2" :
"=r" (regs->
gpr[
rd]) :
970 "r" (regs->
gpr[ra]),
"r" (regs->
gpr[
rb]));
974 asm(
"mulhw %0,%1,%2" :
"=r" (regs->
gpr[
rd]) :
975 "r" (regs->
gpr[ra]),
"r" (regs->
gpr[
rb]));
983 add_with_carry(regs, rd, ~regs->
gpr[ra], regs->
gpr[rb],
988 add_with_carry(regs, rd, regs->
gpr[ra], regs->
gpr[rb],
993 add_with_carry(regs, rd, ~regs->
gpr[ra], 0
L,
998 add_with_carry(regs, rd, regs->
gpr[ra], 0
L,
1003 add_with_carry(regs, rd, ~regs->
gpr[ra], -1
L,
1006 #ifdef __powerpc64__
1012 add_with_carry(regs, rd, regs->
gpr[ra], -1
L,
1018 (
unsigned int) regs->
gpr[
rb];
1024 #ifdef __powerpc64__
1031 (
unsigned int) regs->
gpr[
rb];
1033 #ifdef __powerpc64__
1036 (
long int) regs->
gpr[
rb];
1041 (
int) regs->
gpr[
rb];
1049 asm(
"cntlzw %0,%1" :
"=r" (regs->
gpr[
ra]) :
1050 "r" (regs->
gpr[rd]));
1052 #ifdef __powerpc64__
1054 asm(
"cntlzd %0,%1" :
"=r" (regs->
gpr[
ra]) :
1055 "r" (regs->
gpr[rd]));
1095 regs->
gpr[ra] = (
signed char) regs->
gpr[
rd];
1097 #ifdef __powerpc64__
1107 sh = regs->
gpr[rb] & 0x3f;
1109 regs->
gpr[
ra] = (regs->
gpr[
rd] << sh) & 0xffffffffUL;
1115 sh = regs->
gpr[
rb] & 0x3f;
1123 sh = regs->
gpr[
rb] & 0x3f;
1124 ival = (
signed int) regs->
gpr[rd];
1125 regs->
gpr[ra] = ival >> (sh < 32 ? sh : 31);
1126 if (ival < 0 && (sh >= 32 || (ival & ((1 << sh) - 1)) != 0))
1134 ival = (
signed int) regs->
gpr[rd];
1135 regs->
gpr[ra] = ival >> sh;
1136 if (ival < 0 && (ival & ((1 << sh) - 1)) != 0)
1142 #ifdef __powerpc64__
1144 sh = regs->
gpr[rd] & 0x7f;
1152 sh = regs->
gpr[
rb] & 0x7f;
1160 sh = regs->
gpr[
rb] & 0x7f;
1161 ival = (
signed long int) regs->
gpr[rd];
1162 regs->
gpr[ra] = ival >> (sh < 64 ? sh : 63);
1163 if (ival < 0 && (sh >= 64 || (ival & ((1 << sh) - 1)) != 0))
1171 sh = rb | ((instr & 2) << 4);
1172 ival = (
signed long int) regs->
gpr[rd];
1173 regs->
gpr[ra] = ival >> sh;
1174 if (ival < 0 && (ival & ((1 << sh) - 1)) != 0)
1185 ea = xform_ea(instr, regs, 0);
1186 if (!address_ok(regs, ea, 8))
1195 ea = xform_ea(instr, regs, 0);
1196 if (!address_ok(regs, ea, 8))
1206 ea = xform_ea(instr, regs, 0);
1213 ea = xform_ea(instr, regs, 0);
1226 if (regs->
msr & MSR_LE)
1233 old_ra = regs->
gpr[
ra];
1238 switch ((instr >> 1) & 0x3ff) {
1240 ea = xform_ea(instr, regs, 0);
1244 if (!address_ok(regs, ea, 4))
1253 ea = xform_ea(instr, regs, 0);
1257 if (!address_ok(regs, ea, 4))
1262 regs->
ccr = (regs->
ccr & 0x0fffffff) |
1264 ((regs->
xer >> 3) & 0x10000000);
1267 #ifdef __powerpc64__
1269 ea = xform_ea(instr, regs, 0);
1273 if (!address_ok(regs, ea, 8))
1282 ea = xform_ea(instr, regs, 0);
1286 if (!address_ok(regs, ea, 8))
1291 regs->
ccr = (regs->
ccr & 0x0fffffff) |
1293 ((regs->
xer >> 3) & 0x10000000);
1298 err = read_mem(®s->
gpr[rd], xform_ea(instr, regs, u),
1305 err = read_mem(®s->
gpr[rd], xform_ea(instr, regs, u),
1311 err = read_mem(®s->
gpr[rd], xform_ea(instr, regs, u),
1315 #ifdef CONFIG_ALTIVEC
1318 if (!(regs->
msr & MSR_VEC))
1320 ea = xform_ea(instr, regs, 0);
1321 err = do_vec_load(rd, do_lvx, ea, regs);
1326 if (!(regs->
msr & MSR_VEC))
1328 ea = xform_ea(instr, regs, 0);
1329 err = do_vec_store(rd, do_stvx, ea, regs);
1333 #ifdef __powerpc64__
1336 val = regs->
gpr[
rd];
1337 err = write_mem(val, xform_ea(instr, regs, u), 8, regs);
1343 val = regs->
gpr[
rd];
1344 err = write_mem(val, xform_ea(instr, regs, u), 4, regs);
1349 val = regs->
gpr[
rd];
1350 err = write_mem(val, xform_ea(instr, regs, u), 1, regs);
1355 err = read_mem(®s->
gpr[rd], xform_ea(instr, regs, u),
1359 #ifdef __powerpc64__
1362 err = read_mem(®s->
gpr[rd], xform_ea(instr, regs, u),
1371 err = read_mem(®s->
gpr[rd], xform_ea(instr, regs, u),
1379 val = regs->
gpr[rd];
1380 err = write_mem(val, xform_ea(instr, regs, u), 2,
regs);
1383 #ifdef __powerpc64__
1385 err = read_mem(&val, xform_ea(instr, regs, 0), 8, regs);
1387 regs->
gpr[
rd] = byterev_8(val);
1393 err = read_mem(&val, xform_ea(instr, regs, 0), 4, regs);
1395 regs->
gpr[
rd] = byterev_4(val);
1398 #ifdef CONFIG_PPC_CPU
1401 if (!(regs->
msr & MSR_FP))
1403 ea = xform_ea(instr, regs, u);
1404 err = do_fp_load(rd, do_lfs, ea, 4, regs);
1409 if (!(regs->
msr & MSR_FP))
1411 ea = xform_ea(instr, regs, u);
1412 err = do_fp_load(rd, do_lfd, ea, 8, regs);
1417 if (!(regs->
msr & MSR_FP))
1419 ea = xform_ea(instr, regs, u);
1420 err = do_fp_store(rd, do_stfs, ea, 4, regs);
1425 if (!(regs->
msr & MSR_FP))
1427 ea = xform_ea(instr, regs, u);
1428 err = do_fp_store(rd, do_stfd, ea, 8, regs);
1432 #ifdef __powerpc64__
1434 val = byterev_8(regs->
gpr[rd]);
1435 err = write_mem(val, xform_ea(instr, regs, 0), 8, regs);
1440 val = byterev_4(regs->
gpr[rd]);
1441 err = write_mem(val, xform_ea(instr, regs, 0), 4, regs);
1445 err = read_mem(&val, xform_ea(instr, regs, 0), 2, regs);
1447 regs->
gpr[
rd] = byterev_2(val);
1451 val = byterev_2(regs->
gpr[rd]);
1452 err = write_mem(val, xform_ea(instr, regs, 0), 2, regs);
1458 if (!(regs->
msr & MSR_VSX))
1460 rd |= (instr & 1) << 5;
1461 ea = xform_ea(instr, regs, u);
1462 err = do_vsx_load(rd, do_lxvd2x, ea, regs);
1467 if (!(regs->
msr & MSR_VSX))
1469 rd |= (instr & 1) << 5;
1470 ea = xform_ea(instr, regs, u);
1471 err = do_vsx_store(rd, do_stxvd2x, ea, regs);
1480 err = read_mem(®s->
gpr[rd], dform_ea(instr, regs), 4, regs);
1485 err = read_mem(®s->
gpr[rd], dform_ea(instr, regs), 1, regs);
1489 val = regs->
gpr[
rd];
1490 err = write_mem(val, dform_ea(instr, regs), 4, regs);
1494 val = regs->
gpr[
rd];
1495 val3 = dform_ea(instr, regs);
1504 if ((ra == 1) && !(regs->
msr & MSR_PR) \
1509 if (val3 - STACK_INT_FRAME_SIZE <= current->
thread.ksp_limit) {
1519 WARN_ON(test_thread_flag(TIF_EMULATE_STACK_STORE));
1520 set_thread_flag(TIF_EMULATE_STACK_STORE);
1523 err = write_mem(val, val3, 4, regs);
1528 val = regs->
gpr[
rd];
1529 err = write_mem(val, dform_ea(instr, regs), 1, regs);
1534 err = read_mem(®s->
gpr[rd], dform_ea(instr, regs), 2, regs);
1539 err = read_mem(®s->
gpr[rd], dform_ea(instr, regs), 2, regs);
1546 val = regs->
gpr[rd];
1547 err = write_mem(val, dform_ea(instr, regs), 2,
regs);
1551 ra = (instr >> 16) & 0x1f;
1554 ea = dform_ea(instr, regs);
1556 err = read_mem(®s->
gpr[rd], ea, 4, regs);
1560 }
while (++rd < 32);
1564 ea = dform_ea(instr, regs);
1566 err = write_mem(regs->
gpr[rd], ea, 4, regs);
1570 }
while (++rd < 32);
1573 #ifdef CONFIG_PPC_FPU
1576 if (!(regs->
msr & MSR_FP))
1578 ea = dform_ea(instr, regs);
1579 err = do_fp_load(rd, do_lfs, ea, 4, regs);
1584 if (!(regs->
msr & MSR_FP))
1586 ea = dform_ea(instr, regs);
1587 err = do_fp_load(rd, do_lfd, ea, 8, regs);
1592 if (!(regs->
msr & MSR_FP))
1594 ea = dform_ea(instr, regs);
1595 err = do_fp_store(rd, do_stfs, ea, 4, regs);
1600 if (!(regs->
msr & MSR_FP))
1602 ea = dform_ea(instr, regs);
1603 err = do_fp_store(rd, do_stfd, ea, 8, regs);
1607 #ifdef __powerpc64__
1609 switch (instr & 3) {
1611 err = read_mem(®s->
gpr[rd], dsform_ea(instr, regs),
1615 err = read_mem(®s->
gpr[rd], dsform_ea(instr, regs),
1619 err = read_mem(®s->
gpr[rd], dsform_ea(instr, regs),
1628 val = regs->
gpr[
rd];
1629 switch (instr & 3) {
1631 err = write_mem(val, dsform_ea(instr, regs), 8, regs);
1634 err = write_mem(val, dsform_ea(instr, regs), 8, regs);
1645 regs->
gpr[
ra] = old_ra;
1649 regs->
nip = truncate_if_32bit(regs->
msr, regs->
nip + 4);