Skip to content

Commit d3d6405

Browse files
Ὀσυμανδύαςlabbott
authored andcommitted
LOOK ON MY REFORMAT, YE MIGHTY, AND DESPAIR!
1 parent de75b53 commit d3d6405

File tree

1 file changed

+34
-27
lines changed

1 file changed

+34
-27
lines changed

kern/src/arch/arm_m.rs

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,8 @@ pub fn reinitialize(task: &mut task::Task) {
326326
// TODO: this assumes availability of an FPU.
327327
// Use checked operations to get a reference to the exception frame.
328328
let frame_size = core::mem::size_of::<ExtendedExceptionFrame>();
329-
let mut uslice: USlice<ExtendedExceptionFrame> = USlice::from_raw(
330-
initial_stack as usize - frame_size,
331-
1,
332-
)
333-
.unwrap();
329+
let mut uslice: USlice<ExtendedExceptionFrame> =
330+
USlice::from_raw(initial_stack as usize - frame_size, 1).unwrap();
334331
uassert!(task.can_write(&uslice));
335332

336333
// Before we set our frame, find the region that contains our initial stack
@@ -1090,7 +1087,7 @@ bitflags::bitflags! {
10901087
unsafe extern "C" fn handle_fault(
10911088
task: *mut task::Task,
10921089
fault_type: FaultType,
1093-
fpsave: *mut u32
1090+
fpsave: *mut u32,
10941091
) {
10951092
// To diagnose the fault, we're going to need access to the System Control
10961093
// Block. Pull such access from thin air.
@@ -1125,41 +1122,51 @@ unsafe extern "C" fn handle_fault(
11251122
// fact that the user's stack pointer is so trashed that we
11261123
// can't store through it. (In particular, we seem to have no
11271124
// way at getting at our faulted PC.)
1128-
(FaultInfo::StackOverflow {
1129-
address: (*task).save().psp,
1130-
}, true)
1125+
(
1126+
FaultInfo::StackOverflow {
1127+
address: (*task).save().psp,
1128+
},
1129+
true,
1130+
)
11311131
} else if cfsr.contains(Cfsr::IACCVIOL) {
11321132
(FaultInfo::IllegalText, false)
11331133
} else {
1134-
(FaultInfo::MemoryAccess {
1135-
address: if cfsr.contains(Cfsr::MMARVALID) {
1136-
Some(scb.mmfar.read())
1137-
} else {
1138-
None
1134+
(
1135+
FaultInfo::MemoryAccess {
1136+
address: if cfsr.contains(Cfsr::MMARVALID) {
1137+
Some(scb.mmfar.read())
1138+
} else {
1139+
None
1140+
},
1141+
source: FaultSource::User,
11391142
},
1140-
source: FaultSource::User,
1141-
}, false)
1143+
false,
1144+
)
11421145
}
11431146
}
11441147

1145-
FaultType::BusFault => (FaultInfo::BusError {
1146-
address: if cfsr.contains(Cfsr::BFARVALID) {
1147-
Some(scb.bfar.read())
1148-
} else {
1149-
None
1148+
FaultType::BusFault => (
1149+
FaultInfo::BusError {
1150+
address: if cfsr.contains(Cfsr::BFARVALID) {
1151+
Some(scb.bfar.read())
1152+
} else {
1153+
None
1154+
},
1155+
source: FaultSource::User,
11501156
},
1151-
source: FaultSource::User,
1152-
}, false),
1157+
false,
1158+
),
11531159

1154-
FaultType::UsageFault => {
1155-
(if cfsr.contains(Cfsr::DIVBYZERO) {
1160+
FaultType::UsageFault => (
1161+
if cfsr.contains(Cfsr::DIVBYZERO) {
11561162
FaultInfo::DivideByZero
11571163
} else if cfsr.contains(Cfsr::UNDEFINSTR) {
11581164
FaultInfo::IllegalInstruction
11591165
} else {
11601166
FaultInfo::InvalidOperation(cfsr.bits())
1161-
}, false)
1162-
}
1167+
},
1168+
false,
1169+
),
11631170
};
11641171

11651172
// Because we are responsible for clearing all conditions, we write back

0 commit comments

Comments
 (0)