make ExitProcess Windows-only

This commit is contained in:
Ralf Jung 2024-05-04 22:50:46 +02:00
parent 85e061af8f
commit 745e3f224c
2 changed files with 8 additions and 8 deletions

View File

@ -405,14 +405,8 @@ trait EvalContextExtPriv<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
} }
// Aborting the process. // Aborting the process.
"exit" | "ExitProcess" => { "exit" => {
let exp_abi = if link_name.as_str() == "exit" { let [code] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
Abi::C { unwind: false }
} else {
Abi::System { unwind: false }
};
let [code] = this.check_shim(abi, exp_abi, link_name, args)?;
// it's really u32 for ExitProcess, but we have to put it into the `Exit` variant anyway
let code = this.read_scalar(code)?.to_i32()?; let code = this.read_scalar(code)?.to_i32()?;
throw_machine_stop!(TerminationInfo::Exit { code: code.into(), leak_check: false }); throw_machine_stop!(TerminationInfo::Exit { code: code.into(), leak_check: false });
} }

View File

@ -506,6 +506,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
} }
// Miscellaneous // Miscellaneous
"ExitProcess" => {
let [code] =
this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?;
let code = this.read_scalar(code)?.to_u32()?;
throw_machine_stop!(TerminationInfo::Exit { code: code.into(), leak_check: false });
}
"SystemFunction036" => { "SystemFunction036" => {
// This is really 'RtlGenRandom'. // This is really 'RtlGenRandom'.
let [ptr, len] = let [ptr, len] =