android_kernel_motorola_sm6225/arch/powerpc/lib
Paul Mackerras 0016a4cf55 powerpc: Emulate most Book I instructions in emulate_step()
This extends the emulate_step() function to handle a large proportion
of the Book I instructions implemented on current 64-bit server
processors.  The aim is to handle all the load and store instructions
used in the kernel, plus all of the instructions that appear between
l[wd]arx and st[wd]cx., so this handles the Altivec/VMX lvx and stvx
and the VSX lxv2dx and stxv2dx instructions (implemented in POWER7).

The new code can emulate user mode instructions, and checks the
effective address for a load or store if the saved state is for
user mode.  It doesn't handle little-endian mode at present.

For floating-point, Altivec/VMX and VSX instructions, it checks
that the saved MSR has the enable bit for the relevant facility
set, and if so, assumes that the FP/VMX/VSX registers contain
valid state, and does loads or stores directly to/from the
FP/VMX/VSX registers, using assembly helpers in ldstfp.S.

Instructions supported now include:
* Loads and stores, including some but not all VMX and VSX instructions,
  and lmw/stmw
* Atomic loads and stores (l[dw]arx, st[dw]cx.)
* Arithmetic instructions (add, subtract, multiply, divide, etc.)
* Compare instructions
* Rotate and mask instructions
* Shift instructions
* Logical instructions (and, or, xor, etc.)
* Condition register logical instructions
* mtcrf, cntlz[wd], exts[bhw]
* isync, sync, lwsync, ptesync, eieio
* Cache operations (dcbf, dcbst, dcbt, dcbtst)

The overflow-checking arithmetic instructions are not included, but
they appear not to be ever used in C code.

This uses decimal values for the minor opcodes in the switch statements
because that is what appears in the Power ISA specification, thus it is
easier to check that they are correct if they are in decimal.

If this is used to single-step an instruction where a data breakpoint
interrupt occurred, then there is the possibility that the instruction
is a lwarx or ldarx.  In that case we have to be careful not to lose the
reservation until we get to the matching st[wd]cx., or we'll never make
forward progress.  One alternative is to try to arrange that we can
return from interrupts and handle data breakpoint interrupts without
losing the reservation, which means not using any spinlocks, mutexes,
or atomic ops (including bitops).  That seems rather fragile.  The
other alternative is to emulate the larx/stcx and all the instructions
in between.  This is why this commit adds support for a wide range
of integer instructions.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-06-22 19:40:29 +10:00
..
alloc.c [POWERPC] Limit range of __init_ref_ok somewhat 2007-10-03 11:48:44 +10:00
checksum_32.S powerpc: Rename files to have consistent _32/_64 suffixes 2005-10-10 21:52:43 +10:00
checksum_64.S powerpc: Rename files to have consistent _32/_64 suffixes 2005-10-10 21:52:43 +10:00
code-patching.c PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
copy_32.S powerpc/8xx: Start using dcbX instructions in various copy routines 2009-12-09 17:10:37 +11:00
copypage_64.S powerpc: Pair loads and stores in copy_4k_page 2010-02-17 14:03:16 +11:00
copyuser_64.S powerpc: Improve 64bit copy_tofrom_user 2010-02-17 14:03:16 +11:00
crtsavres.S [POWERPC] Fix -Os kernel builds with newer gcc versions 2008-06-16 15:00:54 +10:00
devres.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
div64.S powerpc: Fix a corner case in __div64_32 2005-10-20 09:37:02 +10:00
feature-fixups-test.S powerpc: Fixup lwsync at runtime 2008-07-03 16:58:10 +10:00
feature-fixups.c powerpc: Fix lwsync feature fixup vs. modules on 64-bit 2010-02-26 18:29:17 +11:00
ldstfp.S powerpc: Emulate most Book I instructions in emulate_step() 2010-06-22 19:40:29 +10:00
locks.c locking: Convert raw_rwlock to arch_rwlock 2009-12-14 23:55:32 +01:00
Makefile powerpc: Emulate most Book I instructions in emulate_step() 2010-06-22 19:40:29 +10:00
mem_64.S [POWERPC] Use mtocrf instruction in asm when CONFIG_POWER4_ONLY=y 2007-04-13 03:55:13 +10:00
memcpy_64.S powerpc: Fix 64bit memcpy() regression 2009-02-26 14:02:53 +11:00
rheap.c powerpc: Fix corruption error in rh_alloc_fixed() 2008-12-17 10:06:14 -06:00
sstep.c powerpc: Emulate most Book I instructions in emulate_step() 2010-06-22 19:40:29 +10:00
string.S powerpc: Fix string library functions 2010-05-21 17:31:08 +10:00
usercopy_64.c powerpc: Rename files to have consistent _32/_64 suffixes 2005-10-10 21:52:43 +10:00