8
|
1 \chapter{CbCXv6 での Paging}
|
7
|
2 OS の信頼性の基本である メモリ管理 の書き換えについて説明する。
|
|
3
|
6
|
4
|
|
5 \section{Xv6 を元にした Gears OS の実装}
|
8
|
6 Gears OS ではハードウェア上でメタレベルの計算や並列実行を行いたいので、
|
|
7 Raspberry Pi でもバイナリを出力できる Xv6 を CbC で書き換える。
|
6
|
8 ANSI-C で書かれている Xv6 を CbC に書き直し、それを元に Gears OS を実装していく。
|
|
9
|
4
|
10 \section{Paging}
|
5
|
11 メモリ管理の手法に、Paging がある。Paging ではメモリを Page と呼ばれる固定長の単位に分割し、メモリとスワップ領域で Page を入れ替えて管理を行う。
|
10
|
12 \par
|
4
|
13
|
11
|
14 図 \ref{fig:MEmoryConstitution} で Xv6の仮想メモリと実メモリについて説明する。
|
|
15
|
9
|
16
|
|
17 \begin{figure}[ht]
|
|
18 \begin{center}
|
|
19 \includegraphics[width=160mm]{./fig/MemoryConstitution}
|
|
20 \end{center}
|
|
21 \caption{Layout of the virtual address space of a process and the layout of the physical address
|
|
22 space. Note that if a machine has more than 2 Gbyte of physical memory, xv6 can use only the memory
|
|
23 that fits between KERNBASE and 0xFE00000. Russ Cox(2018) xv6 a simple, Unix-like teaching operating system (Frans Kaashoek, Robert Morris)}
|
|
24 \label{fig:MemoryConstitution}
|
|
25 \end{figure}
|
|
26
|
|
27
|
6
|
28 \section{User Space で Paging をする利点}
|
5
|
29 Context に必要な Page Tbale を提供する Interface と User Space からアクセスする API が必要である。
|
|
30 Page Table に相当するデータを Input Data Gear で受け取って変更した後、Context にあるメモリコントロールを担当する Meta Data Gear に goto で遷移してアクセスする。 Meta Computation レベルで処理することで Use Spaceでも Page Table を操作することができる。
|
|
31 Meta Computation に戻る際に、Page Table Entry のバリデーションをチェックして反映することで、他のプロセスから Page Table を書き換えられることを防ぐ。また、サンドボックスにしておいて、他のプロセスが書き換えられた時にエクセプションを飛ばすようにすることで信頼性の保証を行う。
|
4
|
32
|
|
33
|
|
34 \section{Paging の書き換え}
|
7
|
35 Xv6 では実メモリ(Physical memory) から仮想メモリ(Virtual memory)の変換を vm.c で行なっている。
|
|
36 vm.c を CbC で書き換えていく。
|
|
37
|
|
38
|
|
39
|