Skip to content

Commit 4d4e2cf

Browse files
committed
Simplify mprotect syscall: remove unused r0 output
The syscall return value was just sitting there looking decortaive. We only need the error flag from $a3. Note: MIPS cross-compilation is not available on this dev machine, letting CI handle the actual build verification.
1 parent e9d766c commit 4d4e2cf

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/arch/mips32.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,23 +214,21 @@ pub(super) unsafe fn relocation_store(ptr: usize, value: usize) {
214214
#[inline]
215215
pub(super) unsafe fn relocation_mprotect_readonly(ptr: usize, len: usize) {
216216
unsafe {
217-
let r0: usize;
218217
let err: usize;
219218

220219
// MIPS O32 syscall: $v0 = syscall number, $a0-$a3 = args.
221220
// Return in $v0, $a3 = 0 on success, 1 on error.
222221
asm!(
223222
".set noreorder",
224223
"syscall",
225-
"move {0}, $v0",
226-
"move {1}, $a3",
224+
"move {0}, $a3",
227225
".set reorder",
228-
out(reg) r0,
229226
out(reg) err,
230227
in("$v0") __NR_mprotect,
231228
in("$a0") ptr,
232229
in("$a1") len,
233230
in("$a2") PROT_READ,
231+
lateout("$v0") _,
234232
lateout("$a3") _,
235233
lateout("$t0") _,
236234
lateout("$t1") _,
@@ -250,7 +248,6 @@ pub(super) unsafe fn relocation_mprotect_readonly(ptr: usize, len: usize) {
250248
// yet initialized at this point.
251249
trap();
252250
}
253-
let _ = r0;
254251
}
255252
}
256253

0 commit comments

Comments
 (0)