diff options
| author | Ralf Jung <post@ralfj.de> | 2024-05-04 22:50:46 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-05-04 22:50:51 +0200 |
| commit | 745e3f224cb779f46c814eceb246839e01eaea57 (patch) | |
| tree | 7f8111cff05e4ebe5beeefc4fabf5064112b1e00 | |
| parent | 85e061af8f5fdee70627515998721be38c9d8e3c (diff) | |
make ExitProcess Windows-only
| -rw-r--r-- | src/tools/miri/src/shims/foreign_items.rs | 10 | ||||
| -rw-r--r-- | src/tools/miri/src/shims/windows/foreign_items.rs | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/tools/miri/src/shims/foreign_items.rs b/src/tools/miri/src/shims/foreign_items.rs index 954405de863..c51a27b7458 100644 --- a/src/tools/miri/src/shims/foreign_items.rs +++ b/src/tools/miri/src/shims/foreign_items.rs @@ -405,14 +405,8 @@ trait EvalContextExtPriv<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { } // Aborting the process. - "exit" | "ExitProcess" => { - let exp_abi = if link_name.as_str() == "exit" { - 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 + "exit" => { + let [code] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; let code = this.read_scalar(code)?.to_i32()?; throw_machine_stop!(TerminationInfo::Exit { code: code.into(), leak_check: false }); } diff --git a/src/tools/miri/src/shims/windows/foreign_items.rs b/src/tools/miri/src/shims/windows/foreign_items.rs index 92676e1b99b..dba5b7a906f 100644 --- a/src/tools/miri/src/shims/windows/foreign_items.rs +++ b/src/tools/miri/src/shims/windows/foreign_items.rs @@ -506,6 +506,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { } // 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" => { // This is really 'RtlGenRandom'. let [ptr, len] = |
