pub fn standard_load(filename: &str, base_path: Option<PathBuf>) -> Result<Driver> {
        let mut elf_linker = ElfLinkerBuilder::new(filename.into())
            .do_relocations(false)
            .just_interpreter(true);

        if let Some(ref base_path) = base_path {
            let paths = vec![base_path.to_path_buf()];
            elf_linker = elf_linker.ld_paths(Some(paths));
        }

        let elf_linker = elf_linker.link()?;

        let architecture = elf_linker.architecture();
        let endian = architecture.endian();

        // To figure out where we start, we need to check and see if this ELF
        // has an interpreter entry. If it does, we use that as the address for
        // program entry. Otherwise, we start at the designated binary's entry
        // point.
        let entry = elf_linker
            .get_interpreter()?
            .map(|elf| elf.base_address() + elf.elf().header.e_entry)
            .unwrap_or_else(|| elf_linker.program_entry());

        let mut program = il::Program::new();
        let function = elf_linker.function(entry)?;
        program.add_function(function);

        let program_location = {
            let program_location = il::RefProgramLocation::from_address(&program, entry)
                .ok_or(format!("Failed  to get program location for 0x{:x}", entry))?;
            let program_location: il::ProgramLocation = program_location.into();
            program_location
        };

        let amd64_linux = Amd64 {
            linux: Linux::new(&elf_linker, base_path, &AMD64_LINUX_CONSTANTS)?,
            fake_ino: 0,
        };
        let backing = elf_linker.memory()?;
        let memory = Memory::new_with_backing(endian, RC::new(backing));
        let state = State::new(memory, Box::new(amd64_linux));

        let state = Amd64::initialize(state, &elf_linker)?;

        Ok(Driver::new(
            program,
            program_location,
            state,
            RC::new(architecture.box_clone()),
        ))
    }
/// Create a standard driver, set up with a Amd64 Platform, and everything
/// initialized.
Create a standard driver, set up with a Amd64 Platform, and everything
initialized.
Create a standard driver set up with a Amd64 Platform and everything initialized .
pub fn standard_load(filename: &str, base_path: Option<PathBuf>) -> Result<Driver> {
        let mut elf_linker = ElfLinkerBuilder::new(filename.into())
            .do_relocations(false)
            .just_interpreter(true);
        if let Some(ref base_path) = base_path {
            let paths = vec![base_path.to_path_buf()];
            elf_linker = elf_linker.ld_paths(Some(paths));
        }
        let elf_linker = elf_linker.link()?;
        let architecture = elf_linker.architecture();
        let endian = architecture.endian();
        // To figure out where we start, we need to check and see if this ELF
        // has an interpreter entry. If it does, we use that as the address for
        // program entry. Otherwise, we start at the designated binary's entry
        // point.
        let entry = elf_linker
            .get_interpreter()?
            .map(|elf| elf.base_address() + elf.elf().header.e_entry)
            .unwrap_or_else(|| elf_linker.program_entry());
        let mut program = il::Program::new();
        let function = elf_linker.function(entry)?;
        program.add_function(function);
        let program_location = {
            let program_location = il::RefProgramLocation::from_address(&program, entry)
                .ok_or(format!("Failed  to get program location for 0x{:x}", entry))?;
            let program_location: il::ProgramLocation = program_location.into();
            program_location
        };
        let amd64_linux = Amd64 {
            linux: Linux::new(&elf_linker, base_path, &AMD64_LINUX_CONSTANTS)?,
            fake_ino: 0,
        };
        let backing = elf_linker.memory()?;
        let memory = Memory::new_with_backing(endian, RC::new(backing));
        let state = State::new(memory, Box::new(amd64_linux));
        let state = Amd64::initialize(state, &elf_linker)?;
        Ok(Driver::new(
            program,
            program_location,
            state,
            RC::new(architecture.box_clone()),
        ))
    }
pub fn standard_load ( filename : & str , base_path : Option < PathBuf > ) -> Result < Driver > { let mut elf_linker = ElfLinkerBuilder :: new ( filename . into ( ) ) . do_relocations ( false ) . just_interpreter ( true ) ; if let Some ( ref base_path ) = base_path { let paths = vec ! [ base_path to_path_buf ( ) ] ; elf_linker = elf_linker . ld_paths ( Some ( paths ) ) ; } let elf_linker = elf_linker . link ( ) ? ; let architecture = elf_linker . architecture ( ) ; let endian = architecture . endian ( ) ; // To figure out where we start, we need to check and see if this ELF // has an interpreter entry. If it does, we use that as the address for // program entry. Otherwise, we start at the designated binary's entry // point. let entry = elf_linker . get_interpreter ( ) ? . map ( | elf | elf . base_address ( ) + elf . elf ( ) . header . e_entry ) . unwrap_or_else ( | | elf_linker . program_entry ( ) ) ; let mut program = il :: Program :: new ( ) ; let function = elf_linker . function ( entry ) ? ; program . add_function ( function ) ; let program_location = { let program_location = il :: RefProgramLocation :: from_address ( & program , entry ) . ok_or ( format ! ( " " entry ) ) ? ; let program_location : il :: ProgramLocation = program_location . into ( ) ; program_location } ; let amd64_linux = Amd64 { linux : Linux :: new ( & elf_linker , base_path , & AMD64_LINUX_CONSTANTS ) ? , fake_ino : 0 , } ; let backing = elf_linker . memory ( ) ? ; let memory = Memory :: new_with_backing ( endian , RC :: new ( backing ) ) ; let state = State :: new ( memory , Box :: new ( amd64_linux ) ) ; let state = Amd64 :: initialize ( state , & elf_linker ) ? ; Ok ( Driver :: new ( program , program_location , state , RC :: new ( architecture . box_clone ( ) ) , ) ) }
Create a standard driver, set up with a Amd64 Platform, and everything
initialized.
Create a standard driver set up with a Amd64 Platform and everything initialized .
filename
&str
base_path
Option<PathBuf>