-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprintf.html
More file actions
51 lines (43 loc) · 1.71 KB
/
printf.html
File metadata and controls
51 lines (43 loc) · 1.71 KB
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
<html>
<head>
<title>How does printf work?</title>
<link rel="stylesheet" href="workshop.css" type="text/css" />
</head>
<body>
<div id="column">
<div id="main">
<div id="head">
<img src="logo-solo.png" id="logo" />
<h1>How does printf work?</h1>
</div>
<div class="indexlink">
(<a href="index.html"><< back to index</a>)
</div>
When you press a key in the Qemu window, it will appear on
screen. This may appear as basic functionality, but a lot is going on
under the covers:
<ul>
<li>A process is reading keypresses (from <tt>stdin</tt>)
<li>Once it receives a key, it decides to put it on the screen
(using libc's <tt>putc()</tt> to send it to <tt>stdout</tt>, for
example)
<li>libc requests the kernel to display the character by performing
the <tt>write()</tt> system call.
<li>This system call enters the kernel at the <tt>sys_write()</tt> function.
</ul>
<h2>Assignment</h2>
Starting with a breakpoint in <tt>sys_write()</tt>, see if you can
find out how the character ends up on screen.
<p><b>Hint</b>: You should end up in a function
called <tt>do_con_write</tt>, which calls <tt>scr_writew()</tt>
<p><b>Question</b>: If you log in via ssh, will you use the same code?
From where are things different?
<p><b>Question</b>: Now that we've traced writing characters, reading
them should be a piece of cake <tt>:-)</tt>
</div>
<address>
<a href="mailto:kees-jan.dijkzeul@sioux.eu">Kees-Jan Dijkzeul</a>
</address>
</div>
</body>
</html>