Skip to content

Commit 7be7304

Browse files
authored
Update loader.rs
1 parent f2ad126 commit 7be7304

File tree

1 file changed

+2
-36
lines changed

1 file changed

+2
-36
lines changed

vm/src/elf/loader.rs

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -131,44 +131,10 @@ impl ElfFile {
131131
mod tests {
132132
use nexus_common::constants::ELF_TEXT_START;
133133

134-
use crate::{memory::MemorySegmentImage, read_testing_elf_from_path};
134+
use crate::read_testing_elf_from_path;
135135

136136
use super::*;
137-
use std::fs::File;
138-
use std::io::Write;
139-
140-
#[allow(dead_code)]
141-
fn write_instruction_to_file(instructions: &[u32], file_path: &str) {
142-
let mut file = File::create(file_path).unwrap();
143-
for &instruction in instructions {
144-
file.write_all(&instruction.to_le_bytes()).unwrap();
145-
}
146-
}
147-
148-
#[allow(dead_code)]
149-
fn write_memory_to_file(memory: &MemorySegmentImage, file_path: &str) {
150-
let mut file = File::create(file_path).unwrap();
151-
file.write_all(memory.as_byte_slice()).unwrap();
152-
}
153-
154-
#[allow(dead_code)]
155-
fn debug_elf_file(elf: &ElfFile, file_path: &str) {
156-
dbg!(elf.instructions.len());
157-
dbg!(elf.entry);
158-
dbg!(elf.base);
159-
dbg!(elf.ram_image.len_bytes());
160-
dbg!(elf.rom_image.len_bytes());
161-
162-
// Write elf.instructions to a file
163-
write_instruction_to_file(&elf.instructions, &format!("{file_path}.inst.bin"));
164-
165-
// Write elf.memory_image to a file
166-
write_memory_to_file(&elf.ram_image, &format!("{file_path}.mem.bin"));
167-
168-
// Write elf.readonly_memory_image to a file
169-
write_memory_to_file(&elf.rom_image, &format!("{file_path}.rom.bin"));
170-
}
171-
137+
172138
#[test]
173139
fn test_parse_elf_files() {
174140
// Use llvm-objdump to find what these numbers should be

0 commit comments

Comments
 (0)