-
Notifications
You must be signed in to change notification settings - Fork 1
add aarch64 support #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: stage0-aarch64
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -23,6 +23,12 @@ | |||
| * DEALINGS IN THE SOFTWARE. | ||||
| * | ||||
| */ | ||||
|
|
||||
| .section ".data" | ||||
| .global boot_stack | ||||
| .balign 0x10 | ||||
| boot_stack: .skip 0x2000 | ||||
|
|
||||
| .section ".text.boot" | ||||
|
|
||||
| .global _start | ||||
|
|
@@ -38,7 +44,8 @@ _start: | |||
| 2: // cpu id == 0 | ||||
|
|
||||
| // init 1G stack stack in RAM area (>0x40000000 for qemu virt device) | ||||
| movz x1, 0x5000, lsl 16 | ||||
| //movz x1, 0x5000, lsl 16 | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not a friend of leaving unused code in the file, would suggest to remove it. For viewing the diff to the qemu-version, I will create a qemu-branch, so one could simply do
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, removing is the better option |
||||
| ldr x1, =(boot_stack+0x2000-0x10) | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be great, if you could explain this line in a comment above |
||||
| mov sp, x1 | ||||
|
|
||||
| // jump to Rust code, should not return | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,5 @@ | ||||||
| use core::fmt; | ||||||
| use spin::Mutex; | ||||||
| use aarch64::io::*; | ||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not using
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For what? |
||||||
| use core::ptr::write_volatile; | ||||||
|
|
||||||
| /// A COM serial port. | ||||||
| pub struct ComPort { | ||||||
|
|
@@ -23,11 +22,11 @@ impl fmt::Write for ComPort { | |||||
| // Output each byte of our string. | ||||||
| for &b in s.as_bytes() { | ||||||
| // Write our byte. | ||||||
| write_byte(self.port_address, b); | ||||||
| unsafe { write_volatile(self.port_address as *mut u8, b); } | ||||||
| } | ||||||
| Ok(()) | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| /// Our primary serial port. | ||||||
| pub static COM1: Mutex<ComPort> = Mutex::new(ComPort::new(0x09000000)); | ||||||
| pub static mut COM1: ComPort = ComPort::new(0x800 /*0x09000000*/); | ||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,13 @@ | ||
| //! A wrapper around our serial console. | ||
|
|
||
| use core::fmt; | ||
| use spin::Mutex; | ||
| use arch::serial; | ||
|
|
||
| pub struct Console; | ||
|
|
||
| impl fmt::Write for Console { | ||
| /// Output a string to each of our console outputs. | ||
| fn write_str(&mut self, s: &str) -> fmt::Result { | ||
| serial::COM1.lock().write_str(s) | ||
| unsafe { serial::COM1.write_str(s) } | ||
| } | ||
| } | ||
|
|
||
| pub static CONSOLE: Mutex<Console> = Mutex::new(Console); |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||
| #![feature(asm, const_fn, lang_items, global_asm)] | ||||
| #![no_std] | ||||
|
|
||||
| extern crate spin; | ||||
| //extern crate spin; | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| #[cfg(target_arch = "x86_64")] | ||||
| extern crate x86; | ||||
|
|
||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.