Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142299503
D50207.id155319.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D50207.id155319.diff
View Options
diff --git a/sys/arm64/arm64/undefined.c b/sys/arm64/arm64/undefined.c
--- a/sys/arm64/arm64/undefined.c
+++ b/sys/arm64/arm64/undefined.c
@@ -88,6 +88,10 @@
*/
LIST_HEAD(, undef_handler) undef_handlers =
LIST_HEAD_INITIALIZER(undef_handlers);
+#ifdef COMPAT_FREEBSD32
+LIST_HEAD(, undef_handler) undef32_handlers =
+ LIST_HEAD_INITIALIZER(undef32_handlers);
+#endif
static bool
arm_cond_match(uint32_t insn, struct trapframe *frame)
@@ -150,8 +154,7 @@
struct thread *td = curthread;
if (insn == GDB_BREAKPOINT || insn == GDB5_BREAKPOINT) {
- if (SV_PROC_FLAG(td->td_proc, SV_ILP32) &&
- va < VM_MAXUSER_ADDRESS) {
+ if (va < VM_MAXUSER_ADDRESS) {
ksiginfo_t ksi;
ksiginfo_init_trap(&ksi);
@@ -183,8 +186,7 @@
* swp, swpb only; there are no Thumb swp/swpb instructions so we can
* safely bail out if we're in Thumb mode.
*/
- if (!compat32_emul_swp || !SV_PROC_FLAG(td->td_proc, SV_ILP32) ||
- (frame->tf_spsr & PSR_T) != 0)
+ if (!compat32_emul_swp || (frame->tf_spsr & PSR_T) != 0)
return (0);
else if ((insn & 0x0fb00ff0) != 0x01000090)
return (0);
@@ -250,8 +252,8 @@
undef_init(void)
{
#ifdef COMPAT_FREEBSD32
- install_undef_handler(gdb_trapper);
- install_undef_handler(swp_emulate);
+ install_undef32_handler(gdb_trapper);
+ install_undef32_handler(swp_emulate);
#endif
}
@@ -267,6 +269,20 @@
return (uh);
}
+#ifdef COMPAT_FREEBSD32
+void *
+install_undef32_handler(undef_handler_t func)
+{
+ struct undef_handler *uh;
+
+ uh = malloc(sizeof(*uh), M_UNDEF, M_WAITOK);
+ uh->uh_handler = func;
+ LIST_INSERT_HEAD(&undef32_handlers, uh, uh_link);
+
+ return (uh);
+}
+#endif
+
void
remove_undef_handler(void *handle)
{
@@ -289,6 +305,18 @@
if (ret != 0)
return (0);
+#ifdef COMPAT_FREEBSD32
+ if (SV_PROC_FLAG(curthread->td_proc, SV_ILP32)) {
+ LIST_FOREACH(uh, &undef32_handlers, uh_link) {
+ ret = uh->uh_handler(frame->tf_elr, insn, frame,
+ frame->tf_esr);
+ if (ret)
+ return (1);
+ }
+ return (0);
+ }
+#endif
+
LIST_FOREACH(uh, &undef_handlers, uh_link) {
ret = uh->uh_handler(frame->tf_elr, insn, frame, frame->tf_esr);
if (ret)
diff --git a/sys/arm64/include/undefined.h b/sys/arm64/include/undefined.h
--- a/sys/arm64/include/undefined.h
+++ b/sys/arm64/include/undefined.h
@@ -58,6 +58,9 @@
void undef_init(void);
void *install_undef_handler(undef_handler_t);
+#ifdef COMPAT_FREEBSD32
+void *install_undef32_handler(undef_handler_t);
+#endif
void remove_undef_handler(void *);
int undef_insn(struct trapframe *);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 8:08 AM (10 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27730461
Default Alt Text
D50207.id155319.diff (2 KB)
Attached To
Mode
D50207: arm64: Split out the 32-bit undef handling
Attached
Detach File
Event Timeline
Log In to Comment