extable.c (2e77a62cb3a6d2eb9dd875516411bcd131dd04e7) | extable.c (753b32368705c396000f95f33c3b7018474e33ad) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Based on arch/arm/mm/extable.c 4 */ 5 6#include <linux/bitfield.h> 7#include <linux/extable.h> 8#include <linux/uaccess.h> --- 25 unchanged lines hidden (view full) --- 34 35 pt_regs_write_reg(regs, reg_err, -EFAULT); 36 pt_regs_write_reg(regs, reg_zero, 0); 37 38 regs->pc = get_ex_fixup(ex); 39 return true; 40} 41 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Based on arch/arm/mm/extable.c 4 */ 5 6#include <linux/bitfield.h> 7#include <linux/extable.h> 8#include <linux/uaccess.h> --- 25 unchanged lines hidden (view full) --- 34 35 pt_regs_write_reg(regs, reg_err, -EFAULT); 36 pt_regs_write_reg(regs, reg_zero, 0); 37 38 regs->pc = get_ex_fixup(ex); 39 return true; 40} 41 |
42static bool 43ex_handler_load_unaligned_zeropad(const struct exception_table_entry *ex, 44 struct pt_regs *regs) 45{ 46 int reg_data = FIELD_GET(EX_DATA_REG_DATA, ex->type); 47 int reg_addr = FIELD_GET(EX_DATA_REG_ADDR, ex->type); 48 unsigned long data, addr, offset; 49 50 addr = pt_regs_read_reg(regs, reg_addr); 51 52 offset = addr & 0x7UL; 53 addr &= ~0x7UL; 54 55 data = *(unsigned long*)addr; 56 57#ifndef __AARCH64EB__ 58 data >>= 8 * offset; 59#else 60 data <<= 8 * offset; 61#endif 62 63 pt_regs_write_reg(regs, reg_data, data); 64 65 regs->pc = get_ex_fixup(ex); 66 return true; 67} 68 |
|
42bool fixup_exception(struct pt_regs *regs) 43{ 44 const struct exception_table_entry *ex; 45 46 ex = search_exception_tables(instruction_pointer(regs)); 47 if (!ex) 48 return false; 49 50 switch (ex->type) { 51 case EX_TYPE_FIXUP: 52 return ex_handler_fixup(ex, regs); 53 case EX_TYPE_BPF: 54 return ex_handler_bpf(ex, regs); 55 case EX_TYPE_UACCESS_ERR_ZERO: 56 return ex_handler_uaccess_err_zero(ex, regs); | 69bool fixup_exception(struct pt_regs *regs) 70{ 71 const struct exception_table_entry *ex; 72 73 ex = search_exception_tables(instruction_pointer(regs)); 74 if (!ex) 75 return false; 76 77 switch (ex->type) { 78 case EX_TYPE_FIXUP: 79 return ex_handler_fixup(ex, regs); 80 case EX_TYPE_BPF: 81 return ex_handler_bpf(ex, regs); 82 case EX_TYPE_UACCESS_ERR_ZERO: 83 return ex_handler_uaccess_err_zero(ex, regs); |
84 case EX_TYPE_LOAD_UNALIGNED_ZEROPAD: 85 return ex_handler_load_unaligned_zeropad(ex, regs); |
|
57 } 58 59 BUG(); 60} | 86 } 87 88 BUG(); 89} |