cleanup: replace magic 1024 page limit with ProcessMemory::DEFAULT_PAGE_LIMIT
This commit is contained in:
@@ -17,6 +17,8 @@ pub struct ProcessMemory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ProcessMemory {
|
impl ProcessMemory {
|
||||||
|
pub const DEFAULT_PAGE_LIMIT: usize = 1024;
|
||||||
|
|
||||||
pub fn new(process: ProcessId, limit: usize) -> Self {
|
pub fn new(process: ProcessId, limit: usize) -> Self {
|
||||||
Self {
|
Self {
|
||||||
process,
|
process,
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ impl<P: Platform> Kernel<P> {
|
|||||||
self.processes.get_mut(pid)?.add_thread(tid)?;
|
self.processes.get_mut(pid)?.add_thread(tid)?;
|
||||||
|
|
||||||
self.process_memory[pid.raw() as usize] =
|
self.process_memory[pid.raw() as usize] =
|
||||||
Some(ProcessMemory::new(pid, 1024));
|
Some(ProcessMemory::new(pid, ProcessMemory::DEFAULT_PAGE_LIMIT));
|
||||||
|
|
||||||
let cap = Capability::new(
|
let cap = Capability::new(
|
||||||
Resource::ProcessCreate,
|
Resource::ProcessCreate,
|
||||||
@@ -147,7 +147,7 @@ impl<P: Platform> Kernel<P> {
|
|||||||
pub fn create_process_internal(&mut self) -> Option<ProcessId> {
|
pub fn create_process_internal(&mut self) -> Option<ProcessId> {
|
||||||
let pid = self.processes.create(CapabilityTable::new(), None).ok()?;
|
let pid = self.processes.create(CapabilityTable::new(), None).ok()?;
|
||||||
self.process_memory[pid.raw() as usize] =
|
self.process_memory[pid.raw() as usize] =
|
||||||
Some(domain::memory::process_memory::ProcessMemory::new(pid, 1024));
|
Some(domain::memory::process_memory::ProcessMemory::new(pid, ProcessMemory::DEFAULT_PAGE_LIMIT));
|
||||||
Some(pid)
|
Some(pid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ impl<P: Platform> Kernel<P> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.process_memory[new_pid.raw() as usize] =
|
self.process_memory[new_pid.raw() as usize] =
|
||||||
Some(domain::memory::process_memory::ProcessMemory::new(new_pid, 1024));
|
Some(domain::memory::process_memory::ProcessMemory::new(new_pid, domain::memory::process_memory::ProcessMemory::DEFAULT_PAGE_LIMIT));
|
||||||
|
|
||||||
match self.grant_cap(
|
match self.grant_cap(
|
||||||
caller_pid,
|
caller_pid,
|
||||||
|
|||||||
Reference in New Issue
Block a user