=== This template file contains questions you need to answer. === Fill your answers on appropriate blank lines only. === Don't start any line with three equal signs "===". === Don't edit any lines starting from three equal signs. === Use C notation to write numbers: 42 for decimal, 0x2a for hexadecimal. === We may check most of the answers automatically, so "forty two" or === "26+16" won't work for this example. Spaces are mostly ignored, so === " 42 " is OK (without quotes of course). === When asked to specify address & instruction, do it in the form of === gdb output "ADDRESS: INSTRUCTION", for example "0x7c26: or $0x1,%eax" === Don't make lines longer than 80 characters. You don't need to fit your === answer in a single line, you can start a new line at will. === However, when asked to fill "a table" make each table raw a single line. === Q What's the purpose of leaving virtual memory region === 0xeebfe000-0xeec00000 inaccessible? === (free form, up to 10 words) === Q What's the value of vpd global variable? === Q Consider virtual address V=0xeffbfefc which is mapped to some === physical address P. Assume TLB is empty and kernel performs read === from V. How many times P is accessed? Hint: V is not an arbitrary === address. === Q Denote your answer to the previous question as X. Imagine that === we've asked the same question for some V2 and the answer was X2. If === it's possible that X2>X, write an example V2, otherwise, write "NO". === For example, if your previous answer is 100, for which V2 the === answer could be 101 or greater? === Q What's the size (in bytes) of pp_link entry in struct Page? === Q Define a segment descriptor with the following properties: === segment present in memory, spans 0x12345600-0x3579c5ff (linear) === addresses and intended to be used by application. All bits which === are not responsible for above properties are set to zero. === (in the form WORD1 WORD2 as would be output by gdb's x/2x) === Q Define a page table entry with the following properties: === frame starts at 0x1234000. It can be written by the kernel === without causing any errors, but has never been written yet. On === the other hand, application cannot write to the page, but has === recently successfully read from it. All bits which are not === responsible for above properties are set to zero. === (a single memory WORD as would be output by gdb's x/1x) === Q Consider JOS kernel code: === mystery_t x; === char* value = return_a_pointer(); === *value = 10; === x = (mystery_t) value; === What type mystery_t should refer to? === (remove leading "====" from the correct answer line) ==== uintptr_t ==== physaddr_t === Q What information is stored in page directory when i386_vm_init() === finishes? For each non-empty PD entry specify: === - decimal index (0-1023) === - hexadecimal address of virtual memory mapped by this entry === - name of kernel data structure which is intended to be === accessible through this PDE (when appropriate, in quotes) === - general name (free form, up to 10 words in quotes) === Sort the table by the index in ascending order. If several === consequent entries are only differ in address field, you can === specify ellipses ("...") instead of an "inner" entries. Please === align columns into readable table using spaces. === Format example (all the values are made up; omit the header): === INDEX ADDRESS DATA-STRUCTURE NAME/DESCRIPTION === 24 0x12345 "struct Segdesc gdt[]" "Global descriptor table" === ... === 42 0x98765 "struct Segdesc gdt[]" "Global descriptor table" === 50 0x00011 "" "boot loader code" === Q What is the first instruction which would be "broken" if === i386_vm_init() wouldn't remap PDE 0? (address & instruction) === Q Can this instruction be "fixed" (i.e. replaced by another === instruction which would produce the desired effect)? === If yes, write the "fixed" instruction, otherwise write NO. === Q Propose two ways to change i386_vm_init() (or other places) to === support JOS kernel bigger than 4MB. === Way 1 (free form, up to 40 words, don't need to use all 40!) === Way 2 (free form, up to 40 words, don't need to use all 40!) === Q Which virtual addresses are readable by the user? === (in the form ADDR1-ADDR2, if none, specify NONE) === Q Which virtual addresses are writable by the user? === (in the form ADDR1-ADDR2, if none, specify NONE) === Q Assume a hacker can change N bits inside page table (on any === level, PD or PT) after it has been set up by the kernel (and === before full TLB flush). What is the minimal N to gain full === control of the system from hacker's user space process? === Q What's the maximum amount of physical memory this kernel can === support? (number of megabytes, without MB suffix) === Q What single constant can be changed in kernel source to make === this limit 2 times lower (if kernel normally supports 10MB, === we want to make it support only 5MB? === Q What value should this constant be changed to? === Q Assume the computer has the maximum amount of memory supported === by the (unmodified) kernel. What's the overhead of managing this === memory in terms of (physical) memory spent? === Specify only data structures which size depends on the amount of === physical memory and exclude the "fixed" overhead. For example, === if data structure size is 123K+0.01*(memory size) and maximum === amount of memory is 100MB, specify 0.01*100MB = 1024KB. === For each such data structure specify: === - size in KB (without "KB suffix") === - name of kernel data structure (when appropriate, in quotes) === - general name (free form, up to 10 words in quotes) === Sort the table by the size in ascending order. Please === align columns into readable table using spaces. === Format example (all the values are made up; omit the header): === SIZE DATA-STRUCTURE NAME/DESCRIPTION === 42 "struct Segdesc gdt[]" "Global descriptor table" ==================================================================== === Q What challenge(s) have you chosen to implement? (specify === challenge numbers separated by spaces, if more than one) === Q If the challenge requires changing the kernel source, list the === files which you have changed/added during implementation. === (one file per line, relative to lab directory containing .git/) === Q Describe you solution. === (free form, up to 500 words, don't need to use all 500!)