Add more output to backtrace, revert fs change, update rust-mips

Signed-off-by: Harry Chen <i@harrychen.xyz>
master
Harry Chen 6 years ago
parent d05c4cf09e
commit 48864bd79b

2
kernel/Cargo.lock generated

@ -230,7 +230,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "mips" name = "mips"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/Harry-Chen/rust-mips#8b8cbacb08aaaef93837d46599ce21759ef481de" source = "git+https://github.com/Harry-Chen/rust-mips#ec0c31e18a904536ffa19bbd1f5d0d0fd19b2cd1"
dependencies = [ dependencies = [
"bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",

@ -298,7 +298,7 @@ else ifeq ($(arch), riscv64)
else ifeq ($(arch), aarch64) else ifeq ($(arch), aarch64)
@$(objcopy) $(bootloader) --strip-all -O binary $@ @$(objcopy) $(bootloader) --strip-all -O binary $@
else ifeq ($(arch), mipsel) else ifeq ($(arch), mipsel)
# qemu-system-mipsel accepts ELF file only, so don't use objcopy # qemu-system-mipsel accepts ELF file only, so objcopy is not needed
@$(strip) $(kernel) -o $@ @$(strip) $(kernel) -o $@
endif endif

@ -73,6 +73,8 @@ pub fn backtrace() {
current_fp = ((current_fp as isize) - sp_offset) as usize; current_fp = ((current_fp as isize) - sp_offset) as usize;
} }
println!("=== BEGIN rCore stack trace ===");
while current_pc >= stext as usize while current_pc >= stext as usize
&& current_pc <= etext as usize && current_pc <= etext as usize
&& current_fp as usize != 0 && current_fp as usize != 0
@ -81,7 +83,7 @@ pub fn backtrace() {
match size_of::<usize>() { match size_of::<usize>() {
4 => { 4 => {
println!( println!(
"Stack #{:02} PC: {:#010X} FP: {:#010X}", "#{:02} PC: {:#010X} FP: {:#010X}",
stack_num, stack_num,
current_pc - size_of::<usize>(), current_pc - size_of::<usize>(),
current_fp current_fp
@ -89,7 +91,7 @@ pub fn backtrace() {
}, },
_ => { _ => {
println!( println!(
"Stack #{:02} PC: {:#018X} FP: {:#018X}", "#{:02} PC: {:#018X} FP: {:#018X}",
stack_num, stack_num,
current_pc - size_of::<usize>(), current_pc - size_of::<usize>(),
current_fp current_fp
@ -143,6 +145,7 @@ pub fn backtrace() {
trace!("New PC {:08X} FP {:08X}", current_pc, current_fp); trace!("New PC {:08X} FP {:08X}", current_pc, current_fp);
continue; continue;
} else { } else {
trace!("No sw ra found, probably due to optimizations.");
break; break;
} }
} }
@ -159,5 +162,6 @@ pub fn backtrace() {
current_pc = *(current_fp as *const usize).offset(1); current_pc = *(current_fp as *const usize).offset(1);
} }
} }
println!("=== END rCore stack trace ===");
} }
} }

@ -54,7 +54,7 @@ lazy_static! {
fn _user_img_start(); fn _user_img_start();
fn _user_img_end(); fn _user_img_end();
} }
println!("Sfs start {:x}, end {:x}", _user_img_start as usize, _user_img_end as usize); info!("SFS linked to kernel, from {:08x} to {:08x}", _user_img_start as usize, _user_img_end as usize);
Arc::new(unsafe { device::MemBuf::new(_user_img_start, _user_img_end) }) Arc::new(unsafe { device::MemBuf::new(_user_img_start, _user_img_end) })
}; };
@ -66,13 +66,7 @@ lazy_static! {
Arc::new(unsafe { device::MemBuf::new(_user_img_start, _user_img_end) }) Arc::new(unsafe { device::MemBuf::new(_user_img_start, _user_img_end) })
}; };
let super_block = SimpleFileSystem::read(device2);
println!("Superblock: magic = {:x}, freemap_blocks = {:x}", super_block.magic, super_block.freemap_blocks);
println!("blocks = {:}", super_block.blocks);
println!("unused_blocks = {:}", super_block.unused_blocks);
let sfs = SimpleFileSystem::open(device).expect("failed to open SFS"); let sfs = SimpleFileSystem::open(device).expect("failed to open SFS");
// println!("{:}", sfs.free_map.read());
sfs.root_inode() sfs.root_inode()
}; };
} }

Loading…
Cancel
Save