Skip to content

Commit

Permalink
deploy: d4b93c4
Browse files Browse the repository at this point in the history
  • Loading branch information
wyfcyx committed Jun 30, 2024
1 parent 97ce8c4 commit ac4fa65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions _sources/chapter4/5kernel-app-spaces.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
fn push(&mut self, mut map_area: MapArea, data: Option<&[u8]>) {
map_area.map(&mut self.page_table);
if let Some(data) = data {
map_area.copy_data(&mut self.page_table, data);
map_area.copy_data(&self.page_table, data);
}
self.areas.push(map_area);
}
Expand Down Expand Up @@ -170,7 +170,7 @@
}
/// data: start-aligned but maybe with shorter length
/// assume that all frames were cleared before
pub fn copy_data(&mut self, page_table: &mut PageTable, data: &[u8]) {
pub fn copy_data(&mut self, page_table: &PageTable, data: &[u8]) {
assert_eq!(self.map_type, MapType::Framed);
let mut start: usize = 0;
let mut current_vpn = self.vpn_range.get_start();
Expand Down
4 changes: 2 additions & 2 deletions chapter4/5kernel-app-spaces.html
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ <h2>实现地址空间抽象<a class="headerlink" href="#id3" title="永久链
<span class="linenos">10</span><span class="w"> </span><span class="k">fn</span> <span class="nf">push</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">map_area</span>: <span class="nc">MapArea</span><span class="p">,</span><span class="w"> </span><span class="n">data</span>: <span class="nb">Option</span><span class="o">&lt;&amp;</span><span class="p">[</span><span class="kt">u8</span><span class="p">]</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="linenos">11</span><span class="w"> </span><span class="n">map_area</span><span class="p">.</span><span class="n">map</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">page_table</span><span class="p">);</span>
<span class="linenos">12</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">data</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">data</span><span class="w"> </span><span class="p">{</span>
<span class="linenos">13</span><span class="w"> </span><span class="n">map_area</span><span class="p">.</span><span class="n">copy_data</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">page_table</span><span class="p">,</span><span class="w"> </span><span class="n">data</span><span class="p">);</span>
<span class="linenos">13</span><span class="w"> </span><span class="n">map_area</span><span class="p">.</span><span class="n">copy_data</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">.</span><span class="n">page_table</span><span class="p">,</span><span class="w"> </span><span class="n">data</span><span class="p">);</span>
<span class="linenos">14</span><span class="w"> </span><span class="p">}</span>
<span class="linenos">15</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">areas</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="n">map_area</span><span class="p">);</span>
<span class="linenos">16</span><span class="w"> </span><span class="p">}</span>
Expand Down Expand Up @@ -525,7 +525,7 @@ <h2>实现地址空间抽象<a class="headerlink" href="#id3" title="永久链
<span class="linenos">28</span><span class="w"> </span><span class="p">}</span>
<span class="linenos">29</span><span class="w"> </span><span class="sd">/// data: start-aligned but maybe with shorter length</span>
<span class="linenos">30</span><span class="w"> </span><span class="sd">/// assume that all frames were cleared before</span>
<span class="linenos">31</span><span class="w"> </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">copy_data</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">page_table</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="n">PageTable</span><span class="p">,</span><span class="w"> </span><span class="n">data</span>: <span class="kp">&amp;</span><span class="p">[</span><span class="kt">u8</span><span class="p">])</span><span class="w"> </span><span class="p">{</span>
<span class="linenos">31</span><span class="w"> </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">copy_data</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">page_table</span>: <span class="kp">&amp;</span><span class="nc">PageTable</span><span class="p">,</span><span class="w"> </span><span class="n">data</span>: <span class="kp">&amp;</span><span class="p">[</span><span class="kt">u8</span><span class="p">])</span><span class="w"> </span><span class="p">{</span>
<span class="linenos">32</span><span class="w"> </span><span class="fm">assert_eq!</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">map_type</span><span class="p">,</span><span class="w"> </span><span class="n">MapType</span>::<span class="n">Framed</span><span class="p">);</span>
<span class="linenos">33</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">start</span>: <span class="kt">usize</span> <span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span>
<span class="linenos">34</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">current_vpn</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">vpn_range</span><span class="p">.</span><span class="n">get_start</span><span class="p">();</span>
Expand Down

0 comments on commit ac4fa65

Please sign in to comment.