Skip to content

Commit

Permalink
Paging tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgian committed Jul 1, 2023
1 parent 9b2a49b commit a6ad846
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/hello/linker.ld
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ENTRY(_start)

SECTIONS {
. = 0x00500000;
. = 0x02000000;

.start_marker :
{
Expand Down
5 changes: 5 additions & 0 deletions kernel/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use interrupts::idt::IDT;
use shell::shell::SHELL;
use syscalls::print::PRINTER;
use memory::paging::PAGING;
use memory::paging::TABLES;
use memory::paging::PageTable;

use multitasking::task::TASK_MANAGER;
Expand Down Expand Up @@ -50,6 +51,10 @@ pub extern "C" fn _start() -> ! {
//setup paging
unsafe {
PAGING.identity();

TABLES[8].set(0x00a0_0000);
PAGING.set_table(8, &TABLES[8]);

PAGING.enable();
}

Expand Down
4 changes: 2 additions & 2 deletions kernel/src/memory/paging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ impl PageDirectory {
}
}

//indentity page first 16MiB
//indentity page first 32MiB
pub fn identity(&mut self) {
unsafe {
for i in 0..4 {
for i in 0..8 {
TABLES[i].set((0x0040_0000 * i) as u32);
PAGING.set_table(i, &TABLES[i]);
}
Expand Down
6 changes: 3 additions & 3 deletions kernel/src/multitasking/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ fn task_a() {
let mut a: u32 = 0;
let mut b: u8 = 0;
loop {
if a == 300_000_000 {
if a == 100_000_000 {
libfelix::println!("Process A running. {}% complete.", b);
a = 0;
b += 1;
Expand All @@ -260,7 +260,7 @@ fn task_b() {
let mut a: u32 = 0;
let mut b: u8 = 0;
loop {
if a == 300_000_000 {
if a == 100_000_000 {
libfelix::println!("Process B running. {}% complete.", b);
a = 0;
b += 1;
Expand All @@ -279,7 +279,7 @@ fn task_c() {
let mut a: u32 = 0;
let mut b: u8 = 0;
loop {
if a == 300_000_000 {
if a == 100_000_000 {
libfelix::println!("Process C running. {}% complete.", b);
a = 0;
b += 1;
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/shell/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::filesystem::fat::FAT;
use crate::syscalls::print::PRINTER;
use crate::multitasking::task::TASK_MANAGER;

const APP_TARGET: u32 = 0x0050_0000;
const APP_TARGET: u32 = 0x00a0_0000;
const APP_SIGNATURE: u32 = 0xB16B00B5;

const HELP: &'static str = "Available commands:
Expand Down

0 comments on commit a6ad846

Please sign in to comment.