Skip to content

Commit

Permalink
fix: rename arch to polyhal
Browse files Browse the repository at this point in the history
  • Loading branch information
yfblock committed Apr 30, 2024
1 parent ab1810e commit 2f36907
Show file tree
Hide file tree
Showing 21 changed files with 77 additions and 85 deletions.
88 changes: 43 additions & 45 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion byteos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ MOUNT_IMG_PATH = "mount.img"
target = "riscv64gc-unknown-none-elf"
[bin.riscv64-qemu.configs]
driver = "kvirtio,kgoldfish-rtc,ns16550a"
root_fs = "ext4"

# build for x86_64-qemu
[bin.x86_64-qemu]
target = "x86_64-unknown-none"
[bin.x86_64-qemu.configs]
driver = "kvirtio,kgoldfish-rtc,ns16550a"
root_fs = "ext4"

# build for aarch64-qemu
[bin.aarch64-qemu]
Expand Down
2 changes: 1 addition & 1 deletion kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ logging = { git = "https://github.com/Byte-OS/logging.git", features = []}
log = "0.4"
devices = { git = "https://github.com/Byte-OS/devices.git" }
hal = { git = "https://github.com/Byte-OS/hal.git" }
arch = { git = "https://github.com/Byte-OS/arch.git" }
polyhal = { git = "https://github.com/Byte-OS/polyhal.git" }
fs = { git = "https://github.com/Byte-OS/fs.git" }
fdt = "0.1.5"
executor = { git = "https://github.com/Byte-OS/executor.git" }
Expand Down
14 changes: 7 additions & 7 deletions kernel/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ mod syscall;
mod tasks;
mod user;

use arch::addr::{PhysPage, VirtPage};
use arch::multicore::MultiCore;
use arch::{
use polyhal::addr::{PhysPage, VirtPage};
use polyhal::multicore::MultiCore;
use polyhal::{
disable_irq, enable_irq, get_mem_areas, PageAlloc, TrapFrame, TrapFrameArgs, TrapType,
VIRT_ADDR_START,
};
Expand Down Expand Up @@ -61,7 +61,7 @@ impl PageAlloc for PageAllocImpl {
}
}

#[arch::arch_interrupt]
#[polyhal::arch_interrupt]
/// Handle kernel interrupt
fn kernel_interrupt(cx_ref: &mut TrapFrame, trap_type: TrapType) {
match trap_type {
Expand Down Expand Up @@ -135,7 +135,7 @@ fn kernel_interrupt(cx_ref: &mut TrapFrame, trap_type: TrapType) {
}

/// The kernel entry
#[arch::arch_entry]
#[polyhal::arch_entry]
fn main(hart_id: usize) {
disable_irq();
if hart_id == 0 {
Expand All @@ -152,7 +152,7 @@ fn main(hart_id: usize) {
// initialize logging module
logging::init(option_env!("LOG"));

arch::init(&PageAllocImpl);
polyhal::init(&PageAllocImpl);
get_mem_areas().into_iter().for_each(|(start, size)| {
frame_allocator::add_frame_map(start, start + size);
});
Expand All @@ -166,7 +166,7 @@ fn main(hart_id: usize) {

devices::prepare_drivers();

if let Some(fdt) = arch::get_fdt() {
if let Some(fdt) = polyhal::get_fdt() {
for node in fdt.all_nodes() {
devices::try_to_add_device(&node);
}
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/panic.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use arch::{hart_id, shutdown};
use polyhal::{hart_id, shutdown};
// use backtrace::backtrace;
use core::panic::PanicInfo;

Expand Down
2 changes: 1 addition & 1 deletion kernel/src/socket.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::{cmp, net::SocketAddrV4};

use alloc::{sync::Arc, vec::Vec};
use arch::debug::DebugConsole;
use polyhal::debug::DebugConsole;
use fs::INodeInterface;
use lose_net_stack::net_trait::SocketInterface;
use sync::Mutex;
Expand Down
6 changes: 3 additions & 3 deletions kernel/src/syscall/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
use core::fmt::{Debug, Display};
use core::marker::PhantomData;

use arch::addr::VirtAddr;
use arch::pagetable::MappingFlags;
use arch::TrapFrame;
use polyhal::addr::VirtAddr;
use polyhal::pagetable::MappingFlags;
use polyhal::TrapFrame;
use bitflags::bitflags;
use cfg_if::cfg_if;
use fs::VfsError;
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/syscall/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use num_traits::FromPrimitive;
use vfscore::FileType;

use alloc::sync::Arc;
use arch::addr::VirtAddr;
use polyhal::addr::VirtAddr;
use bit_field::BitArray;
use executor::yield_now;
use fs::pipe::create_pipe;
Expand Down
6 changes: 3 additions & 3 deletions kernel/src/syscall/mm.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use core::ops::Add;

use arch::addr::{VirtAddr, VirtPage};
use arch::PAGE_SIZE;
use arch::USER_VADDR_END;
use polyhal::addr::{VirtAddr, VirtPage};
use polyhal::PAGE_SIZE;
use polyhal::USER_VADDR_END;
use frame_allocator::ceil_div;
use log::debug;

Expand Down
4 changes: 2 additions & 2 deletions kernel/src/syscall/shm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use core::ops::Add;

use crate::tasks::{MapedSharedMemory, SharedMemory, SHARED_MEMORY};
use alloc::{sync::Arc, vec::Vec};
use arch::addr::{VirtAddr, VirtPage};
use arch::{pagetable::MappingFlags, PAGE_SIZE};
use polyhal::addr::{VirtAddr, VirtPage};
use polyhal::{pagetable::MappingFlags, PAGE_SIZE};
use frame_allocator::{ceil_div, frame_alloc_much, FrameTracker};
use log::debug;

Expand Down
2 changes: 1 addition & 1 deletion kernel/src/syscall/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use alloc::{
vec::Vec,
{boxed::Box, sync::Arc},
};
use arch::{
use polyhal::{
addr::VirtPage,
pagetable::MappingFlags,
time::Time,
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/syscall/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::{
task::{Context, Poll},
};

use arch::time::Time;
use polyhal::time::Time;
use executor::select;
use fs::TimeSpec;
pub use hal::current_nsec;
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/tasks/async_ops.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::{cmp, future::Future, pin::Pin, task::Poll};

use alloc::{sync::Arc, vec::Vec};
use arch::time::Time;
use polyhal::time::Time;
use executor::AsyncTask;
use sync::Mutex;

Expand Down
4 changes: 2 additions & 2 deletions kernel/src/tasks/elf.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloc::{collections::BTreeMap, string::String, sync::Arc, vec::Vec};
use arch::addr::VirtPage;
use arch::{TrapFrame, TrapFrameArgs, PAGE_SIZE};
use polyhal::addr::VirtPage;
use polyhal::{TrapFrame, TrapFrameArgs, PAGE_SIZE};
use executor::AsyncTask;
use log::warn;
use xmas_elf::{
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/tasks/initproc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use alloc::{
string::{String, ToString},
vec::Vec,
};
use arch::{debug::DebugConsole, hart_id, shutdown};
use polyhal::{debug::DebugConsole, hart_id, shutdown};
use executor::{current_task, release_task, task::TaskType, tid2task, yield_now, TASK_MAP};
use frame_allocator::get_free_pages;
use fs::{
Expand Down
4 changes: 2 additions & 2 deletions kernel/src/tasks/memset.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloc::{sync::Arc, vec::Vec};
use arch::addr::VirtPage;
use arch::{pagetable::PageTable, PAGE_SIZE};
use polyhal::addr::VirtPage;
use polyhal::{pagetable::PageTable, PAGE_SIZE};
use core::{
cmp::min,
fmt::Debug,
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/tasks/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use alloc::string::String;
use alloc::sync::Weak;
use alloc::{sync::Arc, vec::Vec};
use arch::get_cpu_num;
use polyhal::get_cpu_num;
use devices::get_net_device;
use executor::{current_task, thread, yield_now, AsyncTask, TaskId, DEFAULT_EXECUTOR};
use hal::{ITimerVal, TimeVal};
Expand Down
Loading

0 comments on commit 2f36907

Please sign in to comment.