Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
aa7e3a5
Documentation
arch
alpha
arc
boot
configs
include
kernel
.gitignore
Makefile
arc_hostlink.c
arcksyms.c
asm-offsets.c
ctx_sw.c
ctx_sw_asm.S
devtree.c
disasm.c
entry-arcv2.S
entry-compact.S
entry.S
fpu.c
head.S
intc-arcv2.c
intc-compact.c
irq.c
kgdb.c
kprobes.c
mcip.c
module.c
pcibios.c
perf_event.c
process.c
ptrace.c
reset.c
setup.c
signal.c
smp.c
stacktrace.c
sys.c
traps.c
troubleshoot.c
unaligned.c
unwind.c
vmlinux.lds.S
lib
mm
oprofile
plat-axs10x
plat-eznps
plat-hsdk
plat-sim
plat-tb10x
Kbuild
Kconfig
Kconfig.debug
Makefile
arm
arm64
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
metag
microblaze
mips
mn10300
nios2
openrisc
parisc
powerpc
s390
score
sh
sparc
tile
um
unicore32
x86
xtensa
.gitignore
Kconfig
block
certs
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
arch
/
arc
/
kernel
/
traps.c
Blame
Blame
Latest commit
History
History
157 lines (133 loc) · 3.98 KB
Breadcrumbs
linux
/
arch
/
arc
/
kernel
/
traps.c
Top
File metadata and controls
Code
Blame
157 lines (133 loc) · 3.98 KB
Raw
/* * Traps/Non-MMU Exception handling for ARC * * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * vineetg: May 2011 * -user-space unaligned access emulation * * Rahul Trivedi: Codito Technologies 2004 */ #include <linux/sched/signal.h> #include <linux/kdebug.h> #include <linux/uaccess.h> #include <linux/ptrace.h> #include <linux/kprobes.h> #include <linux/kgdb.h> #include <asm/setup.h> #include <asm/unaligned.h> #include <asm/kprobes.h> void __init trap_init(void) { return; } void die(const char *str, struct pt_regs *regs, unsigned long address) { show_kernel_fault_diag(str, regs, address); /* DEAD END */ __asm__("flag 1"); } /* * Helper called for bulk of exceptions NOT needing specific handling * -for user faults enqueues requested signal * -for kernel, chk if due to copy_(to|from)_user, otherwise die() */ static noinline int unhandled_exception(const char *str, struct pt_regs *regs, siginfo_t *info) { if (user_mode(regs)) { struct task_struct *tsk = current; tsk->thread.fault_address = (__force unsigned int)info->si_addr; force_sig_info(info->si_signo, info, tsk); } else { /* If not due to copy_(to|from)_user, we are doomed */ if (fixup_exception(regs)) return 0; die(str, regs, (unsigned long)info->si_addr); } return 1; } #define DO_ERROR_INFO(signr, str, name, sicode) \ int name(unsigned long address, struct pt_regs *regs) \ { \ siginfo_t info = { \ .si_signo = signr, \ .si_errno = 0, \ .si_code = sicode, \ .si_addr = (void __user *)address, \ }; \ return unhandled_exception(str, regs, &info);\ } /* * Entry points for exceptions NOT needing specific handling */ DO_ERROR_INFO(SIGILL, "Priv Op/Disabled Extn", do_privilege_fault, ILL_PRVOPC) DO_ERROR_INFO(SIGILL, "Invalid Extn Insn", do_extension_fault, ILL_ILLOPC) DO_ERROR_INFO(SIGILL, "Illegal Insn (or Seq)", insterror_is_error, ILL_ILLOPC) DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", __weak do_memory_error, BUS_ADRERR) DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT) DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN) /* * Entry Point for Misaligned Data access Exception, for emulating in software */ int do_misaligned_access(unsigned long address, struct pt_regs *regs, struct callee_regs *cregs) { /* If emulation not enabled, or failed, kill the task */ if (misaligned_fixup(address, regs, cregs) != 0) return do_misaligned_error(address, regs); return 0; } /* * Entry point for miscll errors such as Nested Exceptions * -Duplicate TLB entry is handled seperately though */ void do_machine_check_fault(unsigned long address, struct pt_regs *regs) { die("Unhandled Machine Check Exception", regs, address); } /* * Entry point for traps induced by ARCompact TRAP_S <n> insn * This is same family as TRAP0/SWI insn (use the same vector). * The only difference being SWI insn take no operand, while TRAP_S does * which reflects in ECR Reg as 8 bit param. * Thus TRAP_S <n> can be used for specific purpose * -1 used for software breakpointing (gdb) * -2 used by kprobes */ void do_non_swi_trap(unsigned long address, struct pt_regs *regs) { unsigned int param = regs->ecr_param; switch (param) { case 1: trap_is_brkpt(address, regs); break; case 2: trap_is_kprobe(address, regs); break; case 3: case 4: kgdb_trap(regs); break; default: break; } } /* * Entry point for Instruction Error Exception * -For a corner case, ARC kprobes implementation resorts to using * this exception, hence the check */ void do_insterror_or_kprobe(unsigned long address, struct pt_regs *regs) { int rc; /* Check if this exception is caused by kprobes */ rc = notify_die(DIE_IERR, "kprobe_ierr", regs, address, 0, SIGILL); if (rc == NOTIFY_STOP) return; insterror_is_error(address, regs); }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
You can’t perform that action at this time.