Skip to content

Commit

Permalink
VGA support
Browse files Browse the repository at this point in the history
  • Loading branch information
AtsukiTak committed Jun 12, 2019
1 parent 5a99695 commit b772604
Show file tree
Hide file tree
Showing 6 changed files with 304 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build]
target = "x86_64-atomix.json"

[target.'cfg(target_os = "none")']
runner = "bootimage runner"
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
*.swp


#Added by cargo
#
#already existing elements are commented out

/target
**/*.rs.bk
243 changes: 243 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "atomix"
version = "0.1.0"
authors = ["AtsukiTak <[email protected]>"]
edition = "2018"

[dependencies]
bootloader = "~0.6"
25 changes: 25 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#![no_std]
#![no_main]

use core::panic::PanicInfo;

static HELLO: &[u8] = b"Hello ATOMIX!!";

#[no_mangle]
pub extern "C" fn _start() -> ! {
let vga_buffer = 0xb8000 as *mut u8;

for (i, &byte) in HELLO.iter().enumerate() {
unsafe {
*vga_buffer.offset(i as isize * 2) = byte;
*vga_buffer.offset(i as isize * 2 + 1) = 0xb;
}
}

loop {}
}

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
15 changes: 15 additions & 0 deletions x86_64-atomix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"llvm-target": "x86_64-unknown-none",
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"arch": "x86_64",
"target-endian": "little",
"target-pointer-width": "64",
"target-c-int-width": "32",
"os": "none",
"executables": true,
"linker-flavor": "ld.lld",
"linker": "rust-lld",
"panic-strategy": "abort",
"disable-redzone": true,
"features": "-mmx,-sse,+soft-float"
}

0 comments on commit b772604

Please sign in to comment.