Merge pull request #1226 from SPuntte/fix-post-06-ub-panic

Fix panics caused by misaligned pointer dereferences in "Double Faults" & "Introduction to Paging"
This commit is contained in:
Philipp Oppermann
2023-06-02 09:21:06 +02:00
committed by GitHub
9 changed files with 13 additions and 13 deletions

View File

@@ -49,7 +49,7 @@ pub extern "C" fn _start() -> ! {
// trigger a page fault
unsafe {
*(0xdeadbeef as *mut u64) = 42;
*(0xdeadbeef as *mut u8) = 42;
};
// as before

View File

@@ -45,7 +45,7 @@ pub extern "C" fn _start() -> ! {
// ページフォルトを起こす
unsafe {
*(0xdeadbeef as *mut u64) = 42;
*(0xdeadbeef as *mut u8) = 42;
};
// 前回同様

View File

@@ -48,7 +48,7 @@ pub extern "C" fn _start() -> ! {
// 페이지 폴트 일으키기
unsafe {
*(0xdeadbeef as *mut u64) = 42;
*(0xdeadbeef as *mut u8) = 42;
};
// 이전과 동일

View File

@@ -42,7 +42,7 @@ pub extern "C" fn _start() -> ! {
// trigger a page fault
unsafe {
*(0xdeadbeef as *mut u64) = 42;
*(0xdeadbeef as *mut u8) = 42;
};
// as before

View File

@@ -47,7 +47,7 @@ pub extern "C" fn _start() -> ! {
// trigger a page fault
unsafe {
*(0xdeadbeef as *mut u64) = 42;
*(0xdeadbeef as *mut u8) = 42;
};
// as before

View File

@@ -322,7 +322,7 @@ pub extern "C" fn _start() -> ! {
blog_os::init();
// new
let ptr = 0xdeadbeaf as *mut u32;
let ptr = 0xdeadbeaf as *mut u8;
unsafe { *ptr = 42; }
// as before
@@ -347,7 +347,7 @@ pub extern "C" fn _start() -> ! {
```rust
// Note: The actual address might be different for you. Use the address that
// your page fault handler reports.
let ptr = 0x2031b2 as *mut u32;
let ptr = 0x2031b2 as *mut u8;
// read from a code page
unsafe { let x = *ptr; }

View File

@@ -329,7 +329,7 @@ pub extern "C" fn _start() -> ! {
blog_os::init();
// ここを追加
let ptr = 0xdeadbeaf as *mut u32;
let ptr = 0xdeadbeaf as *mut u8;
unsafe { *ptr = 42; }
// ここはこれまでと同じ
@@ -354,7 +354,7 @@ pub extern "C" fn _start() -> ! {
```rust
// 注意:実際のアドレスは個々人で違うかもしれません。
// あなたのページフォルトハンドラが報告した値を使ってください。
let ptr = 0x2031b2 as *mut u32;
let ptr = 0x2031b2 as *mut u8;
// コードページから読み込む
unsafe { let x = *ptr; }

View File

@@ -316,7 +316,7 @@ pub extern "C" fn _start() -> ! {
blog_os::init();
// new
let ptr = 0xdeadbeaf as *mut u32;
let ptr = 0xdeadbeaf as *mut u8;
unsafe { *ptr = 42; }
// as before
@@ -341,7 +341,7 @@ We see that the current instruction pointer is `0x2031b2`, so we know that this
```rust
// Note: The actual address might be different for you. Use the address that
// your page fault handler reports.
let ptr = 0x2031b2 as *mut u32;
let ptr = 0x2031b2 as *mut u8;
// read from a code page
unsafe { let x = *ptr; }

View File

@@ -325,7 +325,7 @@ pub extern "C" fn _start() -> ! {
blog_os::init();
// new
let ptr = 0xdeadbeaf as *mut u32;
let ptr = 0xdeadbeaf as *mut u8;
unsafe { *ptr = 42; }
// as before
@@ -350,7 +350,7 @@ pub extern "C" fn _start() -> ! {
```rust
// Note: The actual address might be different for you. Use the address that
// your page fault handler reports.
let ptr = 0x2031b2 as *mut u32;
let ptr = 0x2031b2 as *mut u8;
// read from a code page
unsafe { let x = *ptr; }