45 lines
No EOL
1.8 KiB
TeX
45 lines
No EOL
1.8 KiB
TeX
\documentclass[tikz]{standalone}
|
|
\usepackage[utf8]{inputenc}
|
|
\usepackage{tikz}
|
|
\usetikzlibrary{calc,trees,positioning,arrows,fit,shapes,calc}
|
|
|
|
\begin{document}
|
|
\begin{tikzpicture}
|
|
\def\rectwidth{2}
|
|
\def\rectheight{1}
|
|
|
|
\draw[thick, <->] (\rectwidth / 2, -0.1) -- (\rectwidth / 2, -0.9) node[below] {\texttt{NULL}};
|
|
|
|
% Bottom alloc
|
|
\foreach \i in {0, ..., 0} {
|
|
\draw (0, \i) rectangle (\rectwidth, \i + \rectheight);
|
|
\draw[fill] (-3, \i + 0.5 * \rectheight) circle (2pt) node[left] {PFN: \i};
|
|
\draw[thick, ->] (-0.1, \i + \rectheight * 0.5) -- +(-2.8, 0);
|
|
}
|
|
|
|
\draw[thick, <->] (\rectwidth / 2, \rectheight + 0.1) -- (\rectwidth / 2, \rectheight + 0.9);
|
|
|
|
% Top alloc
|
|
\foreach \i in {2, ..., 5} {
|
|
% Draw 4 rectangles
|
|
\draw (0, \i) rectangle (\rectwidth, \i + \rectheight);
|
|
\draw[fill] (-3, \i + 0.5 * \rectheight) circle (2pt) node[left] {PFN: \i};
|
|
\draw[thick, dotted, ->] (-0.1, \i + \rectheight * 0.5) -- +(-2.8, 0);
|
|
}
|
|
\draw[thick, ->] (-0.1, 2 + \rectheight * 0.5) -- +(-2.8, 0) node[below, xshift=1.5cm] {\texttt{struct page *}};
|
|
|
|
\draw[thick, <->] (\rectwidth / 2, 6.1) -- (\rectwidth / 2, 6.9) node[above] {\texttt{NULL}};
|
|
|
|
% Userspace
|
|
\draw[thick] (5, 8) -- (5, -2) node[right, xshift=0.1cm, yshift=0.9cm] {Userspace};
|
|
\draw[thick] (5 + \rectwidth, 8) -- (5 + \rectwidth, -2);
|
|
\foreach \i in {1, ..., 3} {
|
|
\draw (5, \i) rectangle (5 + \rectwidth, \i + \rectheight) node[right, yshift=-1cm] {\texttt{0xBEEF000\i}};
|
|
}
|
|
\draw[thick, ->] (2.1, 0 + \rectheight * 0.5) -- +(2.8, 1);
|
|
\draw[thick, ->] (2.1, 2 + \rectheight * 0.5) -- +(2.8, 0);
|
|
\draw[thick, dotted, ->] (2.1, 3 + \rectheight * 0.5) -- +(2.8, 0) node[above, xshift=-1.5cm, red] {Fault!};
|
|
|
|
|
|
\end{tikzpicture}
|
|
\end{document} |