Eliminate compiler warnings
This commit is contained in:
parent
280d0a885c
commit
c39b6f1dc2
@ -5,6 +5,7 @@ use self::rdtsc::{handle_rdtsc_exception, RDTSC_OPCODE};
|
|||||||
use self::syscall::{handle_syscall_exception, SYSCALL_OPCODE};
|
use self::syscall::{handle_syscall_exception, SYSCALL_OPCODE};
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::signal::{FaultSignal, SigSet};
|
use crate::signal::{FaultSignal, SigSet};
|
||||||
|
use crate::syscall::exception_interrupt_syscall_c_abi;
|
||||||
use crate::syscall::{CpuContext, FpRegs, SyscallNum};
|
use crate::syscall::{CpuContext, FpRegs, SyscallNum};
|
||||||
use aligned::{Aligned, A16};
|
use aligned::{Aligned, A16};
|
||||||
use core::arch::x86_64::_fxsave;
|
use core::arch::x86_64::_fxsave;
|
||||||
@ -26,24 +27,11 @@ pub fn register_exception_handlers() {
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
extern "C" fn handle_exception(info: *mut sgx_exception_info_t) -> i32 {
|
extern "C" fn handle_exception(info: *mut sgx_exception_info_t) -> i32 {
|
||||||
// Rust compiler would complain about passing to external C functions a CpuContext
|
|
||||||
// pointer, which includes a FpRegs pointer that is not safe to use by external
|
|
||||||
// modules. In our case, the FpRegs pointer will not be used actually. So the
|
|
||||||
// Rust warning is a false alarm. We suppress it here.
|
|
||||||
#[allow(improper_ctypes)]
|
|
||||||
extern "C" {
|
|
||||||
fn __occlum_syscall_c_abi(
|
|
||||||
num: u32,
|
|
||||||
info: *mut sgx_exception_info_t,
|
|
||||||
fpregs: *mut FpRegs,
|
|
||||||
) -> u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut fpregs = FpRegs::save();
|
let mut fpregs = FpRegs::save();
|
||||||
unsafe {
|
unsafe {
|
||||||
__occlum_syscall_c_abi(
|
exception_interrupt_syscall_c_abi(
|
||||||
SyscallNum::HandleException as u32,
|
SyscallNum::HandleException as u32,
|
||||||
info,
|
info as *mut _,
|
||||||
&mut fpregs as *mut FpRegs,
|
&mut fpregs as *mut FpRegs,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
pub use self::sgx::sgx_interrupt_info_t;
|
pub use self::sgx::sgx_interrupt_info_t;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use crate::process::ThreadRef;
|
use crate::process::ThreadRef;
|
||||||
|
use crate::syscall::exception_interrupt_syscall_c_abi;
|
||||||
use crate::syscall::{CpuContext, FpRegs, SyscallNum};
|
use crate::syscall::{CpuContext, FpRegs, SyscallNum};
|
||||||
use aligned::{Aligned, A16};
|
use aligned::{Aligned, A16};
|
||||||
use core::arch::x86_64::_fxsave;
|
use core::arch::x86_64::_fxsave;
|
||||||
@ -15,24 +16,11 @@ pub fn init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" fn handle_interrupt(info: *mut sgx_interrupt_info_t) -> i32 {
|
extern "C" fn handle_interrupt(info: *mut sgx_interrupt_info_t) -> i32 {
|
||||||
// Rust compiler would complain about passing to external C functions a CpuContext
|
|
||||||
// pointer, which includes a FpRegs pointer that is not safe to use by external
|
|
||||||
// modules. In our case, the FpRegs pointer will not be used actually. So the
|
|
||||||
// Rust warning is a false alarm. We suppress it here.
|
|
||||||
#[allow(improper_ctypes)]
|
|
||||||
extern "C" {
|
|
||||||
fn __occlum_syscall_c_abi(
|
|
||||||
num: u32,
|
|
||||||
info: *mut sgx_interrupt_info_t,
|
|
||||||
fpregs: *mut FpRegs,
|
|
||||||
) -> u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut fpregs = FpRegs::save();
|
let mut fpregs = FpRegs::save();
|
||||||
unsafe {
|
unsafe {
|
||||||
__occlum_syscall_c_abi(
|
exception_interrupt_syscall_c_abi(
|
||||||
SyscallNum::HandleInterrupt as u32,
|
SyscallNum::HandleInterrupt as u32,
|
||||||
info,
|
info as *mut _,
|
||||||
&mut fpregs as *mut FpRegs,
|
&mut fpregs as *mut FpRegs,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
#![feature(allocator_api)]
|
#![feature(allocator_api)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(stmt_expr_attributes)]
|
#![feature(stmt_expr_attributes)]
|
||||||
#![feature(atomic_min_max)]
|
|
||||||
#![feature(no_more_cas)]
|
|
||||||
#![feature(alloc_layout_extra)]
|
#![feature(alloc_layout_extra)]
|
||||||
#![feature(concat_idents)]
|
#![feature(concat_idents)]
|
||||||
#![feature(trace_macros)]
|
#![feature(trace_macros)]
|
||||||
|
@ -994,3 +994,24 @@ impl CpuContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// exception and interrupt syscalls share the same c abi
|
||||||
|
//
|
||||||
|
// num: occlum syscall number
|
||||||
|
// info: pointer to sgx_exception_info_t or sgx_interrupt_info_t
|
||||||
|
// fpregs: pointer to FpRegs. Rust compiler would complain about passing
|
||||||
|
// to external C functions a CpuContext pointer, which includes a FpRegs
|
||||||
|
// pointer that is not safe to use by external modules. In our case, the
|
||||||
|
// FpRegs pointer will not be used actually. So the Rust warning is a
|
||||||
|
// false alarm. We suppress it here.
|
||||||
|
pub unsafe fn exception_interrupt_syscall_c_abi(
|
||||||
|
num: u32,
|
||||||
|
info: *mut c_void,
|
||||||
|
fpregs: *mut FpRegs,
|
||||||
|
) -> u32 {
|
||||||
|
#[allow(improper_ctypes)]
|
||||||
|
extern "C" {
|
||||||
|
pub fn __occlum_syscall_c_abi(num: u32, info: *mut c_void, fpregs: *mut FpRegs) -> u32;
|
||||||
|
}
|
||||||
|
__occlum_syscall_c_abi(num, info, fpregs)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user