Skip to content

Commit 745e3f2

Browse files
committed
make ExitProcess Windows-only
1 parent 85e061a commit 745e3f2

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/tools/miri/src/shims/foreign_items.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -405,14 +405,8 @@ trait EvalContextExtPriv<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
405405
}
406406

407407
// Aborting the process.
408-
"exit" | "ExitProcess" => {
409-
let exp_abi = if link_name.as_str() == "exit" {
410-
Abi::C { unwind: false }
411-
} else {
412-
Abi::System { unwind: false }
413-
};
414-
let [code] = this.check_shim(abi, exp_abi, link_name, args)?;
415-
// it's really u32 for ExitProcess, but we have to put it into the `Exit` variant anyway
408+
"exit" => {
409+
let [code] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
416410
let code = this.read_scalar(code)?.to_i32()?;
417411
throw_machine_stop!(TerminationInfo::Exit { code: code.into(), leak_check: false });
418412
}

src/tools/miri/src/shims/windows/foreign_items.rs

+6
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
506506
}
507507

508508
// Miscellaneous
509+
"ExitProcess" => {
510+
let [code] =
511+
this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?;
512+
let code = this.read_scalar(code)?.to_u32()?;
513+
throw_machine_stop!(TerminationInfo::Exit { code: code.into(), leak_check: false });
514+
}
509515
"SystemFunction036" => {
510516
// This is really 'RtlGenRandom'.
511517
let [ptr, len] =

0 commit comments

Comments
 (0)