Skip to content
This repository was archived by the owner on Oct 26, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ fn find_files_with_extensions<'a>(
.map(|x| x.path().to_owned())
}

fn rerun_src(path: impl AsRef<Path>) -> std::io::Result<()> {
fn rerun_src(path: impl AsRef<Path>) {
for entry in find_files_with_extensions(&["rs", "s", "S"], &path) {
if let Some(path) = entry.to_str() {
println!("cargo:rerun-if-changed={}", path)
}
}

Ok(())
}

fn build_rs_tests(in_path: &Path, out_path: &Path) {
Expand Down Expand Up @@ -196,7 +194,7 @@ fn main() {
println!("cargo:rerun-if-changed={}/Cargo.lock", path);
println!("cargo:rerun-if-changed={}/.cargo/config", path);

rerun_src(&path).unwrap();
rerun_src(&path);

if !shim_name.starts_with("shim-") {
continue;
Expand Down
7 changes: 3 additions & 4 deletions internal/shim-sev/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fn crt0setup(
app_virt_start: VirtAddr,
stack_slice: &'static mut [u8],
header: &Header,
) -> Result<(VirtAddr, u64), ()> {
) -> (VirtAddr, u64) {
let mut builder = Builder::new(stack_slice);
builder.push("/init").unwrap();
let mut builder = builder.done().unwrap();
Expand Down Expand Up @@ -175,7 +175,7 @@ fn crt0setup(
let handle = builder.done().unwrap();
let sp = &*handle as *const _ as u64;

Ok((ph_entry, sp))
(ph_entry, sp)
}

/// execute the payload
Expand All @@ -188,8 +188,7 @@ pub fn execute_payload() -> ! {
PageTableFlags::USER_ACCESSIBLE,
);

let (entry, sp_handle) =
crt0setup(*PAYLOAD_VIRT_ADDR.read(), stack.slice, header).expect("crt0setup failed");
let (entry, sp_handle) = crt0setup(*PAYLOAD_VIRT_ADDR.read(), stack.slice, header);

unsafe {
usermode(entry.as_u64(), sp_handle);
Expand Down
1 change: 0 additions & 1 deletion internal/shim-sev/src/usermode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use x86_64::registers::rflags::RFlags;
///
/// Because the caller can give any `entry_point` and `stack_pointer`
/// including 0, this function is unsafe.
#[naked]
pub unsafe fn usermode(ip: u64, sp: u64) -> ! {
asm!("
push {USER_DATA_SEGMENT}
Expand Down
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ enum Options {
Exec(Exec),
}

#[allow(clippy::unnecessary_wraps)]
fn main() -> Result<()> {
let backends: &[Box<dyn Backend>] = &[
#[cfg(feature = "backend-sev")]
Expand All @@ -138,6 +139,7 @@ fn main() -> Result<()> {
}
}

#[allow(clippy::unnecessary_wraps)]
fn info(backends: &[Box<dyn Backend>]) -> Result<()> {
use colorful::*;

Expand Down Expand Up @@ -170,6 +172,7 @@ fn info(backends: &[Box<dyn Backend>]) -> Result<()> {
}

#[allow(unreachable_code)]
#[allow(clippy::unnecessary_wraps)]
fn exec(backends: &[Box<dyn Backend>], opts: Exec) -> Result<()> {
let keep = std::env::var_os("ENARX_BACKEND").map(|x| x.into_string().unwrap());

Expand Down