1d670bd4fSSam Ravnborg/* una_asm.S: Kernel unaligned trap assembler helpers. 2d670bd4fSSam Ravnborg * 3d670bd4fSSam Ravnborg * Copyright (C) 1996,2005,2008 David S. Miller (davem@davemloft.net) 4d670bd4fSSam Ravnborg * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 5d670bd4fSSam Ravnborg */ 6d670bd4fSSam Ravnborg 7d670bd4fSSam Ravnborg#include <linux/errno.h> 8d670bd4fSSam Ravnborg 9d670bd4fSSam Ravnborg .text 10d670bd4fSSam Ravnborg 11d670bd4fSSam Ravnborgretl_efault: 12d670bd4fSSam Ravnborg retl 13d670bd4fSSam Ravnborg mov -EFAULT, %o0 14d670bd4fSSam Ravnborg 15d670bd4fSSam Ravnborg /* int __do_int_store(unsigned long *dst_addr, int size, 16d670bd4fSSam Ravnborg * unsigned long *src_val) 17d670bd4fSSam Ravnborg * 18d670bd4fSSam Ravnborg * %o0 = dest_addr 19d670bd4fSSam Ravnborg * %o1 = size 20d670bd4fSSam Ravnborg * %o2 = src_val 21d670bd4fSSam Ravnborg * 22d670bd4fSSam Ravnborg * Return '0' on success, -EFAULT on failure. 23d670bd4fSSam Ravnborg */ 24d670bd4fSSam Ravnborg .globl __do_int_store 25d670bd4fSSam Ravnborg__do_int_store: 26d670bd4fSSam Ravnborg ld [%o2], %g1 272492218cSDaniel Hellstrom cmp %o1, 2 28d670bd4fSSam Ravnborg be 2f 292492218cSDaniel Hellstrom cmp %o1, 4 30d670bd4fSSam Ravnborg be 1f 31d670bd4fSSam Ravnborg srl %g1, 24, %g2 32d670bd4fSSam Ravnborg srl %g1, 16, %g7 33d670bd4fSSam Ravnborg4: stb %g2, [%o0] 34d670bd4fSSam Ravnborg srl %g1, 8, %g2 35d670bd4fSSam Ravnborg5: stb %g7, [%o0 + 1] 36d670bd4fSSam Ravnborg ld [%o2 + 4], %g7 37d670bd4fSSam Ravnborg6: stb %g2, [%o0 + 2] 38d670bd4fSSam Ravnborg srl %g7, 24, %g2 39d670bd4fSSam Ravnborg7: stb %g1, [%o0 + 3] 40d670bd4fSSam Ravnborg srl %g7, 16, %g1 41d670bd4fSSam Ravnborg8: stb %g2, [%o0 + 4] 42d670bd4fSSam Ravnborg srl %g7, 8, %g2 43d670bd4fSSam Ravnborg9: stb %g1, [%o0 + 5] 44d670bd4fSSam Ravnborg10: stb %g2, [%o0 + 6] 45d670bd4fSSam Ravnborg b 0f 46d670bd4fSSam Ravnborg11: stb %g7, [%o0 + 7] 47d670bd4fSSam Ravnborg1: srl %g1, 16, %g7 48d670bd4fSSam Ravnborg12: stb %g2, [%o0] 49d670bd4fSSam Ravnborg srl %g1, 8, %g2 50d670bd4fSSam Ravnborg13: stb %g7, [%o0 + 1] 51d670bd4fSSam Ravnborg14: stb %g2, [%o0 + 2] 52d670bd4fSSam Ravnborg b 0f 53d670bd4fSSam Ravnborg15: stb %g1, [%o0 + 3] 54d670bd4fSSam Ravnborg2: srl %g1, 8, %g2 55d670bd4fSSam Ravnborg16: stb %g2, [%o0] 56d670bd4fSSam Ravnborg17: stb %g1, [%o0 + 1] 57d670bd4fSSam Ravnborg0: retl 58d670bd4fSSam Ravnborg mov 0, %o0 59d670bd4fSSam Ravnborg 60d670bd4fSSam Ravnborg .section __ex_table,#alloc 61d670bd4fSSam Ravnborg .word 4b, retl_efault 62d670bd4fSSam Ravnborg .word 5b, retl_efault 63d670bd4fSSam Ravnborg .word 6b, retl_efault 64d670bd4fSSam Ravnborg .word 7b, retl_efault 65d670bd4fSSam Ravnborg .word 8b, retl_efault 66d670bd4fSSam Ravnborg .word 9b, retl_efault 67d670bd4fSSam Ravnborg .word 10b, retl_efault 68d670bd4fSSam Ravnborg .word 11b, retl_efault 69d670bd4fSSam Ravnborg .word 12b, retl_efault 70d670bd4fSSam Ravnborg .word 13b, retl_efault 71d670bd4fSSam Ravnborg .word 14b, retl_efault 72d670bd4fSSam Ravnborg .word 15b, retl_efault 73d670bd4fSSam Ravnborg .word 16b, retl_efault 74d670bd4fSSam Ravnborg .word 17b, retl_efault 75d670bd4fSSam Ravnborg .previous 76d670bd4fSSam Ravnborg 77d670bd4fSSam Ravnborg /* int do_int_load(unsigned long *dest_reg, int size, 78d670bd4fSSam Ravnborg * unsigned long *saddr, int is_signed) 79d670bd4fSSam Ravnborg * 80d670bd4fSSam Ravnborg * %o0 = dest_reg 81d670bd4fSSam Ravnborg * %o1 = size 82d670bd4fSSam Ravnborg * %o2 = saddr 83d670bd4fSSam Ravnborg * %o3 = is_signed 84d670bd4fSSam Ravnborg * 85d670bd4fSSam Ravnborg * Return '0' on success, -EFAULT on failure. 86d670bd4fSSam Ravnborg */ 87d670bd4fSSam Ravnborg .globl do_int_load 88d670bd4fSSam Ravnborgdo_int_load: 89d670bd4fSSam Ravnborg cmp %o1, 8 90d670bd4fSSam Ravnborg be 9f 91d670bd4fSSam Ravnborg cmp %o1, 4 92d670bd4fSSam Ravnborg be 6f 93d670bd4fSSam Ravnborg4: ldub [%o2], %g1 94d670bd4fSSam Ravnborg5: ldub [%o2 + 1], %g2 95d670bd4fSSam Ravnborg sll %g1, 8, %g1 96d670bd4fSSam Ravnborg tst %o3 97d670bd4fSSam Ravnborg be 3f 98d670bd4fSSam Ravnborg or %g1, %g2, %g1 99d670bd4fSSam Ravnborg sll %g1, 16, %g1 100d670bd4fSSam Ravnborg sra %g1, 16, %g1 101d670bd4fSSam Ravnborg3: b 0f 102d670bd4fSSam Ravnborg st %g1, [%o0] 103d670bd4fSSam Ravnborg6: ldub [%o2 + 1], %g2 104d670bd4fSSam Ravnborg sll %g1, 24, %g1 105d670bd4fSSam Ravnborg7: ldub [%o2 + 2], %g7 106d670bd4fSSam Ravnborg sll %g2, 16, %g2 107d670bd4fSSam Ravnborg8: ldub [%o2 + 3], %g3 108d670bd4fSSam Ravnborg sll %g7, 8, %g7 109d670bd4fSSam Ravnborg or %g3, %g2, %g3 110d670bd4fSSam Ravnborg or %g7, %g3, %g7 111d670bd4fSSam Ravnborg or %g1, %g7, %g1 112d670bd4fSSam Ravnborg b 0f 113d670bd4fSSam Ravnborg st %g1, [%o0] 114d670bd4fSSam Ravnborg9: ldub [%o2], %g1 115d670bd4fSSam Ravnborg10: ldub [%o2 + 1], %g2 116d670bd4fSSam Ravnborg sll %g1, 24, %g1 117d670bd4fSSam Ravnborg11: ldub [%o2 + 2], %g7 118d670bd4fSSam Ravnborg sll %g2, 16, %g2 119d670bd4fSSam Ravnborg12: ldub [%o2 + 3], %g3 120d670bd4fSSam Ravnborg sll %g7, 8, %g7 121d670bd4fSSam Ravnborg or %g1, %g2, %g1 122d670bd4fSSam Ravnborg or %g7, %g3, %g7 123d670bd4fSSam Ravnborg or %g1, %g7, %g7 124d670bd4fSSam Ravnborg13: ldub [%o2 + 4], %g1 125d670bd4fSSam Ravnborg st %g7, [%o0] 126d670bd4fSSam Ravnborg14: ldub [%o2 + 5], %g2 127d670bd4fSSam Ravnborg sll %g1, 24, %g1 128d670bd4fSSam Ravnborg15: ldub [%o2 + 6], %g7 129d670bd4fSSam Ravnborg sll %g2, 16, %g2 130d670bd4fSSam Ravnborg16: ldub [%o2 + 7], %g3 131d670bd4fSSam Ravnborg sll %g7, 8, %g7 132d670bd4fSSam Ravnborg or %g1, %g2, %g1 133d670bd4fSSam Ravnborg or %g7, %g3, %g7 134d670bd4fSSam Ravnborg or %g1, %g7, %g7 135d670bd4fSSam Ravnborg st %g7, [%o0 + 4] 136d670bd4fSSam Ravnborg0: retl 137d670bd4fSSam Ravnborg mov 0, %o0 138d670bd4fSSam Ravnborg 139d670bd4fSSam Ravnborg .section __ex_table,#alloc 140d670bd4fSSam Ravnborg .word 4b, retl_efault 141d670bd4fSSam Ravnborg .word 5b, retl_efault 142d670bd4fSSam Ravnborg .word 6b, retl_efault 143d670bd4fSSam Ravnborg .word 7b, retl_efault 144d670bd4fSSam Ravnborg .word 8b, retl_efault 145d670bd4fSSam Ravnborg .word 9b, retl_efault 146d670bd4fSSam Ravnborg .word 10b, retl_efault 147d670bd4fSSam Ravnborg .word 11b, retl_efault 148d670bd4fSSam Ravnborg .word 12b, retl_efault 149d670bd4fSSam Ravnborg .word 13b, retl_efault 150d670bd4fSSam Ravnborg .word 14b, retl_efault 151d670bd4fSSam Ravnborg .word 15b, retl_efault 152d670bd4fSSam Ravnborg .word 16b, retl_efault 153d670bd4fSSam Ravnborg .previous 154