-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab1-questionary.txt
124 lines (118 loc) · 5.02 KB
/
lab1-questionary.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
=== 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.
=== Q What is the number of the first port BIOS writes into?
0x70
=== Q What is the number of the first port BIOS reads from?
0x71
=== Q What device is probably accessed through above ports?
RTC
=== Q What instruction causes processor to switch to 32-bit mode?
=== (specify address & instruction)
0x7c2d: ljmp $PROT_MODE_CSEG, $protcseg
=== Q What's the instruction performed immediately after the processor
=== is switched to 32-bit mode? (address & instruction)
0x7c32: movw $PROT_MODE_DSEG, %ax
=== Q What is the last instruction of boot loader? (address & instruction)
0x7d61: call *0x10018
=== Q What is first instruction of the kernel? (address & instruction)
0x10000c: movw $0x1234,0x472
=== Q Where boot loader finds information how many sectors it must
=== read in order to fetch the entire kernel from disk?
=== (remove leading "====" from the correct answer line)
==== hard coded in boot loader
elf header
==== elf tail
==== gnome header
==== gnome tail
==== none of above
=== Q Where boot loader finds information what address to start
=== executing kernel from?
=== (remove leading "====" from the correct answer line)
==== hard coded in boot loader
elf header
==== elf tail
==== gnome header
==== gnome tail
==== none of above
=== Q What C function in boot loader contains the logic of reading the
=== whole kernel? (not full function declaration, just the name)
bootmain
=== Q What are 4 words of memory at 0x100000 at the point the BIOS
=== enters the boot loader?
=== (as displayed by gdb, in the form WORD1 WORD2 WORD3 WORD4)
0x00000000 0x00000000 0x00000000 0x00000000
=== Q What are 4 words of memory at 0x100000 at the point the boot
=== loader enters the kernel?
=== (as displayed by gdb, in the form WORD1 WORD2 WORD3 WORD4)
0x1badb002 0x00000000 0xe4524ffe 0x7205c766
=== Q What's the link address of .text section of the kernel?
0xf0100000
=== Q What's the entry point (start address) of the kernel?
0x0010000c
=== Q What source file contains the first kernel instruction?
=== (file name including extensions, but excluding the path)
entry.S
=== Q Study the file you've just found.
=== What's the name of a kernel entry point as appears in this file?
entry
=== Q What line among all kernel sources declares the name you've just
=== found as kernel entry point? (full line)
.globl entry
=== Q What's the first instruction which would "break" if you were to
=== get the boot loader's link address wrong? "Break" here means:
=== the result of executing the instruction is different from the
=== one before the change of the link address.
=== Check yourself by recompiling & debugging!
=== (address & instruction)
0x7c00: cli
=== Q What's the first instruction after the kernel establishes a new
=== mapping that would fail to work properly if the mappings were
=== not in place? (address & instruction)
0xf010002c: movl $0x0, %ebp
=== Q What functions from console.c are directly used by printf.c?
=== (just function names separated by spaces, not full declarations)
cputchar
=== Q What is the task of console.c lines 194-202?
=== (free form, up to 10 words)
move all lines above (delete the first) , enter new line
=== Consider the code
=== int x = 1, y = 3, z = 4;
=== cprintf("x %d, y %x, z %d\n", x, y, z);
=== executing inside cprintf function just after fmt and ap are
=== initialized (just before the call to vcprintf).
=== Q What's the contents of the first byte in memory pointed to by
=== fmt? (write this byte as a number)
0x78
=== Q What's the contents of the first byte in memory pointed to by
=== ap? (write this byte as a number)
0x001
=== Consider the code
=== unsigned int i = 0x00646c72;
=== cprintf("H%x Wo%s", 57616, &i);
=== Q What is the output of the code?
He110 World
=== Q To lead to the same output in big-endian architecture, what
=== should be the value of the second argument?
&i
=== Q To lead to the same output in big-endian architecture, what
=== should be the value of i?
0x726c6400
=== Q What is printed after "y=" for cprintf("x=%d y=%d", 3)?
=== (free form, up to 10 words)
Junk
=== Q What instruction reserves space for kernel stack?
=== (address & instruction)
.space KSTKSIZE
=== Q How many 32-bit words (i.e. bytes/4) does each recursive nesting
=== level of test_backtrace adds to the stack size?
8