Lines Matching full:ea
54 extern int do_lq(unsigned long ea, unsigned long *regs);
55 extern int do_stq(unsigned long ea, unsigned long val0, unsigned long val1);
56 extern int do_lqarx(unsigned long ea, unsigned long *regs);
57 extern int do_stqcx(unsigned long ea, unsigned long val0, unsigned long val1,
106 unsigned long ea, int nb) in address_ok() argument
110 if (access_ok((void __user *)ea, nb)) in address_ok()
112 if (access_ok((void __user *)ea, 1)) in address_ok()
116 regs->dar = ea; in address_ok()
127 unsigned long ea; in dform_ea() local
130 ea = (signed short) instr; /* sign-extend */ in dform_ea()
132 ea += regs->gpr[ra]; in dform_ea()
134 return ea; in dform_ea()
145 unsigned long ea; in dsform_ea() local
148 ea = (signed short) (instr & ~3); /* sign-extend */ in dsform_ea()
150 ea += regs->gpr[ra]; in dsform_ea()
152 return ea; in dsform_ea()
162 unsigned long ea; in dqform_ea() local
165 ea = (signed short) (instr & ~0xf); /* sign-extend */ in dqform_ea()
167 ea += regs->gpr[ra]; in dqform_ea()
169 return ea; in dqform_ea()
180 unsigned long ea; in xform_ea() local
184 ea = regs->gpr[rb]; in xform_ea()
186 ea += regs->gpr[ra]; in xform_ea()
188 return ea; in xform_ea()
201 unsigned long ea, d0, d1, d; in mlsd_8lsd_ea() local
214 ea = (signed int)dd; in mlsd_8lsd_ea()
215 ea = (ea << 2) | (d & 0x3); in mlsd_8lsd_ea()
218 ea += regs->gpr[ra]; in mlsd_8lsd_ea()
220 ; /* Leave ea as is */ in mlsd_8lsd_ea()
222 ea += regs->nip; in mlsd_8lsd_ea()
229 return ea; in mlsd_8lsd_ea()
301 __read_mem_aligned(unsigned long *dest, unsigned long ea, int nb, struct pt_regs *regs) in __read_mem_aligned() argument
307 unsafe_get_user(x, (unsigned char __user *)ea, Efault); in __read_mem_aligned()
310 unsafe_get_user(x, (unsigned short __user *)ea, Efault); in __read_mem_aligned()
313 unsafe_get_user(x, (unsigned int __user *)ea, Efault); in __read_mem_aligned()
317 unsafe_get_user(x, (unsigned long __user *)ea, Efault); in __read_mem_aligned()
325 regs->dar = ea; in __read_mem_aligned()
330 read_mem_aligned(unsigned long *dest, unsigned long ea, int nb, struct pt_regs *regs) in read_mem_aligned() argument
334 if (is_kernel_addr(ea)) in read_mem_aligned()
335 return __read_mem_aligned(dest, ea, nb, regs); in read_mem_aligned()
337 if (user_read_access_begin((void __user *)ea, nb)) { in read_mem_aligned()
338 err = __read_mem_aligned(dest, ea, nb, regs); in read_mem_aligned()
342 regs->dar = ea; in read_mem_aligned()
352 static __always_inline int __copy_mem_in(u8 *dest, unsigned long ea, int nb, struct pt_regs *regs) in __copy_mem_in() argument
357 c = max_align(ea); in __copy_mem_in()
362 unsafe_get_user(*dest, (u8 __user *)ea, Efault); in __copy_mem_in()
365 unsafe_get_user(*(u16 *)dest, (u16 __user *)ea, Efault); in __copy_mem_in()
368 unsafe_get_user(*(u32 *)dest, (u32 __user *)ea, Efault); in __copy_mem_in()
372 unsafe_get_user(*(u64 *)dest, (u64 __user *)ea, Efault); in __copy_mem_in()
377 ea += c; in __copy_mem_in()
382 regs->dar = ea; in __copy_mem_in()
386 static nokprobe_inline int copy_mem_in(u8 *dest, unsigned long ea, int nb, struct pt_regs *regs) in copy_mem_in() argument
390 if (is_kernel_addr(ea)) in copy_mem_in()
391 return __copy_mem_in(dest, ea, nb, regs); in copy_mem_in()
393 if (user_read_access_begin((void __user *)ea, nb)) { in copy_mem_in()
394 err = __copy_mem_in(dest, ea, nb, regs); in copy_mem_in()
398 regs->dar = ea; in copy_mem_in()
405 unsigned long ea, int nb, in read_mem_unaligned() argument
417 err = copy_mem_in(&u.b[i], ea, nb, regs); in read_mem_unaligned()
424 * Read memory at address ea for nb bytes, return 0 for success
428 static int read_mem(unsigned long *dest, unsigned long ea, int nb, in read_mem() argument
431 if (!address_ok(regs, ea, nb)) in read_mem()
433 if ((ea & (nb - 1)) == 0) in read_mem()
434 return read_mem_aligned(dest, ea, nb, regs); in read_mem()
435 return read_mem_unaligned(dest, ea, nb, regs); in read_mem()
440 __write_mem_aligned(unsigned long val, unsigned long ea, int nb, struct pt_regs *regs) in __write_mem_aligned() argument
444 unsafe_put_user(val, (unsigned char __user *)ea, Efault); in __write_mem_aligned()
447 unsafe_put_user(val, (unsigned short __user *)ea, Efault); in __write_mem_aligned()
450 unsafe_put_user(val, (unsigned int __user *)ea, Efault); in __write_mem_aligned()
454 unsafe_put_user(val, (unsigned long __user *)ea, Efault); in __write_mem_aligned()
461 regs->dar = ea; in __write_mem_aligned()
466 write_mem_aligned(unsigned long val, unsigned long ea, int nb, struct pt_regs *regs) in write_mem_aligned() argument
470 if (is_kernel_addr(ea)) in write_mem_aligned()
471 return __write_mem_aligned(val, ea, nb, regs); in write_mem_aligned()
473 if (user_write_access_begin((void __user *)ea, nb)) { in write_mem_aligned()
474 err = __write_mem_aligned(val, ea, nb, regs); in write_mem_aligned()
478 regs->dar = ea; in write_mem_aligned()
488 static __always_inline int __copy_mem_out(u8 *dest, unsigned long ea, int nb, struct pt_regs *regs) in __copy_mem_out() argument
493 c = max_align(ea); in __copy_mem_out()
498 unsafe_put_user(*dest, (u8 __user *)ea, Efault); in __copy_mem_out()
501 unsafe_put_user(*(u16 *)dest, (u16 __user *)ea, Efault); in __copy_mem_out()
504 unsafe_put_user(*(u32 *)dest, (u32 __user *)ea, Efault); in __copy_mem_out()
508 unsafe_put_user(*(u64 *)dest, (u64 __user *)ea, Efault); in __copy_mem_out()
513 ea += c; in __copy_mem_out()
518 regs->dar = ea; in __copy_mem_out()
522 static nokprobe_inline int copy_mem_out(u8 *dest, unsigned long ea, int nb, struct pt_regs *regs) in copy_mem_out() argument
526 if (is_kernel_addr(ea)) in copy_mem_out()
527 return __copy_mem_out(dest, ea, nb, regs); in copy_mem_out()
529 if (user_write_access_begin((void __user *)ea, nb)) { in copy_mem_out()
530 err = __copy_mem_out(dest, ea, nb, regs); in copy_mem_out()
534 regs->dar = ea; in copy_mem_out()
541 unsigned long ea, int nb, in write_mem_unaligned() argument
552 return copy_mem_out(&u.b[i], ea, nb, regs); in write_mem_unaligned()
556 * Write memory at address ea for nb bytes, return 0 for success
559 static int write_mem(unsigned long val, unsigned long ea, int nb, in write_mem() argument
562 if (!address_ok(regs, ea, nb)) in write_mem()
564 if ((ea & (nb - 1)) == 0) in write_mem()
565 return write_mem_aligned(val, ea, nb, regs); in write_mem()
566 return write_mem_unaligned(val, ea, nb, regs); in write_mem()
575 static int do_fp_load(struct instruction_op *op, unsigned long ea, in do_fp_load() argument
591 if (!address_ok(regs, ea, nb)) in do_fp_load()
594 err = copy_mem_in(u.b, ea, nb, regs); in do_fp_load()
628 static int do_fp_store(struct instruction_op *op, unsigned long ea, in do_fp_store() argument
643 if (!address_ok(regs, ea, nb)) in do_fp_store()
670 return copy_mem_out(u.b, ea, nb, regs); in do_fp_store()
677 static nokprobe_inline int do_vec_load(int rn, unsigned long ea, in do_vec_load() argument
690 if (!address_ok(regs, ea & ~0xfUL, 16)) in do_vec_load()
693 ea &= ~(size - 1); in do_vec_load()
694 err = copy_mem_in(&u.b[ea & 0xf], ea, size, regs); in do_vec_load()
698 do_byte_reverse(&u.b[ea & 0xf], size); in do_vec_load()
708 static nokprobe_inline int do_vec_store(int rn, unsigned long ea, in do_vec_store() argument
720 if (!address_ok(regs, ea & ~0xfUL, 16)) in do_vec_store()
723 ea &= ~(size - 1); in do_vec_store()
732 do_byte_reverse(&u.b[ea & 0xf], size); in do_vec_store()
733 return copy_mem_out(&u.b[ea & 0xf], ea, size, regs); in do_vec_store()
738 static nokprobe_inline int emulate_lq(struct pt_regs *regs, unsigned long ea, in emulate_lq() argument
743 if (!address_ok(regs, ea, 16)) in emulate_lq()
746 if ((ea & 0xf) == 0) { in emulate_lq()
747 err = do_lq(ea, ®s->gpr[reg]); in emulate_lq()
749 err = read_mem(®s->gpr[reg + IS_LE], ea, 8, regs); in emulate_lq()
751 err = read_mem(®s->gpr[reg + IS_BE], ea + 8, 8, regs); in emulate_lq()
758 static nokprobe_inline int emulate_stq(struct pt_regs *regs, unsigned long ea, in emulate_stq() argument
764 if (!address_ok(regs, ea, 16)) in emulate_stq()
772 if ((ea & 0xf) == 0) in emulate_stq()
773 return do_stq(ea, vals[0], vals[1]); in emulate_stq()
775 err = write_mem(vals[IS_LE], ea, 8, regs); in emulate_stq()
777 err = write_mem(vals[IS_BE], ea + 8, 8, regs); in emulate_stq()
958 unsigned long ea, struct pt_regs *regs, in do_vsx_load() argument
967 if (!address_ok(regs, ea, size) || copy_mem_in(mem, ea, size, regs)) in do_vsx_load()
1005 unsigned long ea, struct pt_regs *regs, in do_vsx_store() argument
1014 if (!address_ok(regs, ea, size)) in do_vsx_store()
1048 return copy_mem_out(mem, ea, size, regs); in do_vsx_store()
1052 static __always_inline int __emulate_dcbz(unsigned long ea) in __emulate_dcbz() argument
1058 unsafe_put_user(0, (unsigned long __user *)(ea + i), Efault); in __emulate_dcbz()
1066 int emulate_dcbz(unsigned long ea, struct pt_regs *regs) in emulate_dcbz() argument
1071 ea = truncate_if_32bit(regs->msr, ea); in emulate_dcbz()
1072 ea &= ~(size - 1); in emulate_dcbz()
1073 if (!address_ok(regs, ea, size)) in emulate_dcbz()
1076 if (is_kernel_addr(ea)) { in emulate_dcbz()
1077 err = __emulate_dcbz(ea); in emulate_dcbz()
1078 } else if (user_write_access_begin((void __user *)ea, size)) { in emulate_dcbz()
1079 err = __emulate_dcbz(ea); in emulate_dcbz()
1086 regs->dar = ea; in emulate_dcbz()
2237 op->ea = xform_ea(word, regs); in analyse_instr()
2242 op->ea = xform_ea(word, regs); in analyse_instr()
2247 op->ea = xform_ea(word, regs); in analyse_instr()
2253 op->ea = xform_ea(word, regs); in analyse_instr()
2259 op->ea = xform_ea(word, regs); in analyse_instr()
2264 op->ea = xform_ea(word, regs); in analyse_instr()
2283 op->ea = xform_ea(word, regs); in analyse_instr()
2343 * bits of the EA say which field of the VMX register to use. in analyse_instr()
2449 op->ea = ra ? regs->gpr[ra] : 0; in analyse_instr()
2516 op->ea = ra ? regs->gpr[ra] : 0; in analyse_instr()
2562 op->ea = ra ? regs->gpr[ra] : 0; in analyse_instr()
2611 op->ea = ra ? regs->gpr[ra] : 0; in analyse_instr()
2757 op->ea = dform_ea(word, regs); in analyse_instr()
2763 op->ea = dform_ea(word, regs); in analyse_instr()
2769 op->ea = dform_ea(word, regs); in analyse_instr()
2775 op->ea = dform_ea(word, regs); in analyse_instr()
2781 op->ea = dform_ea(word, regs); in analyse_instr()
2787 op->ea = dform_ea(word, regs); in analyse_instr()
2793 op->ea = dform_ea(word, regs); in analyse_instr()
2800 op->ea = dform_ea(word, regs); in analyse_instr()
2805 op->ea = dform_ea(word, regs); in analyse_instr()
2812 op->ea = dform_ea(word, regs); in analyse_instr()
2818 op->ea = dform_ea(word, regs); in analyse_instr()
2824 op->ea = dform_ea(word, regs); in analyse_instr()
2830 op->ea = dform_ea(word, regs); in analyse_instr()
2838 op->ea = dqform_ea(word, regs); in analyse_instr()
2844 op->ea = dsform_ea(word, regs); in analyse_instr()
2873 op->ea = dsform_ea(word, regs); in analyse_instr()
2892 op->ea = dqform_ea(word, regs); in analyse_instr()
2909 op->ea = dsform_ea(word, regs); in analyse_instr()
2916 op->ea = dqform_ea(word, regs); in analyse_instr()
2928 op->ea = dsform_ea(word, regs); in analyse_instr()
2939 op->ea = dsform_ea(word, regs); in analyse_instr()
2949 op->ea = dqform_ea(word, regs); in analyse_instr()
2962 op->ea = dsform_ea(word, regs); in analyse_instr()
2993 op->ea = mlsd_8lsd_ea(word, suffix, regs); in analyse_instr()
3073 op->ea = mlsd_8lsd_ea(word, suffix, regs); in analyse_instr()
3182 static nokprobe_inline int handle_stack_update(unsigned long ea, struct pt_regs *regs) in handle_stack_update() argument
3326 unsigned long ea; in emulate_loadstore() local
3333 ea = truncate_if_32bit(regs->msr, op->ea); in emulate_loadstore()
3337 if (ea & (size - 1)) in emulate_loadstore()
3339 if (!address_ok(regs, ea, size)) in emulate_loadstore()
3346 __get_user_asmx(val, ea, err, "lbarx"); in emulate_loadstore()
3349 __get_user_asmx(val, ea, err, "lharx"); in emulate_loadstore()
3353 __get_user_asmx(val, ea, err, "lwarx"); in emulate_loadstore()
3357 __get_user_asmx(val, ea, err, "ldarx"); in emulate_loadstore()
3360 err = do_lqarx(ea, ®s->gpr[op->reg]); in emulate_loadstore()
3367 regs->dar = ea; in emulate_loadstore()
3375 if (ea & (size - 1)) in emulate_loadstore()
3377 if (!address_ok(regs, ea, size)) in emulate_loadstore()
3383 __put_user_asmx(op->val, ea, err, "stbcx.", cr); in emulate_loadstore()
3386 __put_user_asmx(op->val, ea, err, "sthcx.", cr); in emulate_loadstore()
3390 __put_user_asmx(op->val, ea, err, "stwcx.", cr); in emulate_loadstore()
3394 __put_user_asmx(op->val, ea, err, "stdcx.", cr); in emulate_loadstore()
3397 err = do_stqcx(ea, regs->gpr[op->reg], in emulate_loadstore()
3409 regs->dar = ea; in emulate_loadstore()
3415 err = emulate_lq(regs, ea, op->reg, cross_endian); in emulate_loadstore()
3419 err = read_mem(®s->gpr[op->reg], ea, size, regs); in emulate_loadstore()
3438 err = do_fp_load(op, ea, regs, cross_endian); in emulate_loadstore()
3445 err = do_vec_load(op->reg, ea, size, regs, cross_endian); in emulate_loadstore()
3460 err = do_vsx_load(op, ea, regs, cross_endian); in emulate_loadstore()
3465 if (!address_ok(regs, ea, size)) in emulate_loadstore()
3474 err = copy_mem_in((u8 *) &v32, ea, nb, regs); in emulate_loadstore()
3480 ea += 4; in emulate_loadstore()
3489 err = emulate_stq(regs, ea, op->reg, cross_endian); in emulate_loadstore()
3496 ea >= regs->gpr[1] - STACK_INT_FRAME_SIZE) { in emulate_loadstore()
3497 err = handle_stack_update(ea, regs); in emulate_loadstore()
3502 err = write_mem(op->val, ea, size, regs); in emulate_loadstore()
3509 err = do_fp_store(op, ea, regs, cross_endian); in emulate_loadstore()
3516 err = do_vec_store(op->reg, ea, size, regs, cross_endian); in emulate_loadstore()
3531 err = do_vsx_store(op, ea, regs, cross_endian); in emulate_loadstore()
3536 if (!address_ok(regs, ea, size)) in emulate_loadstore()
3547 err = copy_mem_out((u8 *) &v32, ea, nb, regs); in emulate_loadstore()
3550 ea += 4; in emulate_loadstore()
3564 regs->gpr[op->update_reg] = op->ea; in emulate_loadstore()
3582 unsigned long ea; in emulate_step() local
3604 ea = truncate_if_32bit(regs->msr, op.ea); in emulate_step()
3605 if (!address_ok(regs, ea, 8)) in emulate_step()
3609 __cacheop_user_asmx(ea, err, "dcbst"); in emulate_step()
3612 __cacheop_user_asmx(ea, err, "dcbf"); in emulate_step()
3616 prefetchw((void *) ea); in emulate_step()
3620 prefetch((void *) ea); in emulate_step()
3623 __cacheop_user_asmx(ea, err, "icbi"); in emulate_step()
3626 err = emulate_dcbz(ea, regs); in emulate_step()
3630 regs->dar = ea; in emulate_step()