kernel/arm: detect read/write access in data abort handler
Use Data Fault Status Register's bit 11 to initialize isWrite. see: ARMv7 Architecture Reference Manual,section B3.9.5 Distinguishing read and write accesses on Data Abort exceptions Change-Id: I7da6702fc0e9579e5cb09cba3c5c89f004ec268a Reviewed-on: https://review.haiku-os.org/c/haiku/+/4972 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Jérôme Duval <[email protected]> Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
24b174f4f9
commit
4ddef6e701
@@ -1,4 +1,7 @@
|
||||
/*
|
||||
* Copyright 2022, Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2010, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@@ -8,5 +11,6 @@
|
||||
|
||||
#define SPINLOCK_PAUSE() do {} while (false)
|
||||
|
||||
#define FSR_WNR 0x800
|
||||
|
||||
#endif /* _SYSTEM_ARCH_ARM_DEFS_H */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2021, Haiku Inc. All rights reserved.
|
||||
* Copyright 2003-2022, Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <int.h>
|
||||
|
||||
#include <arch_cpu_defs.h>
|
||||
#include <arch/smp.h>
|
||||
#include <boot/kernel_args.h>
|
||||
#include <device_manager.h>
|
||||
@@ -245,13 +246,14 @@ arch_arm_data_abort(struct iframe *frame)
|
||||
{
|
||||
Thread *thread = thread_get_current_thread();
|
||||
bool isUser = (frame->spsr & 0x1f) == 0x10;
|
||||
int32 fsr = arm_get_fsr();
|
||||
addr_t far = arm_get_far();
|
||||
bool isWrite = true;
|
||||
bool isWrite = (fsr & FSR_WNR) == FSR_WNR;
|
||||
addr_t newip = 0;
|
||||
|
||||
#ifdef TRACE_ARCH_INT
|
||||
print_iframe("Data Abort", frame);
|
||||
dprintf("FAR: %08lx, thread: %s\n", far, thread->name);
|
||||
dprintf("FAR: %08lx, isWrite: %d, thread: %s\n", far, isWrite, thread->name);
|
||||
#endif
|
||||
|
||||
IFrameScope scope(frame);
|
||||
|
||||
Reference in New Issue
Block a user