use crate::ffi::msan::*;
use std::ffi::CStr;
use std::os::raw::{c_char, c_int, c_void};
pub fn set_origin(a: *const c_void, size: usize, origin: u32) {
unsafe {
__msan_set_origin(a, size, origin);
}
}
pub fn get_origin(a: *const c_void) -> u32 {
unsafe { __msan_get_origin(a) }
}
pub fn origin_is_descendant_or_same(this_id: u32, prev_id: u32) -> bool {
unsafe { __msan_origin_is_descendant_or_same(this_id, prev_id) != 0 }
}
pub fn get_track_origins() -> c_int {
unsafe { __msan_get_track_origins() }
}
pub fn get_umr_origin() -> u32 {
unsafe { __msan_get_umr_origin() }
}
pub fn unpoison(a: *const c_void, size: usize) {
unsafe {
__msan_unpoison(a, size);
}
}
pub fn unpoison_string(a: *const c_char) {
unsafe {
__msan_unpoison_string(a);
}
}
pub fn unpoison_param(n: usize) {
unsafe {
__msan_unpoison_param(n);
}
}
pub fn poison(a: *const c_void, size: usize) {
unsafe {
__msan_poison(a, size);
}
}
pub fn test_shadow(x: *const c_void, size: usize) -> isize {
unsafe { __msan_test_shadow(x, size) }
}
pub fn check_mem_is_initialized(x: *const c_void, size: usize) {
unsafe {
__msan_check_mem_is_initialized(x, size);
}
}
pub fn set_expect_umr(expect_umr: c_int) {
unsafe {
__msan_set_expect_umr(expect_umr);
}
}
pub fn set_keep_going(keep_going: c_int) {
unsafe {
__msan_set_keep_going(keep_going);
}
}
pub fn print_shadow(x: *const c_void, size: usize) {
unsafe {
__msan_print_shadow(x, size);
}
}
pub fn dump_shadow(x: *const c_void, size: usize) {
unsafe {
__msan_dump_shadow(x, size);
}
}
pub fn has_dynamic_component() -> bool {
unsafe { __msan_has_dynamic_component() != 0 }
}
pub fn allocated_memory(data: *const c_void, size: usize) {
unsafe {
__msan_allocated_memory(data, size);
}
}
pub fn dtor_callback(data: *const c_void, size: usize) {
unsafe {
__sanitizer_dtor_callback(data, size);
}
}
pub fn dtor_callback_fields(data: *const c_void, size: usize) {
unsafe {
__sanitizer_dtor_callback_fields(data, size);
}
}
pub fn dtor_callback_vptr(data: *const c_void) {
unsafe {
__sanitizer_dtor_callback_vptr(data);
}
}
pub fn default_options() -> String {
unsafe {
let options_ptr = __msan_default_options();
if options_ptr.is_null() {
String::new()
} else {
CStr::from_ptr(options_ptr).to_string_lossy().into_owned()
}
}
}
pub fn copy_shadow(dst: *const c_void, src: *const c_void, size: usize) {
unsafe {
__msan_copy_shadow(dst, src, size);
}
}
pub fn scoped_disable_interceptor_checks() {
unsafe {
__msan_scoped_disable_interceptor_checks();
}
}
pub fn scoped_enable_interceptor_checks() {
unsafe {
__msan_scoped_enable_interceptor_checks();
}
}
pub fn start_switch_fiber(bottom: *const c_void, size: usize) {
unsafe {
__msan_start_switch_fiber(bottom, size);
}
}
pub fn finish_switch_fiber(bottom_old: *mut *const c_void, size_old: *mut usize) {
unsafe {
__msan_finish_switch_fiber(bottom_old, size_old);
}
}