Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit f12be2b

Browse files
authored
V0.1.0: launching, VGA text buffer (#4)
* toml file was added for building the kernel * the target for build was set * implemented basic output using VGA buffer * RandyX: launching via qemu * RandyX: documentation + multikernel architecture
1 parent 6ccceaf commit f12be2b

File tree

9 files changed

+68
-1
lines changed

9 files changed

+68
-1
lines changed

.cargo/config.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
[unstable]
2+
build-std-features = ["compiler-builtins-mem"]
23
build-std = ["core", "compiler_builtins"]
4+
5+
[build]
6+
target = "x86_64-randyx.json"
7+
8+
[target.'cfg(target_os = "none")']
9+
runner = "bootimage runner"

Cargo.lock

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ panic = "abort"
1414
panic = "abort"
1515

1616
[dependencies]
17+
bootloader = "0.9.8"

Documentation/running/running.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Running RandyX kernel
2+
3+
## To be able to run RandyX kernel you need to:
4+
5+
- have installed rustc nightly
6+
```
7+
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
8+
```
9+
10+
- install bootimage to be able to run the kernel
11+
```
12+
cargo install bootimage
13+
```
14+
15+
- install llvm-tools-preview
16+
```
17+
rustup component add llvm-tools-preview
18+
```
19+
20+
## Running
21+
22+
- install quemu
23+
```
24+
sudo apt install qemu-system-x86_64
25+
```
26+
27+
- run the kernel
28+
```
29+
cargo run
30+
```

os/kernel/core/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub(crate) mod vga_output;

os/kernel/core/vga_output.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
pub fn vga_output_message(HELLO: &[u8]) {
2+
let vga_buffer = 0xb8000 as *mut u8;
3+
4+
for(i, &byte) in HELLO.iter().enumerate(){
5+
unsafe {
6+
*vga_buffer.offset(i as isize * 2) = byte;
7+
*vga_buffer.offset(i as isize * 2 + 1) = 0xb;
8+
}
9+
}
10+
}

os/kernel/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub(crate) mod core;

os/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,20 @@
1818
#![no_std]
1919
#![no_main]
2020

21+
mod kernel;
22+
2123
use core::panic::PanicInfo;
24+
use crate::kernel::core::vga_output::vga_output_message;
2225

2326
#[panic_handler]
2427
fn panic(_info: &PanicInfo) -> ! {
2528
loop{}
2629
}
2730

31+
static HELLO: &[u8] = b"RandyX is running...";
2832
#[no_mangle]
2933
pub extern "C" fn _start() -> ! {
34+
vga_output_message(HELLO);
35+
3036
loop{}
31-
}
37+
}

rust-toolchain.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[toolchain]
2+
channel = "nightly"

0 commit comments

Comments
 (0)