Skip to content

Commit 9d69154

Browse files
Relocate GetCurrentProcessId to Environment Related shims, remove unnecessary std frame restriction
1 parent b280af4 commit 9d69154

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
138138
let result = this.GetUserProfileDirectoryW(token, buf, size)?;
139139
this.write_scalar(result, dest)?;
140140
}
141+
"GetCurrentProcessId" => {
142+
let [] = this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?;
143+
let result = this.GetCurrentProcessId()?;
144+
this.write_int(result, dest)?;
145+
}
141146

142147
// File related shims
143148
"NtWriteFile" => {
@@ -743,11 +748,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
743748
// Any non zero value works for the stdlib. This is just used for stack overflows anyway.
744749
this.write_int(1, dest)?;
745750
}
746-
"GetCurrentProcessId" if this.frame_in_std() => {
747-
let [] = this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?;
748-
let result = this.GetCurrentProcessId()?;
749-
this.write_int(result, dest)?;
750-
}
751751
// this is only callable from std because we know that std ignores the return value
752752
"SwitchToThread" if this.frame_in_std() => {
753753
let [] = this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?;

0 commit comments

Comments
 (0)