mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-21 16:37:48 +00:00
Compare commits
7 Commits
c88780a078
...
eecf9fdcdb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eecf9fdcdb | ||
|
|
f13ccee48b | ||
|
|
e4316a8a16 | ||
|
|
3eeb25c946 | ||
|
|
813f434ecd | ||
|
|
71f5d220ee | ||
|
|
309742463d |
@@ -49,6 +49,13 @@ translated_content_notice = "This is a community translation of the <strong><a h
|
|||||||
translated_by = "Translation by"
|
translated_by = "Translation by"
|
||||||
translation_contributors = "With contributions from"
|
translation_contributors = "With contributions from"
|
||||||
word_separator = "and"
|
word_separator = "and"
|
||||||
|
support_me = """
|
||||||
|
<h2>Support Me</h2>
|
||||||
|
<p>Creating and maintaining this blog and the associated libraries is a lot of work, but I really enjoy doing it. By supporting me, you allow me to invest more time in new content, new features, and continuous maintenance. The best way to support me is to <a href="https://github.com/sponsors/phil-opp"><em>sponsor me on GitHub</em></a>. Thank you!</p>
|
||||||
|
"""
|
||||||
|
comment_note = """
|
||||||
|
Do you have a problem, want to share feedback, or discuss further ideas? Feel free to leave a comment here! Please stick to English and follow Rust's <a href="https://www.rust-lang.org/policies/code-of-conduct">code of conduct</a>. This comment thread directly maps to a <a href="_discussion_url_"><em>discussion on GitHub</em></a>, so you can also comment there if you prefer.
|
||||||
|
"""
|
||||||
|
|
||||||
# Chinese (simplified)
|
# Chinese (simplified)
|
||||||
[languages.zh-CN]
|
[languages.zh-CN]
|
||||||
@@ -67,6 +74,13 @@ translated_content_notice = "这是对原文章 <strong><a href=\"_original.perm
|
|||||||
translated_by = "翻译者:"
|
translated_by = "翻译者:"
|
||||||
translation_contributors = "With contributions from"
|
translation_contributors = "With contributions from"
|
||||||
word_separator = "和"
|
word_separator = "和"
|
||||||
|
support_me = """
|
||||||
|
<h2>Support Me</h2>
|
||||||
|
<p>Creating and maintaining this blog and the associated libraries is a lot of work, but I really enjoy doing it. By supporting me, you allow me to invest more time in new content, new features, and continuous maintenance. The best way to support me is to <a href="https://github.com/sponsors/phil-opp"><em>sponsor me on GitHub</em></a>. Thank you!</p>
|
||||||
|
"""
|
||||||
|
comment_note = """
|
||||||
|
Do you have a problem, want to share feedback, or discuss further ideas? Feel free to leave a comment here! Please stick to English and follow Rust's <a href="https://www.rust-lang.org/policies/code-of-conduct">code of conduct</a>. This comment thread directly maps to a <a href="_discussion_url_"><em>discussion on GitHub</em></a>, so you can also comment there if you prefer.
|
||||||
|
"""
|
||||||
|
|
||||||
# Chinese (traditional)
|
# Chinese (traditional)
|
||||||
[languages.zh-TW]
|
[languages.zh-TW]
|
||||||
@@ -85,6 +99,13 @@ translated_content_notice = "這是對原文章 <strong><a href=\"_original.perm
|
|||||||
translated_by = "翻譯者:"
|
translated_by = "翻譯者:"
|
||||||
translation_contributors = "With contributions from"
|
translation_contributors = "With contributions from"
|
||||||
word_separator = "和"
|
word_separator = "和"
|
||||||
|
support_me = """
|
||||||
|
<h2>Support Me</h2>
|
||||||
|
<p>Creating and maintaining this blog and the associated libraries is a lot of work, but I really enjoy doing it. By supporting me, you allow me to invest more time in new content, new features, and continuous maintenance. The best way to support me is to <a href="https://github.com/sponsors/phil-opp"><em>sponsor me on GitHub</em></a>. Thank you!</p>
|
||||||
|
"""
|
||||||
|
comment_note = """
|
||||||
|
Do you have a problem, want to share feedback, or discuss further ideas? Feel free to leave a comment here! Please stick to English and follow Rust's <a href="https://www.rust-lang.org/policies/code-of-conduct">code of conduct</a>. This comment thread directly maps to a <a href="_discussion_url_"><em>discussion on GitHub</em></a>, so you can also comment there if you prefer.
|
||||||
|
"""
|
||||||
|
|
||||||
# Japanese
|
# Japanese
|
||||||
[languages.ja]
|
[languages.ja]
|
||||||
@@ -103,6 +124,13 @@ translated_content_notice = "この記事は<strong><a href=\"_original.permalin
|
|||||||
translated_by = "翻訳者:"
|
translated_by = "翻訳者:"
|
||||||
translation_contributors = "With contributions from"
|
translation_contributors = "With contributions from"
|
||||||
word_separator = "及び"
|
word_separator = "及び"
|
||||||
|
support_me = """
|
||||||
|
<h2>Support Me</h2>
|
||||||
|
<p>Creating and maintaining this blog and the associated libraries is a lot of work, but I really enjoy doing it. By supporting me, you allow me to invest more time in new content, new features, and continuous maintenance. The best way to support me is to <a href="https://github.com/sponsors/phil-opp"><em>sponsor me on GitHub</em></a>. Thank you!</p>
|
||||||
|
"""
|
||||||
|
comment_note = """
|
||||||
|
Do you have a problem, want to share feedback, or discuss further ideas? Feel free to leave a comment here! Please stick to English and follow Rust's <a href="https://www.rust-lang.org/policies/code-of-conduct">code of conduct</a>. This comment thread directly maps to a <a href="_discussion_url_"><em>discussion on GitHub</em></a>, so you can also comment there if you prefer.
|
||||||
|
"""
|
||||||
|
|
||||||
# Persian
|
# Persian
|
||||||
[languages.fa]
|
[languages.fa]
|
||||||
@@ -121,6 +149,13 @@ translated_content_notice = "این یک ترجمه از جامعه کاربرا
|
|||||||
translated_by = "ترجمه توسط"
|
translated_by = "ترجمه توسط"
|
||||||
translation_contributors = "With contributions from"
|
translation_contributors = "With contributions from"
|
||||||
word_separator = "و"
|
word_separator = "و"
|
||||||
|
support_me = """
|
||||||
|
<h2>Support Me</h2>
|
||||||
|
<p>Creating and maintaining this blog and the associated libraries is a lot of work, but I really enjoy doing it. By supporting me, you allow me to invest more time in new content, new features, and continuous maintenance. The best way to support me is to <a href="https://github.com/sponsors/phil-opp"><em>sponsor me on GitHub</em></a>. Thank you!</p>
|
||||||
|
"""
|
||||||
|
comment_note = """
|
||||||
|
Do you have a problem, want to share feedback, or discuss further ideas? Feel free to leave a comment here! Please stick to English and follow Rust's <a href="https://www.rust-lang.org/policies/code-of-conduct">code of conduct</a>. This comment thread directly maps to a <a href="_discussion_url_"><em>discussion on GitHub</em></a>, so you can also comment there if you prefer.
|
||||||
|
"""
|
||||||
|
|
||||||
# Russian
|
# Russian
|
||||||
[languages.ru]
|
[languages.ru]
|
||||||
@@ -139,6 +174,13 @@ translated_content_notice = "Это перевод сообщества пост
|
|||||||
translated_by = "Перевод сделан"
|
translated_by = "Перевод сделан"
|
||||||
translation_contributors = "With contributions from"
|
translation_contributors = "With contributions from"
|
||||||
word_separator = "и"
|
word_separator = "и"
|
||||||
|
support_me = """
|
||||||
|
<h2>Support Me</h2>
|
||||||
|
<p>Creating and maintaining this blog and the associated libraries is a lot of work, but I really enjoy doing it. By supporting me, you allow me to invest more time in new content, new features, and continuous maintenance. The best way to support me is to <a href="https://github.com/sponsors/phil-opp"><em>sponsor me on GitHub</em></a>. Thank you!</p>
|
||||||
|
"""
|
||||||
|
comment_note = """
|
||||||
|
Do you have a problem, want to share feedback, or discuss further ideas? Feel free to leave a comment here! Please stick to English and follow Rust's <a href="https://www.rust-lang.org/policies/code-of-conduct">code of conduct</a>. This comment thread directly maps to a <a href="_discussion_url_"><em>discussion on GitHub</em></a>, so you can also comment there if you prefer.
|
||||||
|
"""
|
||||||
|
|
||||||
# French
|
# French
|
||||||
[languages.fr]
|
[languages.fr]
|
||||||
@@ -157,6 +199,13 @@ translated_content_notice = "Ceci est une traduction communautaire de l'article
|
|||||||
translated_by = "Traduit par : "
|
translated_by = "Traduit par : "
|
||||||
translation_contributors = "With contributions from"
|
translation_contributors = "With contributions from"
|
||||||
word_separator = "et"
|
word_separator = "et"
|
||||||
|
support_me = """
|
||||||
|
<h2>Support Me</h2>
|
||||||
|
<p>Creating and maintaining this blog and the associated libraries is a lot of work, but I really enjoy doing it. By supporting me, you allow me to invest more time in new content, new features, and continuous maintenance. The best way to support me is to <a href="https://github.com/sponsors/phil-opp"><em>sponsor me on GitHub</em></a>. Thank you!</p>
|
||||||
|
"""
|
||||||
|
comment_note = """
|
||||||
|
Do you have a problem, want to share feedback, or discuss further ideas? Feel free to leave a comment here! Please stick to English and follow Rust's <a href="https://www.rust-lang.org/policies/code-of-conduct">code of conduct</a>. This comment thread directly maps to a <a href="_discussion_url_"><em>discussion on GitHub</em></a>, so you can also comment there if you prefer.
|
||||||
|
"""
|
||||||
|
|
||||||
# Korean
|
# Korean
|
||||||
[languages.ko]
|
[languages.ko]
|
||||||
@@ -175,3 +224,10 @@ translated_content_notice = "이것은 커뮤니티 멤버가 <strong><a href=\"
|
|||||||
translated_by = "번역한 사람 : "
|
translated_by = "번역한 사람 : "
|
||||||
translation_contributors = "With contributions from"
|
translation_contributors = "With contributions from"
|
||||||
word_separator = "와"
|
word_separator = "와"
|
||||||
|
support_me = """
|
||||||
|
<h2>Support Me</h2>
|
||||||
|
<p>Creating and maintaining this blog and the associated libraries is a lot of work, but I really enjoy doing it. By supporting me, you allow me to invest more time in new content, new features, and continuous maintenance. The best way to support me is to <a href="https://github.com/sponsors/phil-opp"><em>sponsor me on GitHub</em></a>. Thank you!</p>
|
||||||
|
"""
|
||||||
|
comment_note = """
|
||||||
|
Do you have a problem, want to share feedback, or discuss further ideas? Feel free to leave a comment here! Please stick to English and follow Rust's <a href="https://www.rust-lang.org/policies/code-of-conduct">code of conduct</a>. This comment thread directly maps to a <a href="_discussion_url_"><em>discussion on GitHub</em></a>, so you can also comment there if you prefer.
|
||||||
|
"""
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ The VGA text buffer is accessible via [memory-mapped I/O] to the address `0xb800
|
|||||||
|
|
||||||
Note that memory-mapped hardware might not support all normal RAM operations. For example, a device could only support byte-wise reads and return junk when a `u64` is read. Fortunately, the text buffer [supports normal reads and writes], so we don't have to treat it in a special way.
|
Note that memory-mapped hardware might not support all normal RAM operations. For example, a device could only support byte-wise reads and return junk when a `u64` is read. Fortunately, the text buffer [supports normal reads and writes], so we don't have to treat it in a special way.
|
||||||
|
|
||||||
[supports normal reads and writes]: https://web.stanford.edu/class/cs140/projects/pintos/specs/freevga/vga/vgamem.htm#manip
|
[supports normal reads and writes]: https://www.scs.stanford.edu/21wi-cs140/pintos/specs/freevga/vga/vga.htm
|
||||||
|
|
||||||
## A Rust Module
|
## A Rust Module
|
||||||
Now that we know how the VGA buffer works, we can create a Rust module to handle printing:
|
Now that we know how the VGA buffer works, we can create a Rust module to handle printing:
|
||||||
|
|||||||
@@ -469,9 +469,9 @@ ExampleStateMachine::End(_) => {
|
|||||||
|
|
||||||
Futureは `Poll::Ready` を返した後、再びポーリングされるべきではありません。したがって、すでに `End` の状態にあるときに `poll` が呼ばれるとパニックするようにしましょう。
|
Futureは `Poll::Ready` を返した後、再びポーリングされるべきではありません。したがって、すでに `End` の状態にあるときに `poll` が呼ばれるとパニックするようにしましょう。
|
||||||
|
|
||||||
コンパイラが生成するステートマシンとその `Future` traitの実装はこのようになっている**かもしれません**。実際には、コンパイラは異なる方法でコードを生成しています。 (一応、現在は[_generators_]をベースにした実装になっていますが、これはあくまでも実装の詳細です。)
|
コンパイラが生成するステートマシンとその `Future` traitの実装はこのようになっている**かもしれません**。実際には、コンパイラは異なる方法でコードを生成しています。 (一応、現在は[_coroutines_]をベースにした実装になっていますが、これはあくまでも実装の詳細です。)
|
||||||
|
|
||||||
[_generators_]: https://doc.rust-lang.org/stable/unstable-book/language-features/generators.html
|
[_coroutines_]: https://doc.rust-lang.org/stable/unstable-book/language-features/coroutines.html
|
||||||
|
|
||||||
パズルの最後のピースは、生成された `example` 関数自体のコードです。関数のヘッダは次のように定義されていたことを思い出してください:
|
パズルの最後のピースは、生成された `example` 関数自体のコードです。関数のヘッダは次のように定義されていたことを思い出してください:
|
||||||
|
|
||||||
|
|||||||
@@ -462,9 +462,9 @@ ExampleStateMachine::End(_) => {
|
|||||||
|
|
||||||
Futures should not be polled again after they returned `Poll::Ready`, so we panic if `poll` is called while we are already in the `End` state.
|
Futures should not be polled again after they returned `Poll::Ready`, so we panic if `poll` is called while we are already in the `End` state.
|
||||||
|
|
||||||
We now know what the compiler-generated state machine and its implementation of the `Future` trait _could_ look like. In practice, the compiler generates code in a different way. (In case you're interested, the implementation is currently based on [_generators_], but this is only an implementation detail.)
|
We now know what the compiler-generated state machine and its implementation of the `Future` trait _could_ look like. In practice, the compiler generates code in a different way. (In case you're interested, the implementation is currently based on [_coroutines_], but this is only an implementation detail.)
|
||||||
|
|
||||||
[_generators_]: https://doc.rust-lang.org/stable/unstable-book/language-features/generators.html
|
[_coroutines_]: https://doc.rust-lang.org/stable/unstable-book/language-features/coroutines.html
|
||||||
|
|
||||||
The last piece of the puzzle is the generated code for the `example` function itself. Remember, the function header was defined like this:
|
The last piece of the puzzle is the generated code for the `example` function itself. Remember, the function header was defined like this:
|
||||||
|
|
||||||
|
|||||||
@@ -61,8 +61,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="">
|
<div class="">
|
||||||
<h2>Support Me</h2>
|
{{ trans(key="support_me", lang=lang) | safe }}
|
||||||
{{ snippets::support() }}
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock main %}
|
{% endblock main %}
|
||||||
|
|
||||||
|
|||||||
@@ -91,8 +91,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="post-footer-support{% if page.extra.rtl %} right-to-left{% endif %}">
|
<div class="post-footer-support{% if page.extra.rtl %} right-to-left{% endif %}">
|
||||||
<h2>Support Me</h2>
|
{{ trans(key="support_me", lang=lang) | safe }}
|
||||||
{{ snippets::support() }}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@@ -1,15 +1,3 @@
|
|||||||
{% macro support() %}
|
|
||||||
<p>
|
|
||||||
Creating and <a href="{{ get_url(path="@/status-update/_index.md") }}">maintaining</a> this blog and the associated libraries is a lot of work, but I really enjoy doing it. By supporting me, you allow me to invest more time in new content, new features, and continuous maintenance.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
The best way to support me is to <a href="https://github.com/sponsors/phil-opp"><em>sponsor me on GitHub</em></a>, since they don't charge any fees. If you prefer other platforms, I also have <a href="https://www.patreon.com/phil_opp"><em>Patreon</em></a> and <a href="https://donorbox.org/phil-opp"><em>Donorbox</em></a> accounts. The latter is the most flexible as it supports multiple currencies and one-time contributions.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Thank you!
|
|
||||||
</p>
|
|
||||||
{% endmacro support %}
|
|
||||||
|
|
||||||
{% macro giscus(search_term, lang) %}
|
{% macro giscus(search_term, lang) %}
|
||||||
{% if lang != "en" %}
|
{% if lang != "en" %}
|
||||||
{% set category = "Post Comments (translated)" %}
|
{% set category = "Post Comments (translated)" %}
|
||||||
@@ -29,7 +17,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<p class="comment-note">
|
<p class="comment-note">
|
||||||
Do you have a problem, want to share feedback, or discuss further ideas? Feel free to leave a comment here! Please stick to English and follow Rust's <a href="https://www.rust-lang.org/policies/code-of-conduct">code of conduct</a>. This comment thread directly maps to a <a href="{{ discussion_url | safe }}"><em>discussion on GitHub</em></a>, so you can also comment there if you prefer.
|
{{ trans(key="comment_note", lang=lang) | replace(from="_discussion_url_", to=discussion_url) | safe }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="giscus"></div>
|
<div class="giscus"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user