std: check if TCS is a null pointer
This commit is contained in:
parent
9358d09a55
commit
2fa58080cb
1 changed files with 6 additions and 2 deletions
|
@ -7,7 +7,11 @@ use fortanix_sgx_abi::Tcs;
|
|||
#[unstable(feature = "sgx_platform", issue = "56975")]
|
||||
pub fn current() -> Tcs {
|
||||
extern "C" {
|
||||
fn get_tcs_addr() -> Tcs;
|
||||
fn get_tcs_addr() -> *mut u8;
|
||||
}
|
||||
let addr = unsafe { get_tcs_addr() };
|
||||
match Tcs::new(addr) {
|
||||
Some(tcs) => tcs,
|
||||
None => rtabort!("TCS must not be placed at address zero (this is a linker error)"),
|
||||
}
|
||||
unsafe { get_tcs_addr() }
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue