-
Notifications
You must be signed in to change notification settings - Fork 423
feat: add basic loongarch64 support #126
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
Open
Godones
wants to merge
19
commits into
arceos-org:main
Choose a base branch
from
Godones:la64
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,238
−36
Open
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
34de609
feat: add basic loongarch64 support
Godones fabae91
fix: fix the CI error about loongarch64 crate
Godones 7aa5260
refactor: use loongarch64 crate
Godones 42fdc45
refactor: Remove most useless code
Godones ad413d0
feat: pass apps/exception
Godones a2b1f30
feat: Support yield application
Godones f4c2b70
Implement support for all apps/task and fs.
Godones 3606df6
Restore cargo.lock
Godones e83ec55
feat: Add basic C App support for la64
Godones a1fa046
feat: support net/display app
Godones f20bf83
fix: fix some formatting errors
Godones 754b950
fix: update page table impl
Godones 2d41808
Restore cargo.lock on the main branch
Godones b7c3360
doc: add doc for la64
Godones ccd44e1
fix: fix the condition judgment error
Godones b2c67b7
doc: add documentation
Godones 38f0e86
feat: remove the bios dep for loongarch64-qemu-virt
Godones e81c425
remove dead code
Godones 2d32006
update doc
Godones File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,4 @@ | |
| actual.out | ||
| qemu.log | ||
| rusty-tags.vi | ||
| .idea | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| smp = 1 | ||
| build_mode = release | ||
| log_level = debug | ||
|
|
||
| Primary CPU 0 started, | ||
| Found physcial memory regions: | ||
| .text (READ | EXECUTE | RESERVED) | ||
| .rodata (READ | RESERVED) | ||
| .data .tdata .tbss .percpu (READ | WRITE | RESERVED) | ||
| .percpu (READ | WRITE | RESERVED) | ||
| boot stack (READ | WRITE | RESERVED) | ||
| .bss (READ | WRITE | RESERVED) | ||
| free memory (READ | WRITE | FREE) | ||
| Initialize platform devices... | ||
| Primary CPU 0 init OK. | ||
| Running exception tests... | ||
| Exception(Breakpoint) @ 0x[0-9a-f]\{16\} | ||
| Exception tests run OK! | ||
| Shutting down... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| use core::arch::asm; | ||
|
|
||
| /// Bit 2: Supervisor Interrupt Enable | ||
| const IE_BIT: usize = 1 << 2; | ||
|
|
||
| #[inline] | ||
| pub fn local_irq_save_and_disable() -> usize { | ||
| let mut flags: usize = 0; | ||
| // clear the `IE` bit, and return the old CSR | ||
| unsafe { asm!("csrxchg {}, {}, 0x0", inout(reg) flags, in(reg) IE_BIT) }; | ||
| flags & IE_BIT | ||
| } | ||
|
|
||
| #[inline] | ||
| pub fn local_irq_restore(mut flags: usize) { | ||
| // restore the `IE` bit | ||
| unsafe { asm!("csrxchg {}, {}, 0x0", inout(reg) flags, in(reg) IE_BIT) }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| //! LoongArch64 specific page table structures. | ||
|
|
||
| use crate::{PageTable64, PagingMetaData}; | ||
|
|
||
| use page_table_entry::loongarch64::LA64PTE; | ||
| /// Metadata of LoongArch64 page tables. | ||
| #[derive(Copy, Clone, Debug)] | ||
| pub struct LA64MetaData; | ||
|
|
||
| impl const PagingMetaData for LA64MetaData { | ||
| const LEVELS: usize = 4; | ||
| const PA_MAX_BITS: usize = 48; | ||
| const VA_MAX_BITS: usize = 48; | ||
| } | ||
|
|
||
| pub type LA64PageTable<I> = PageTable64<LA64MetaData, LA64PTE, I>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.