-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
114 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use rustc_span::Symbol; | ||
use rustc_target::spec::abi::Abi; | ||
|
||
use crate::shims::unix::*; | ||
use crate::*; | ||
use shims::EmulateItemResult; | ||
|
||
pub fn is_dyn_sym(_name: &str) -> bool { | ||
false | ||
} | ||
|
||
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriInterpCx<'mir, 'tcx> {} | ||
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { | ||
fn emulate_foreign_item_inner( | ||
&mut self, | ||
link_name: Symbol, | ||
abi: Abi, | ||
args: &[OpTy<'tcx, Provenance>], | ||
dest: &MPlaceTy<'tcx, Provenance>, | ||
) -> InterpResult<'tcx, EmulateItemResult> { | ||
let this = self.eval_context_mut(); | ||
match link_name.as_str() { | ||
// errno | ||
"__errno" => { | ||
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; | ||
let errno_place = this.last_error_place()?; | ||
this.write_scalar(errno_place.to_ref(this).to_scalar(), dest)?; | ||
} | ||
|
||
// Threading | ||
"pthread_condattr_setclock" => { | ||
let [attr, clock_id] = | ||
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; | ||
let result = this.pthread_condattr_setclock(attr, clock_id)?; | ||
this.write_scalar(result, dest)?; | ||
} | ||
"pthread_condattr_getclock" => { | ||
let [attr, clock_id] = | ||
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; | ||
let result = this.pthread_condattr_getclock(attr, clock_id)?; | ||
this.write_scalar(result, dest)?; | ||
} | ||
|
||
_ => return Ok(EmulateItemResult::NotSupported), | ||
} | ||
Ok(EmulateItemResult::NeedsJumping) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod foreign_items; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters