Need help with mips assembly language problems. 1. Assume the following data seg
ID: 3591718 • Letter: N
Question
Need help with mips assembly language problems.
1.
Assume the following data segment declarations and that the label mem1 represents the address 0xA0000008.
.data
mem1: .word 0
mem2: .space 2
mem3: .word 4
Answer the following using hex notation:
a) What is the virtual address of mem2? the physical address?
b) What is the virtual address of mem3? the physical address?
2.
Assume the following data segment declarations and that the label mem1 represents the address 0xA0000020.
.data
mem1: .space 2
mem2: .byte 0x45
mem3: .word 6
Answer the following:
a) What is the virtual address of mem2? the physical address?
b) What is the virtual address of mem3? the physical address?
3.
Assume the following data segment declarations and that the label mem1 represents the address 0xA0000020.
.data
mem1: .half 0x1234
mem2: .space 5
mem3: .byte 6
Answer the following:
a) What is the virtual address of mem2?
b) What is the virtual address of mem3?
4.
Assume the following data segment declarations and that the label mem1 represents the address 0xA0000020.
.data
mem1: .word 0x12
mem2: .space 3
mem3: .half 0x4
Answer the following:
a) What is the virtual address of mem2?
b) What is the virtual address of mem3?
Explanation / Answer
.828 2011 Lecture 3: virtual memory main topic: virtual memory (VM) how the kernel controls what memory addresses mean traditional basis for memory multiplexing and protection source of many neat tricks (later) you'll play with VM a lot in the labs though JOS uses VM quite differently than xv6 state of play we were powering on ("booting") the machine nothing in RAM, need to read kernel from disk BIOS copied first ("boot") sector to 0x7c00 in mem boot sector = bootasm.S + bootmain.c executing at end of bootasm.S stack below 0x7c00, so we can call into C call bootmain bootmain (sheet 83) two jobs: 1. copy kernel from disk to mem 2. jump to kernel's first instruction where is the kernel on disk? starts at 2nd sector of disk 0, just after boot sector [diagram of disk] *not* in a file; written directly to the raw disk what format? the result of running the compiler and linker on xv6 source they produce instructions+data, in machine format linker writes a file in ELF format (same as the JOS kernel) ELF headers indicate offset and size of data and the start address! to where in memory should bootmem copy the kernel? where to store it -- in DRAM -- physical memory bootmain loads kernel starting at 0x100000 [diagram of phys mem] why 0x100000? that's 1 MB why not 0x0? there are memory-mapped devices at phys addrs < 1 MB why not somewhere else, e.g. at 2 MB? that would work too it actually doesn't matter much where bootmain loads the kernel! b/c kernel will use VM hardware to put itself at predictable virt addr only real constraints on where bootmain loads the kernel: 1. there must be DRAM at that phys addr 2. kernel must be able to find itself after it starts 0x100000 satisfies both those constraintsRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.