mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-17 14:57:49 +00:00
Compare commits
196 Commits
post-04-no
...
3adc1cc476
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3adc1cc476 | ||
|
|
445833408c | ||
|
|
3280a0afc7 | ||
|
|
6393247a3b | ||
|
|
e85f81b828 | ||
|
|
8622b9c41b | ||
|
|
a387a00c85 | ||
|
|
faa8d15cb7 | ||
|
|
31b6cf52c6 | ||
|
|
736a4183db | ||
|
|
4c9cd3ae32 | ||
|
|
26f1f5b896 | ||
|
|
688e9680aa | ||
|
|
c2dd2477ab | ||
|
|
624579b494 | ||
|
|
9d16f0a139 | ||
|
|
0ee96f8178 | ||
|
|
a671ad3dbc | ||
|
|
cbead25b43 | ||
|
|
1f49e2e9fe | ||
|
|
8708b54756 | ||
|
|
a78e4b36f1 | ||
|
|
765c7b21e9 | ||
|
|
2c25d55810 | ||
|
|
021762cf30 | ||
|
|
4804317b24 | ||
|
|
d3cb8115c5 | ||
|
|
eb2f818194 | ||
|
|
167ef5bb83 | ||
|
|
85fe11c95c | ||
|
|
4f68f9ba93 | ||
|
|
e48031e8bf | ||
|
|
36e4dc22f3 | ||
|
|
ec95ac0e5a | ||
|
|
d8f280315f | ||
|
|
489d337cec | ||
|
|
0e365109be | ||
|
|
e39c7d8ad8 | ||
|
|
066c278277 | ||
|
|
bdb6a424a8 | ||
|
|
163cadf121 | ||
|
|
c8f72adeb3 | ||
|
|
f40717901b | ||
|
|
96844f6519 | ||
|
|
1501669819 | ||
|
|
009356771a | ||
|
|
cc617ec35e | ||
|
|
195f4489e6 | ||
|
|
1b86d7fd62 | ||
|
|
deb0f63dff | ||
|
|
f1f358a684 | ||
|
|
bee9a7f7ea | ||
|
|
fbdcd45d16 | ||
|
|
d658949f5b | ||
|
|
67d9426fc7 | ||
|
|
4c07101f8f | ||
|
|
30be97d035 | ||
|
|
eb85142b45 | ||
|
|
63d0d8cc9f | ||
|
|
d12842bcd5 | ||
|
|
0e52ccbebb | ||
|
|
2b739350a8 | ||
|
|
4de18a8a10 | ||
|
|
d26b91121c | ||
|
|
3fac6af7b0 | ||
|
|
d4e1f47e62 | ||
|
|
ea5aad0e0c | ||
|
|
4e38e7ddf8 | ||
|
|
3230ab7538 | ||
|
|
4215162b62 | ||
|
|
1afa3af79d | ||
|
|
7e3ef2075d | ||
|
|
35c642b3c2 | ||
|
|
49dce7ada7 | ||
|
|
da14329fb2 | ||
|
|
3d96415940 | ||
|
|
fd8a2e0182 | ||
|
|
552eb97f75 | ||
|
|
c42cee8d89 | ||
|
|
d8ba61748f | ||
|
|
3bb076a00f | ||
|
|
e5bd06edcc | ||
|
|
eace075f2c | ||
|
|
2d5150f2a3 | ||
|
|
ebb9f0b8a7 | ||
|
|
f591b959f5 | ||
|
|
a0e428cc8c | ||
|
|
b90e5fb32a | ||
|
|
b7fb1e8764 | ||
|
|
3ac92cf275 | ||
|
|
7846bd0559 | ||
|
|
3ccc602e38 | ||
|
|
735210fc8f | ||
|
|
0d506d5dd5 | ||
|
|
158873acd4 | ||
|
|
e402af005b | ||
|
|
813bc41a74 | ||
|
|
5ef73aaa30 | ||
|
|
6dcf5c61fb | ||
|
|
96683c596b | ||
|
|
5ac91e5e38 | ||
|
|
ec933ab329 | ||
|
|
76483ab6bf | ||
|
|
3a65487f17 | ||
|
|
6828849bc4 | ||
|
|
29063f4531 | ||
|
|
6979a125cf | ||
|
|
215900cb39 | ||
|
|
df1e2c1c41 | ||
|
|
b851eb01a8 | ||
|
|
3f8c629f28 | ||
|
|
06929ee840 | ||
|
|
e43daca563 | ||
|
|
baa2c3b445 | ||
|
|
c58570fbea | ||
|
|
17c3138763 | ||
|
|
d85274ca2a | ||
|
|
aa084dd539 | ||
|
|
0d87aa7e98 | ||
|
|
6797b2b70e | ||
|
|
752a65e4da | ||
|
|
b6683d95ec | ||
|
|
a7710b3d5c | ||
|
|
618d10eac8 | ||
|
|
2faeaa8964 | ||
|
|
2dfc5e838a | ||
|
|
12c08d72e4 | ||
|
|
53f3236754 | ||
|
|
a5b6422785 | ||
|
|
b7eefae5f9 | ||
|
|
df8335f8c7 | ||
|
|
f301ae461a | ||
|
|
8f76952ff0 | ||
|
|
57b30bf346 | ||
|
|
c6ebca363b | ||
|
|
3bbc72f92b | ||
|
|
f5996c1e22 | ||
|
|
eafcd8b269 | ||
|
|
daf5ed954d | ||
|
|
4753c0e1c8 | ||
|
|
dddc314b7c | ||
|
|
5531e437c4 | ||
|
|
0cd92f9567 | ||
|
|
555a76b559 | ||
|
|
802c7151e4 | ||
|
|
19db8f6095 | ||
|
|
3a273540f4 | ||
|
|
ea096a561a | ||
|
|
6d45ffd4d7 | ||
|
|
7648993b8f | ||
|
|
17bd271573 | ||
|
|
b895f8c745 | ||
|
|
eee9d7b899 | ||
|
|
9787e6dce6 | ||
|
|
a4f675739a | ||
|
|
b1cca8de88 | ||
|
|
493fcb5d84 | ||
|
|
b651214f1e | ||
|
|
3fca470487 | ||
|
|
bac8703e04 | ||
|
|
290ee927e8 | ||
|
|
99171b003e | ||
|
|
86b17ea139 | ||
|
|
f15bbaea3f | ||
|
|
b66b7563c2 | ||
|
|
223ce459a1 | ||
|
|
d808cbff94 | ||
|
|
62e2cee989 | ||
|
|
69ab78108b | ||
|
|
a7ada29c5e | ||
|
|
968620dce8 | ||
|
|
1a801e3d35 | ||
|
|
f0580e82a1 | ||
|
|
94014b5a39 | ||
|
|
680aab362e | ||
|
|
92cc34712c | ||
|
|
bdbbd219d0 | ||
|
|
ab8d8b46e2 | ||
|
|
3cd7427ed8 | ||
|
|
33f9f14391 | ||
|
|
68d09db7c5 | ||
|
|
6bbd12ba7a | ||
|
|
15b394f0eb | ||
|
|
17f2699277 | ||
|
|
cc3a868863 | ||
|
|
d1545e7fbf | ||
|
|
e0ed423e52 | ||
|
|
b96636984c | ||
|
|
b9dd088dc1 | ||
|
|
c6bd48e812 | ||
|
|
9448b0e025 | ||
|
|
ade6c99885 | ||
|
|
59579108a7 | ||
|
|
bd39105793 | ||
|
|
d007aae993 | ||
|
|
c21f051300 |
@@ -1,11 +1,9 @@
|
|||||||
[unstable]
|
[unstable]
|
||||||
# build-std = ["core", "compiler_builtins"]
|
build-std = ["core", "compiler_builtins"]
|
||||||
|
build-std-features = ["compiler-builtins-mem"]
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
# target = "x86_64-blog_os.json"
|
target = "x86_64-blog_os.json"
|
||||||
|
|
||||||
[target.'cfg(target_os = "none")']
|
[target.'cfg(target_os = "none")']
|
||||||
runner = "cargo run --manifest-path disk_image/Cargo.toml --bin runner --quiet"
|
runner = "bootimage runner"
|
||||||
|
|
||||||
[alias]
|
|
||||||
bootimage = "run --manifest-path disk_image/Cargo.toml --bin disk_image --quiet"
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Build Code
|
name: Code
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -16,6 +16,7 @@ jobs:
|
|||||||
check:
|
check:
|
||||||
name: Check
|
name: Check
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
platform: [
|
platform: [
|
||||||
ubuntu-latest,
|
ubuntu-latest,
|
||||||
@@ -41,6 +42,7 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
name: Test
|
name: Test
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
platform: [
|
platform: [
|
||||||
ubuntu-latest,
|
ubuntu-latest,
|
||||||
@@ -76,14 +78,10 @@ jobs:
|
|||||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||||
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 1
|
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 1
|
||||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||||
- name: Install Scoop (Windows)
|
|
||||||
run: |
|
|
||||||
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
|
|
||||||
echo ::add-path::$HOME\scoop\shims
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
shell: pwsh
|
|
||||||
- name: Install QEMU (Windows)
|
- name: Install QEMU (Windows)
|
||||||
run: scoop install qemu
|
run: |
|
||||||
|
choco install qemu --version 2021.5.5
|
||||||
|
echo "$Env:Programfiles\qemu" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows'
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
- name: "Print QEMU Version"
|
- name: "Print QEMU Version"
|
||||||
217
Cargo.lock
generated
217
Cargo.lock
generated
@@ -1,16 +1,12 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
[[package]]
|
version = 3
|
||||||
name = "anyhow"
|
|
||||||
version = "1.0.32"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bit_field"
|
name = "bit_field"
|
||||||
version = "0.9.0"
|
version = "0.10.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ed8765909f9009617974ab6b7d332625b320b33c326b1e9321382ef1999b5d56"
|
checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
@@ -24,58 +20,17 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bootloader",
|
"bootloader",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"rlibc",
|
|
||||||
"spin",
|
"spin",
|
||||||
"uart_16550",
|
"uart_16550",
|
||||||
"volatile",
|
"volatile 0.2.7",
|
||||||
"x86_64",
|
"x86_64",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bootloader"
|
name = "bootloader"
|
||||||
version = "0.9.8"
|
version = "0.9.23"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bootloader-locator"
|
|
||||||
version = "0.0.3"
|
|
||||||
dependencies = [
|
|
||||||
"cargo_metadata",
|
|
||||||
"locate-cargo-manifest",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cargo_metadata"
|
|
||||||
version = "0.11.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "89fec17b16f1ac67908af82e47d0a90a7afd0e1827b181cd77504323d3263d35"
|
checksum = "b6e02311b16c9819e7c72866d379cdd3026c3b7b25c1edf161f548f8e887e7ff"
|
||||||
dependencies = [
|
|
||||||
"semver",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "disk_image"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"anyhow",
|
|
||||||
"bootloader-locator",
|
|
||||||
"locate-cargo-manifest",
|
|
||||||
"runner-utils",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "itoa"
|
|
||||||
version = "0.4.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "json"
|
|
||||||
version = "0.12.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
@@ -86,181 +41,41 @@ dependencies = [
|
|||||||
"spin",
|
"spin",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libc"
|
|
||||||
version = "0.2.76"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "755456fae044e6fa1ebbbd1b3e902ae19e73097ed4ed87bb79934a867c007bc3"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "locate-cargo-manifest"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d264d672563b20c0a2eb9045f4072e1352002f6c316cc0677bed8b767e17b7e1"
|
|
||||||
dependencies = [
|
|
||||||
"json",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "proc-macro2"
|
|
||||||
version = "1.0.19"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12"
|
|
||||||
dependencies = [
|
|
||||||
"unicode-xid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "quote"
|
|
||||||
version = "1.0.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rlibc"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "runner-utils"
|
|
||||||
version = "0.0.2"
|
|
||||||
dependencies = [
|
|
||||||
"thiserror",
|
|
||||||
"wait-timeout",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ryu"
|
|
||||||
version = "1.0.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver"
|
|
||||||
version = "0.10.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "394cec28fa623e00903caf7ba4fa6fb9a0e260280bb8cdbbba029611108a0190"
|
|
||||||
dependencies = [
|
|
||||||
"semver-parser",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver-parser"
|
|
||||||
version = "0.7.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde"
|
|
||||||
version = "1.0.115"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5"
|
|
||||||
dependencies = [
|
|
||||||
"serde_derive",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_derive"
|
|
||||||
version = "1.0.115"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_json"
|
|
||||||
version = "1.0.57"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c"
|
|
||||||
dependencies = [
|
|
||||||
"itoa",
|
|
||||||
"ryu",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "spin"
|
name = "spin"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "syn"
|
|
||||||
version = "1.0.39"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "891d8d6567fe7c7f8835a3a98af4208f3846fba258c1bc3c31d6e506239f11f9"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"unicode-xid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thiserror"
|
|
||||||
version = "1.0.20"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08"
|
|
||||||
dependencies = [
|
|
||||||
"thiserror-impl",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thiserror-impl"
|
|
||||||
version = "1.0.20"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uart_16550"
|
name = "uart_16550"
|
||||||
version = "0.2.7"
|
version = "0.2.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e58fc40dc1712664fc9b0a7bd8ca2f21ab49960924fb245a80a05e1e92f3dfe9"
|
checksum = "503a6c0e6d82daa87985e662d120c0176b09587c92a68db22781b28ae95405dd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"x86_64",
|
"x86_64",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "volatile"
|
||||||
version = "0.2.1"
|
version = "0.2.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
checksum = "f6b06ad3ed06fef1713569d547cdbdb439eafed76341820fb0e0344f29a41945"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "volatile"
|
name = "volatile"
|
||||||
version = "0.4.0-alpha.00"
|
version = "0.4.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9a1da81878b88e2b57ca8b3d62c0c3e9979d9531cfe0e6d1c094174d8458eac6"
|
checksum = "e4c2dbd44eb8b53973357e6e207e370f0c1059990df850aca1eca8947cf464f0"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wait-timeout"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x86_64"
|
name = "x86_64"
|
||||||
version = "0.11.0"
|
version = "0.14.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "365de37eb7c6da582cbb510dd0f3f1235d24ff6309a8a96e8a9909cc9bfd608f"
|
checksum = "fb611915c917c6296d11e23f71ff1ecfe49c5766daba92cd3df52df6b58285b6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit_field",
|
"bit_field",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
"volatile 0.4.4",
|
||||||
]
|
]
|
||||||
|
|||||||
12
Cargo.toml
12
Cargo.toml
@@ -4,21 +4,15 @@ version = "0.1.0"
|
|||||||
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
|
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[workspace]
|
|
||||||
members = [
|
|
||||||
"disk_image",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "should_panic"
|
name = "should_panic"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bootloader = { path = "../../uefi-test"}
|
bootloader = "0.9.8"
|
||||||
rlibc = "1.0.0"
|
volatile = "0.2.6"
|
||||||
volatile = "0.4.0-alpha"
|
|
||||||
spin = "0.5.2"
|
spin = "0.5.2"
|
||||||
x86_64 = "0.11.0"
|
x86_64 = "0.14.2"
|
||||||
uart_16550 = "0.2.0"
|
uart_16550 = "0.2.0"
|
||||||
|
|
||||||
[dependencies.lazy_static]
|
[dependencies.lazy_static]
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
# Blog OS (Testing)
|
# Blog OS (CPU Exceptions)
|
||||||
|
|
||||||
[](https://github.com/phil-opp/blog_os/actions?query=workflow%3A%22Build+Code%22+branch%3Apost-04)
|
[](https://github.com/phil-opp/blog_os/actions?query=workflow%3A%22Code%22+branch%3Apost-05)
|
||||||
|
|
||||||
This repository contains the source code for the [Testing][post] post of the [Writing an OS in Rust](https://os.phil-opp.com) series.
|
This repository contains the source code for the [CPU Exceptions][post] post of the [Writing an OS in Rust](https://os.phil-opp.com) series.
|
||||||
|
|
||||||
[post]: https://os.phil-opp.com/testing/
|
[post]: https://os.phil-opp.com/cpu-exceptions/
|
||||||
|
|
||||||
**Check out the [master branch](https://github.com/phil-opp/blog_os) for more information.**
|
**Check out the [master branch](https://github.com/phil-opp/blog_os) for more information.**
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "disk_image"
|
|
||||||
version = "0.1.0"
|
|
||||||
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
|
|
||||||
edition = "2018"
|
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
anyhow = "1.0.32"
|
|
||||||
bootloader-locator = {path = "../../../bootloader-locator"}
|
|
||||||
runner-utils = { path = "../../../runner-utils/" }
|
|
||||||
locate-cargo-manifest = "0.2.0"
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
use anyhow::anyhow;
|
|
||||||
use std::{
|
|
||||||
path::PathBuf,
|
|
||||||
process::{Command, ExitStatus},
|
|
||||||
time::Duration,
|
|
||||||
};
|
|
||||||
|
|
||||||
const RUN_ARGS: &[&str] = &["-d", "int", "--no-reboot", "-s"];
|
|
||||||
const TEST_ARGS: &[&str] = &[
|
|
||||||
"-device",
|
|
||||||
"isa-debug-exit,iobase=0xf4,iosize=0x04",
|
|
||||||
"-serial",
|
|
||||||
"stdio",
|
|
||||||
"-display",
|
|
||||||
"none",
|
|
||||||
"--no-reboot",
|
|
||||||
];
|
|
||||||
const TEST_TIMEOUT_SECS: u64 = 10;
|
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
|
||||||
let kernel_binary_path = {
|
|
||||||
let path = PathBuf::from(std::env::args().nth(1).unwrap());
|
|
||||||
path.canonicalize()?
|
|
||||||
};
|
|
||||||
|
|
||||||
let disk_image = disk_image::create_disk_image(&kernel_binary_path, true)?;
|
|
||||||
|
|
||||||
let mut run_cmd = Command::new("qemu-system-x86_64");
|
|
||||||
run_cmd
|
|
||||||
.arg("-drive")
|
|
||||||
.arg(format!("format=raw,file={}", disk_image.display()));
|
|
||||||
|
|
||||||
let binary_kind = runner_utils::binary_kind(&kernel_binary_path);
|
|
||||||
if binary_kind.is_test() {
|
|
||||||
run_cmd.args(TEST_ARGS);
|
|
||||||
|
|
||||||
let exit_status = run_test_command(run_cmd)?;
|
|
||||||
match exit_status.code() {
|
|
||||||
Some(33) => {} // success
|
|
||||||
other => return Err(anyhow!("Test failed (exit code: {:?})", other)),
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
run_cmd.args(RUN_ARGS);
|
|
||||||
|
|
||||||
let exit_status = run_cmd.status()?;
|
|
||||||
if !exit_status.success() {
|
|
||||||
std::process::exit(exit_status.code().unwrap_or(1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run_test_command(mut cmd: Command) -> anyhow::Result<ExitStatus> {
|
|
||||||
let status = runner_utils::run_with_timeout(&mut cmd, Duration::from_secs(TEST_TIMEOUT_SECS))?;
|
|
||||||
Ok(status)
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
use anyhow::anyhow;
|
|
||||||
use std::{
|
|
||||||
path::{Path, PathBuf},
|
|
||||||
process::Command,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn create_disk_image(kernel_binary_path: &Path, bios_only: bool) -> anyhow::Result<PathBuf> {
|
|
||||||
let bootloader_info = bootloader_locator::locate_bootloader()?;
|
|
||||||
let kernel_manifest_path = &bootloader_info.kernel_manifest_path;
|
|
||||||
|
|
||||||
let mut build_cmd = Command::new(env!("CARGO"));
|
|
||||||
build_cmd.current_dir(bootloader_info.package.manifest_path.parent().unwrap());
|
|
||||||
build_cmd.arg("builder");
|
|
||||||
build_cmd
|
|
||||||
.arg("--kernel-manifest")
|
|
||||||
.arg(&kernel_manifest_path);
|
|
||||||
build_cmd.arg("--kernel-binary").arg(&kernel_binary_path);
|
|
||||||
build_cmd
|
|
||||||
.arg("--target-dir")
|
|
||||||
.arg(kernel_manifest_path.parent().unwrap().join("target"));
|
|
||||||
build_cmd
|
|
||||||
.arg("--out-dir")
|
|
||||||
.arg(kernel_binary_path.parent().unwrap());
|
|
||||||
build_cmd.arg("--quiet");
|
|
||||||
if bios_only {
|
|
||||||
build_cmd.arg("--firmware").arg("bios");
|
|
||||||
}
|
|
||||||
|
|
||||||
if !build_cmd.status()?.success() {
|
|
||||||
return Err(anyhow!("build failed"));
|
|
||||||
}
|
|
||||||
|
|
||||||
let kernel_binary_name = kernel_binary_path.file_name().unwrap().to_str().unwrap();
|
|
||||||
let disk_image = kernel_binary_path
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.join(format!("bootimage-bios-{}.bin", kernel_binary_name));
|
|
||||||
if !disk_image.exists() {
|
|
||||||
return Err(anyhow!(
|
|
||||||
"Disk image does not exist at {} after bootloader build",
|
|
||||||
disk_image.display()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
Ok(disk_image)
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
use anyhow::anyhow;
|
|
||||||
use std::process::Command;
|
|
||||||
|
|
||||||
const TARGET_NAME: &str = "x86_64-blog_os";
|
|
||||||
const KERNEL_BINARIES: &[&str] = &["blog_os"];
|
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
|
||||||
// build all binaries
|
|
||||||
let mut build_cmd = Command::new(env!("CARGO"));
|
|
||||||
build_cmd.arg("build");
|
|
||||||
build_cmd.arg("--release");
|
|
||||||
build_cmd.arg("-Zbuild-std=core");
|
|
||||||
build_cmd
|
|
||||||
.arg("--target")
|
|
||||||
.arg(format!("{}.json", TARGET_NAME));
|
|
||||||
if !build_cmd.status()?.success() {
|
|
||||||
return Err(anyhow!("build failed"));
|
|
||||||
};
|
|
||||||
|
|
||||||
let kernel_manifest = locate_cargo_manifest::locate_manifest()?;
|
|
||||||
let target_dir_root = kernel_manifest.parent().unwrap().join("target");
|
|
||||||
let target_dir = target_dir_root.join(TARGET_NAME).join("release");
|
|
||||||
|
|
||||||
for binary_name in KERNEL_BINARIES {
|
|
||||||
let binary_path = {
|
|
||||||
let path = target_dir.join(binary_name);
|
|
||||||
path.canonicalize()?
|
|
||||||
};
|
|
||||||
|
|
||||||
let disk_image = disk_image::create_disk_image(&binary_path, false)?;
|
|
||||||
|
|
||||||
println!(
|
|
||||||
"Created disk image for binary {} at {}",
|
|
||||||
binary_name,
|
|
||||||
disk_image.display()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
25
src/interrupts.rs
Normal file
25
src/interrupts.rs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
use crate::println;
|
||||||
|
use lazy_static::lazy_static;
|
||||||
|
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
static ref IDT: InterruptDescriptorTable = {
|
||||||
|
let mut idt = InterruptDescriptorTable::new();
|
||||||
|
idt.breakpoint.set_handler_fn(breakpoint_handler);
|
||||||
|
idt
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn init_idt() {
|
||||||
|
IDT.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "x86-interrupt" fn breakpoint_handler(stack_frame: InterruptStackFrame) {
|
||||||
|
println!("EXCEPTION: BREAKPOINT\n{:#?}", stack_frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test_case]
|
||||||
|
fn test_breakpoint_exception() {
|
||||||
|
// invoke a breakpoint exception
|
||||||
|
x86_64::instructions::interrupts::int3();
|
||||||
|
}
|
||||||
10
src/lib.rs
10
src/lib.rs
@@ -1,16 +1,19 @@
|
|||||||
#![no_std]
|
#![no_std]
|
||||||
#![cfg_attr(test, no_main)]
|
#![cfg_attr(test, no_main)]
|
||||||
#![feature(custom_test_frameworks)]
|
#![feature(custom_test_frameworks)]
|
||||||
|
#![feature(abi_x86_interrupt)]
|
||||||
#![test_runner(crate::test_runner)]
|
#![test_runner(crate::test_runner)]
|
||||||
#![reexport_test_harness_main = "test_main"]
|
#![reexport_test_harness_main = "test_main"]
|
||||||
|
|
||||||
extern crate rlibc;
|
|
||||||
|
|
||||||
use core::panic::PanicInfo;
|
use core::panic::PanicInfo;
|
||||||
|
|
||||||
|
pub mod interrupts;
|
||||||
pub mod serial;
|
pub mod serial;
|
||||||
//pub mod vga_buffer;
|
pub mod vga_buffer;
|
||||||
|
|
||||||
|
pub fn init() {
|
||||||
|
interrupts::init_idt();
|
||||||
|
}
|
||||||
pub trait Testable {
|
pub trait Testable {
|
||||||
fn run(&self) -> ();
|
fn run(&self) -> ();
|
||||||
}
|
}
|
||||||
@@ -61,6 +64,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn _start() -> ! {
|
pub extern "C" fn _start() -> ! {
|
||||||
|
init();
|
||||||
test_main();
|
test_main();
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|||||||
32
src/main.rs
32
src/main.rs
@@ -4,36 +4,30 @@
|
|||||||
#![test_runner(blog_os::test_runner)]
|
#![test_runner(blog_os::test_runner)]
|
||||||
#![reexport_test_harness_main = "test_main"]
|
#![reexport_test_harness_main = "test_main"]
|
||||||
|
|
||||||
use blog_os::serial_println;
|
use blog_os::println;
|
||||||
use core::{panic::PanicInfo, ptr, slice};
|
use core::panic::PanicInfo;
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn _start(boot_info: &'static mut bootloader::boot_info::BootInfo) -> ! {
|
pub extern "C" fn _start() -> ! {
|
||||||
|
println!("Hello World{}", "!");
|
||||||
|
|
||||||
|
blog_os::init();
|
||||||
|
|
||||||
|
// invoke a breakpoint exception
|
||||||
|
x86_64::instructions::interrupts::int3();
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
test_main();
|
test_main();
|
||||||
|
|
||||||
let mut framebuffer = {
|
println!("It did not crash!");
|
||||||
let ptr = boot_info.framebuffer.start_addr as *mut u8;
|
loop {}
|
||||||
let slice = unsafe { slice::from_raw_parts_mut(ptr, boot_info.framebuffer.len) };
|
|
||||||
volatile::Volatile::new(slice)
|
|
||||||
};
|
|
||||||
|
|
||||||
//serial_println!("Hello World{}", "!");
|
|
||||||
|
|
||||||
for i in 0..boot_info.framebuffer.len {
|
|
||||||
framebuffer.index_mut(i).write(0x99);
|
|
||||||
}
|
|
||||||
|
|
||||||
loop {
|
|
||||||
x86_64::instructions::hlt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This function is called on panic.
|
/// This function is called on panic.
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
fn panic(info: &PanicInfo) -> ! {
|
||||||
serial_println!("{}", info);
|
println!("{}", info);
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#![test_runner(blog_os::test_runner)]
|
#![test_runner(blog_os::test_runner)]
|
||||||
#![reexport_test_harness_main = "test_main"]
|
#![reexport_test_harness_main = "test_main"]
|
||||||
|
|
||||||
|
use blog_os::println;
|
||||||
use core::panic::PanicInfo;
|
use core::panic::PanicInfo;
|
||||||
|
|
||||||
#[no_mangle] // don't mangle the name of this function
|
#[no_mangle] // don't mangle the name of this function
|
||||||
@@ -20,5 +21,5 @@ fn panic(info: &PanicInfo) -> ! {
|
|||||||
|
|
||||||
#[test_case]
|
#[test_case]
|
||||||
fn test_println() {
|
fn test_println() {
|
||||||
//println!("test_println output");
|
println!("test_println output");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user