-
Notifications
You must be signed in to change notification settings - Fork 298
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
[task]: Introduce namespaces io manage system resources #193
base: monolithic
Are you sure you want to change the base?
Conversation
e01c8c9
to
7ab1d2a
Compare
7ab1d2a
to
801de3c
Compare
572dcea
to
4bd7557
Compare
…hem before entering app main
4bd7557
to
ea19a87
Compare
e38cb09
to
aabfe88
Compare
@@ -186,6 +186,8 @@ pub extern "C" fn rust_main(cpu_id: usize, dtb: usize) -> ! { | |||
info!("Primary CPU {} init OK.", cpu_id); | |||
INITED_CPUS.fetch_add(1, Ordering::Relaxed); | |||
|
|||
ctor_bare::call_ctors(); |
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.
Put it before line 186, or other CPU may enter main
before calling ctors.
/// | ||
/// It provides methods to lazily initialize the resource of the current thread, | ||
/// or to share the resource with other threads. | ||
pub struct AxResource<T>(LazyInit<Arc<T>>); |
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.
Is ResArc
clearer and shorter?
RwLock::new(fd_table) | ||
}; | ||
def_resource! { | ||
#[allow(non_camel_case_types)] |
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.
Why we need this?
|
||
#[ctor_bare::register_ctor] | ||
#[cfg(feature = "fd")] | ||
fn init_stdio() { |
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.
Move to fs_ops.rs
@@ -15,10 +15,34 @@ fn make_disk() -> std::io::Result<RamDisk> { | |||
Ok(RamDisk::from(&data)) | |||
} | |||
|
|||
mod axns_imp { |
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.
If we only test the global namespace, can we avoid adding this code?
@@ -90,6 +90,12 @@ fn kernel_image_regions() -> impl Iterator<Item = MemRegion> { | |||
flags: MemRegionFlags::RESERVED | MemRegionFlags::READ, | |||
name: ".rodata", | |||
}, | |||
MemRegion { | |||
paddr: virt_to_phys((_sinit_array as usize).into()), | |||
size: _einit_array as usize - _sinit_array as usize, |
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.
Can we use __init_array_start
and __init_array_end
only?
@@ -37,6 +37,10 @@ pub fn new_kernel_aspace() -> AxResult<AddrSpace> { | |||
axconfig::KERNEL_ASPACE_SIZE, | |||
)?; | |||
for r in axhal::mem::memory_regions() { | |||
if r.size == 0 { | |||
info!("Skip zero-size memory region: {:?}", r); |
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.
Put the empty region check in map_linear
/map_alloc
/unmap
/protect
@@ -10,6 +10,7 @@ repository = "https://github.com/arceos-org/arceos/tree/main/modules/axfs" | |||
documentation = "https://arceos-org.github.io/arceos/axfs/index.html" | |||
|
|||
[features] | |||
thread-local = ["axns/thread-local"] |
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.
Remove this feature and enable axns/thread-local
in arceos-posix-api/uspace
only.
@@ -19,11 +19,12 @@ documentation = "https://arceos-org.github.io/arceos/arceos_posix_api/index.html | |||
[features] | |||
default = [] | |||
|
|||
uspace = ["axns/thread-local", "axfs/thread-local", "smp", "irq", "fs", "multitask", "net", "pipe", "select", "epoll"] |
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.
We only use uspace = ["axns/thread-local"]
here, other features should be enabled in starry.
No description provided.