Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redox-os
kernel
Commits
d6b9768d
Commit
d6b9768d
authored
7 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
More efficient live filesystem method
Reduce kernel heap to 64 MB Fix issue in build.rs
parent
1f81866a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
build.rs
+2
-4
2 additions, 4 deletions
build.rs
src/consts.rs
+1
-4
1 addition, 4 deletions
src/consts.rs
src/scheme/live.rs
+22
-7
22 additions, 7 deletions
src/scheme/live.rs
with
25 additions
and
15 deletions
build.rs
+
2
−
4
View file @
d6b9768d
...
...
@@ -87,6 +87,8 @@ fn fill_from_location(f: &mut fs::File, loc: &Path ) -> Result<(), (Error)> {
}
fn
main
()
{
println!
(
"cargo:rustc-env=TARGET={}"
,
env
::
var
(
"TARGET"
)
.unwrap
());
let
out_dir
=
env
::
var
(
"OUT_DIR"
)
.unwrap
();
let
dest_path
=
Path
::
new
(
&
out_dir
)
.join
(
"gen.rs"
);
let
mut
f
=
fs
::
File
::
create
(
&
dest_path
)
.unwrap
();
...
...
@@ -114,8 +116,4 @@ b" files.clear();" // Silence mutability warning
}
}
"
)
.unwrap
();
fn
main
()
{
println!
(
"cargo:rustc-env=TARGET={}"
,
env
::
var
(
"TARGET"
)
.unwrap
());
}
}
This diff is collapsed.
Click to expand it.
src/consts.rs
+
1
−
4
View file @
d6b9768d
...
...
@@ -15,10 +15,7 @@
/// Offset to kernel heap
pub
const
KERNEL_HEAP_OFFSET
:
usize
=
KERNEL_OFFSET
+
PML4_SIZE
/
2
;
/// Size of kernel heap
#[cfg(not(feature
=
"live"
))]
pub
const
KERNEL_HEAP_SIZE
:
usize
=
128
*
1024
*
1024
;
// 128 MB
#[cfg(feature
=
"live"
)]
pub
const
KERNEL_HEAP_SIZE
:
usize
=
640
*
1024
*
1024
;
// 640 MB - 128 default + 512 for the live disk
pub
const
KERNEL_HEAP_SIZE
:
usize
=
64
*
1024
*
1024
;
// 64 MB
/// Offset to kernel percpu variables
//TODO: Use 64-bit fs offset to enable this pub const KERNEL_PERCPU_OFFSET: usize = KERNEL_HEAP_OFFSET - PML4_SIZE;
...
...
This diff is collapsed.
Click to expand it.
src/scheme/live.rs
+
22
−
7
View file @
d6b9768d
/// Disk scheme replacement when making live disk
use
alloc
::
arc
::
Arc
;
use
collections
::
{
BTreeMap
,
Vec
}
;
use
core
::
cmp
;
use
collections
::
BTreeMap
;
use
core
::
{
cmp
,
slice
}
;
use
core
::
sync
::
atomic
::{
AtomicUsize
,
Ordering
};
use
spin
::
RwLock
;
...
...
@@ -11,26 +11,41 @@ use syscall::error::*;
use
syscall
::
flag
::{
MODE_FILE
,
SEEK_SET
,
SEEK_CUR
,
SEEK_END
};
use
syscall
::
scheme
::
Scheme
;
static
FILESYSTEM
:
&
'static
[
u8
]
=
include_bytes!
(
env!
(
"FILESYSTEM"
));
struct
Handle
{
path
:
&
'static
[
u8
],
data
:
Arc
<
RwLock
<
Vec
<
u8
>
>>
,
data
:
Arc
<
RwLock
<
&
'static
mut
[
u8
]
>>
,
mode
:
u16
,
seek
:
usize
}
pub
struct
DiskScheme
{
next_id
:
AtomicUsize
,
data
:
Arc
<
RwLock
<
Vec
<
u8
>
>>
,
data
:
Arc
<
RwLock
<
&
'static
mut
[
u8
]
>>
,
handles
:
RwLock
<
BTreeMap
<
usize
,
Handle
>>
}
impl
DiskScheme
{
pub
fn
new
()
->
DiskScheme
{
let
data
;
unsafe
{
extern
{
static
mut
__live_start
:
u8
;
static
mut
__live_end
:
u8
;
}
let
start
=
&
mut
__live_start
as
*
mut
u8
;
let
end
=
&
mut
__live_end
as
*
mut
u8
;
if
end
as
usize
>=
start
as
usize
{
data
=
slice
::
from_raw_parts_mut
(
start
,
end
as
usize
-
start
as
usize
);
}
else
{
data
=
&
mut
[];
};
}
DiskScheme
{
next_id
:
AtomicUsize
::
new
(
0
),
data
:
Arc
::
new
(
RwLock
::
new
(
FILESYSTEM
.to_vec
()
)),
data
:
Arc
::
new
(
RwLock
::
new
(
data
)),
handles
:
RwLock
::
new
(
BTreeMap
::
new
())
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment