Commit Graph

130 Commits

Author SHA1 Message Date
a26d93037e Enforce consistent style
Execute "make indent" before submitting patches.
2021-08-07 23:33:37 +08:00
43f20d0279 Mention the availability of PDF pre-release 2021-08-07 18:53:06 +08:00
d2fd6d64c0 Tweak pdfLaTeX related commands 2021-08-07 18:49:24 +08:00
d0721da3d9 Tidy the rest of chapters 2021-08-07 18:35:28 +08:00
1ac7bacfb8 Shorten chardev 2021-08-07 18:29:39 +08:00
2303d5c851 Tidy section: Optimizations 2021-08-07 11:02:49 +08:00
40e83aa14b Tidy section: The Device Model 2021-08-07 10:59:15 +08:00
939bd4e9ab Tidy section: Crypto 2021-08-07 10:56:16 +08:00
f8adcdb3c1 procfs4: Shorten and indent 2021-08-07 10:54:19 +08:00
e1d31e9500 Tidy section: Interrupt Handlers 2021-08-07 10:35:52 +08:00
768b70e95e Tidy section: Scheduling Tasks 2021-08-07 10:27:05 +08:00
2c1f4d185b Tidy section: Replacing Print Macros
FIXME: we should rewrite this section
2021-08-07 10:24:08 +08:00
4a34cc69b3 Tidy section: Avoiding Collisions and Deadlocks 2021-08-07 10:16:08 +08:00
678757e19c Tidy section: Blocking Processes and threads 2021-08-07 10:07:22 +08:00
3070689d19 Update document maintainer information 2021-08-07 09:52:03 +08:00
92b646ed64 proc_ops: Be aware of kernel API changes (#13)
The proc_ops structure is defined in <include/linux/proc_fs.h> since
Linux v5.6+.
In older kernels, file_operations structure is used for custom hooks in
/proc file system. However, it contains some members that are unnecessary
in VFS, and every time VFS expands file_operations set, /proc code comes
bloated.

On the other hand, not only the space, but also some operations were
saved by this structure to improve its performance.
2021-08-06 18:08:05 +08:00
a411938b73 Merge pull request #43 from dancek/master
Rewrite CSS to support scaling
2021-08-05 20:50:22 +08:00
e5e103a89b Rewrite CSS to support scaling
This changes the layout to use the default font size with a reasonable
max width and margins around the body. Elements that would overflow on
narrow displays are changed to wrap (.author) or present a scroll bar as
necessary (figure, .verbatim, .fancyvrb). The properties on html and
body are set such that there is no full-document vertical scrolling.
Inline math is displayed in the same size as the surrounding text.
2021-08-05 14:07:16 +03:00
466e8a00fd cat_nonblock: Use canonical name scheme and fix unintended assignment 2021-08-05 14:28:12 +08:00
38586974ee Merge pull request #39 from fdgkhdkgh/master
Fix typo
2021-08-05 02:39:09 +08:00
634c3659a8 Fix typo. 2021-08-05 02:16:36 +08:00
5940dd9faa Revise hello-5 and its output (#38)
For the example module hello_5, the book showed the incorrect output
in corresponding with its execution results.

In addition, this patch changes from myintArray[2] = {-1, -1} to
myintArray[2] = {420, 420}, which help the readers distinguish from
the kernel messages.
2021-08-04 23:42:10 +08:00
40f0ff3087 Merge pull request #37 from fdgkhdkgh/master
Fix typo
2021-08-04 10:03:06 +08:00
a7f81a2cfc Fix typo.
There is a typo in chapter 0.6.3.
2021-08-04 09:33:21 +08:00
7c129a4276 Minor wording tweak 2021-08-03 06:29:52 +08:00
45769753d3 procfs1: Fix parameter descriptions (#34)
In "procfs1.c," the "buffer" is actually the second parameter of procfile_read().
The "offset" is the fourth one.
2021-08-02 23:01:34 +08:00
65a8f5a1d6 Unify device node name "/proc/helloworld" (#33)
The file name "proc helloworld" was not consistent with that of the later
sentences. The latter sentences use the device node name "/proc/helloworld".
2021-08-02 22:59:19 +08:00
970ddaba0b Mention the online publication 2021-08-02 15:15:49 +08:00
859af5f727 Merge pull request #32 from focaaby/master
Publish GitHub Pages with GitHub Actions
2021-08-02 14:17:59 +08:00
937acfa0d7 Publish GitHub Page with GitHub Action
Add a new Github Action to publish to the GitHub page. Use twtug/lkmpg
image for reproducibility.

Ref:
- sysprog21#27
- https://github.com/TeXtw/docker-lkmpg
2021-08-02 06:22:29 +01:00
749f0392bb Tidy section: system calls 2021-08-02 02:57:31 +08:00
6689090085 Tidy section: device files 2021-08-02 02:43:35 +08:00
044cfefe65 Generate HTML via make4ht (#20)
This patch generates HTML files with "make4ht" in the "html" directory.

Known issues with "make4ht":
Running "make4ht -suf html5 -d html lkmpg.tex" will cause the following
flaws:
1. The layout was unsatisfying.
2. After parsing TeX, it stoped at "\tableofcontents" with errors.
3. Several unneeded files were generated.
4. No way to specify the destination filename for HTML generation.

Solutions/workaround:
1. Use customized configuration file "html.cfg" to specify the layout style.
2. Turn off the \tableofcontents section when using make4ht. However, this
    results in the lack of table of contents in HTML. It can be fixed by
    appending "\Configure{tableofcontents*}{chapter,section,subsection}"
    to configuration file.
3. The build system removes the temporary files.
4. Use a symbolic link "index.html" to "lkmpg.html".
2021-08-02 02:42:39 +08:00
d097d0c472 Add package xparse (#31)
The package xparse should be included since
\NewDocumentCommand is part of it
2021-08-02 02:24:09 +08:00
4639ca1b26 Remove out-of-date versioing scheme 2021-08-01 22:41:28 +08:00
fd80247ec8 Merge pull request #29 from ekangmonyet/master
Delete existing release asset before releasing
2021-08-01 22:21:42 +08:00
7ee66c559f Delete existing release asset before releasing
Use mknejp/delete-release-assets to delete existing asset.
This approach might not be optimal if softprops/action-gh-release
supports upserting [1].

[1] https://github.com/softprops/action-gh-release/pull/134
2021-08-01 21:05:47 +08:00
0fce98f6d2 Dockerized PDF deployment in GitHub Actions (#28)
Add a new GitHub Action to build and release the PDF file after every
push to master.  Use texlive/texlive docker image for the sake of
reproducibility in preparation for future build tools like make4ht .

Progress #27 - Reproducible TeX build environment using Docker
2021-08-01 19:39:12 +08:00
6026699a40 Tidy section: Character Device drivers 2021-08-01 16:21:01 +08:00
4257b6ddcb Tidy section: Preliminaries 2021-08-01 15:03:49 +08:00
09bde29531 Zircon kernel was formerly called Magenta
The renaming appeared in 2017.
2021-08-01 14:15:59 +08:00
a949659e53 Merge pull request #24 from fennecJ/patch
Fix grammar
2021-07-31 23:39:03 +08:00
5d2f428cff Fix grammar 2021-07-31 23:19:44 +08:00
50e9d9176f chardev: Revise comment on device node (#23)
The device file create in this example is "chardev". 
So input command "sudo cat /dev/chardev" will get a valid message
"I already told you %d times Hello world!"
2021-07-31 23:03:16 +08:00
a4af7b5e5a Fix dead link (#21) 2021-07-30 14:47:22 +08:00
377ec93a05 Add information for contributing 2021-07-30 13:45:58 +08:00
b50323330c Merge pull request #19 from fennecJ/master
Fix typo
2021-07-30 00:40:58 +08:00
69b40b7bda Fix typo 2021-07-29 19:52:22 +08:00
c7a7a667cf Avoid strlen by assigning explicit length of string for proc_read (#18)
Since the address of buffer is userspace address, it may trigger an unexpected fault on strlen(buffer).

On Ubuntu 20.04.2 LTS ( 5.8.0-63-generic ), using strlen(buffer) will result in the following:
[ 2168.010930] /proc/buffer1k created
[ 2177.014347] BUG: unable to handle page fault for address: 00007fbbc2a17000
[ 2177.014355] #PF: supervisor read access in kernel mode
[ 2177.014358] #PF: error_code(0x0000) - not-present page
[ 2177.014361] PGD 80000003c61d0067 P4D 80000003c61d0067 PUD 3ee6c5067 PMD 40e1ff067 PTE 0
[ 2177.014369] Oops: 0000 [#1] SMP PTI
[ 2177.014376] CPU: 7 PID: 4750 Comm: cat Tainted: P        W  OE     5.8.0-63-generic #71~20.04.1-Ubuntu

[ 2177.014387] RIP: 0010:procfile_read+0xb/0x20 [procfs2]
[ 2177.014393] Code: Unable to access opcode bytes at RIP 0xffffffffc1253fe1.
[ 2177.014396] RSP: 0018:ffffbc84412cbe78 EFLAGS: 00010286
[ 2177.014400] RAX: ffffffffc1254000 RBX: 0000000000020000 RCX: ffffbc84412cbef0
[ 2177.014403] RDX: 0000000000020000 RSI: 00007fbbc2a17000 RDI: ffffa057d2708f00
[ 2177.014406] RBP: ffffbc84412cbe80 R08: 0000000000000001 R09: 0000000000000000
[ 2177.014409] R10: 0000000000000000 R11: 0000000000000000 R12: ffffa0581de8ccc0
[ 2177.014411] R13: ffffa057d2708f00 R14: ffffbc84412cbef0 R15: 00007fbbc2a17000
[ 2177.014415] FS:  00007fbbc3bfa580(0000) GS:ffffa0582dbc0000(0000) knlGS:0000000000000000
[ 2177.014418] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2177.014421] CR2: ffffffffc1253fe1 CR3: 00000003c611c004 CR4: 00000000003606e0
[ 2177.014424] Call Trace:
[ 2177.014435]  proc_reg_read+0x66/0x90
[ 2177.014441]  vfs_read+0xaa/0x190
[ 2177.014446]  ksys_read+0x67/0xe0
[ 2177.014451]  __x64_sys_read+0x1a/0x20
[ 2177.014458]  do_syscall_64+0x49/0xc0
[ 2177.014464]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 2177.014467] RIP: 0033:0x7fbbc3b18142
[ 2177.014472] Code: c0 e9 c2 fe ff ff 50 48 8d 3d 3a ca 0a 00 e8 f5 19 02 00 0f 1f 44 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 0f 05 <48> 3d 00 f0 ff ff 77 56 c3 0f 1f 44 00 00 48 83 ec 28 48 89 54 24
[ 2177.014476] RSP: 002b:00007ffcf2d20d78 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
[ 2177.014479] RAX: ffffffffffffffda RBX: 0000000000020000 RCX: 00007fbbc3b18142
[ 2177.014482] RDX: 0000000000020000 RSI: 00007fbbc2a17000 RDI: 0000000000000003
[ 2177.014485] RBP: 00007fbbc2a17000 R08: 00007fbbc2a16010 R09: 0000000000000000
[ 2177.014487] R10: 0000000000000022 R11: 0000000000000246 R12: 0000560f8ff081f0
[ 2177.014490] R13: 0000000000000003 R14: 0000000000020000 R15: 0000000000020000

[ 2177.014635] CR2: 00007fbbc2a17000
[ 2177.014639] ---[ end trace b71ff05c1b0a10f6 ]---
[ 2177.184174] RIP: 0010:procfile_read+0xb/0x20 [procfs2]
[ 2177.184176] Code: Unable to access opcode bytes at RIP 0xffffffffc1253fe1.
[ 2177.184177] RSP: 0018:ffffbc84412cbe78 EFLAGS: 00010286
[ 2177.184178] RAX: ffffffffc1254000 RBX: 0000000000020000 RCX: ffffbc84412cbef0
[ 2177.184179] RDX: 0000000000020000 RSI: 00007fbbc2a17000 RDI: ffffa057d2708f00
[ 2177.184180] RBP: ffffbc84412cbe80 R08: 0000000000000001 R09: 0000000000000000
[ 2177.184180] R10: 0000000000000000 R11: 0000000000000000 R12: ffffa0581de8ccc0
[ 2177.184181] R13: ffffa057d2708f00 R14: ffffbc84412cbef0 R15: 00007fbbc2a17000
[ 2177.184182] FS:  00007fbbc3bfa580(0000) GS:ffffa0582dbc0000(0000) knlGS:0000000000000000
[ 2177.184182] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2177.184183] CR2: ffffffffc1253fe1 CR3: 00000003c611c004 CR4: 00000000003606e0
2021-07-29 16:10:52 +08:00
a82cf74c15 Open Software License is not popular. Explicitly refer to OSI 2021-07-27 10:10:16 +08:00