\documentclass{article}
\input{6828-preamble}

\begin{document}
\psetnum{18}
\date{2004/11/15}

\begin{pset}
  \begin{problem}
\begin{verbatim}
tlb_miss_handler(va)
{
if va is in current virtual CPU's (L2) TLB
    pa = pa mapped by this va in virtual CPU's TLB
    if (pa is in pmap)
        add (va -> pmap[pa]) to the TLB
    else
       allocate a new machine page ma
       pmap[pa] = ma
       add (va -> ma) to the TLB
else
    invoke virtual CPU's TLB miss procedure
}
\end{verbatim}
  \end{problem}

  \begin{problem}
\begin{verbatim}
emulate_tlbwrite_instruction(va,pa)
{
if pa is not in pmap
    allocate a new machine page ma
    pmap[pa] = ma

add (va -> pmap[pa]) to the CPU's TLB and the L2 TLB
}
\end{verbatim}
  \end{problem}

  \begin{problem}
\begin{verbatim}
emulate_tlbread_instruction(va)
{
return pa mapped by this va in virtual CPU's L2 TLB
}
\end{verbatim}
  \end{problem}
\end{pset}
\end{document}
