Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xv6-riscv-tp
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
cidre-public
Systemes d exploitation
xv6-riscv-tp
Commits
61124412
Commit
61124412
authored
4 years ago
by
Wilke Pierre
Browse files
Options
Downloads
Patches
Plain Diff
fonction load_from_file
parent
5f89845b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kernel/vm.c
+24
-0
24 additions, 0 deletions
kernel/vm.c
with
24 additions
and
0 deletions
kernel/vm.c
+
24
−
0
View file @
61124412
...
...
@@ -353,6 +353,30 @@ uvmclear(pagetable_t pagetable, uint64 va)
*
pte
&=
~
PTE_U
;
}
int
load_from_file
(
char
*
file
,
uint64
file_start_offset
,
uint64
pa
,
uint64
nbytes
){
struct
inode
*
ip
;
begin_op
(
ROOTDEV
);
if
((
ip
=
namei
(
file
))
==
0
){
end_op
(
ROOTDEV
);
return
-
1
;
}
ilock
(
ip
);
if
(
readi
(
ip
,
0
,
pa
,
file_start_offset
,
nbytes
)
!=
nbytes
){
iunlockput
(
ip
);
end_op
(
ROOTDEV
);
return
-
1
;
}
iunlockput
(
ip
);
end_op
(
ROOTDEV
);
ip
=
0
;
return
0
;
}
int
allocate_if_possible
(
pagetable_t
pagetable
,
struct
proc
*
p
,
uint64
addr
){
return
0
;
}
...
...
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