powerpc: use _GLOBAL_TOC for memmove
authorLi Zhong <zhong@linux.vnet.ibm.com>
Mon, 21 Jul 2014 09:55:13 +0000 (17:55 +0800)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 22 Jul 2014 05:56:04 +0000 (15:56 +1000)
memmove may be called from module code copy_pages(btrfs), and it may
call memcpy, which may call back to C code, so it needs to use
_GLOBAL_TOC to set up r2 correctly.

This fixes following error when I tried to boot an le guest:

Vector: 300 (Data Access) at [c000000073f97210]
    pc: c000000000015004: enable_kernel_altivec+0x24/0x80
    lr: c000000000058fbc: enter_vmx_copy+0x3c/0x60
    sp: c000000073f97490
   msr: 8000000002009033
   dar: d000000001d50170
 dsisr: 40000000
  current = 0xc0000000734c0000
  paca    = 0xc00000000fff0000  softe: 0  irq_happened: 0x01
    pid   = 815, comm = mktemp
enter ? for help
[c000000073f974f0c000000000058fbc enter_vmx_copy+0x3c/0x60
[c000000073f97510c000000000057d34 memcpy_power7+0x274/0x840
[c000000073f97610d000000001c3179c copy_pages+0xfc/0x110 [btrfs]
[c000000073f97660d000000001c3c248 memcpy_extent_buffer+0xe8/0x160 [btrfs]
[c000000073f97700d000000001be4be8 setup_items_for_insert+0x208/0x4a0 [btrfs]
[c000000073f97820d000000001be50b4 btrfs_insert_empty_items+0xf4/0x140 [btrfs]
[c000000073f97890d000000001bfed30 insert_with_overflow+0x70/0x180 [btrfs]
[c000000073f97900d000000001bff174 btrfs_insert_dir_item+0x114/0x2f0 [btrfs]
[c000000073f979a0d000000001c1f92c btrfs_add_link+0x10c/0x370 [btrfs]
[c000000073f97a40d000000001c20e94 btrfs_create+0x204/0x270 [btrfs]
[c000000073f97b00c00000000026d438 vfs_create+0x178/0x210
[c000000073f97b50c000000000270a70 do_last+0x9f0/0xe90
[c000000073f97c20c000000000271010 path_openat+0x100/0x810
[c000000073f97ce0c000000000272ea8 do_filp_open+0x58/0xd0
[c000000073f97dc0c00000000025ade8 do_sys_open+0x1b8/0x300
[c000000073f97e30c00000000000a008 syscall_exit+0x0/0x7c

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/lib/mem_64.S

index 0738f96befbff76829e1119a5feefc915be39da8..43435c6892fb05d4ac2a732d30eef6e58b4bfaf8 100644 (file)
@@ -77,7 +77,7 @@ _GLOBAL(memset)
        stb     r4,0(r6)
        blr
 
-_GLOBAL(memmove)
+_GLOBAL_TOC(memmove)
        cmplw   0,r3,r4
        bgt     backwards_memcpy
        b       memcpy