Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
An N Tran
project04aref
Commits
fa58ae1e
"git@gitlab.caltech.edu:cs24-19fa/git_rec_nano.git" did not exist on "cfa297622b1205d9a20649397f5881cbe51ea231"
Commit
fa58ae1e
authored
2 years ago
by
An N Tran
Browse files
Options
Download
Email Patches
Plain Diff
Task 4
parent
97fe004e
master
No related merge requests found
Pipeline
#73456
passed with stage
in 14 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kernel.c
+2
-1
kernel.c
with
2 additions
and
1 deletion
+2
-1
kernel.c
View file @
fa58ae1e
...
@@ -173,7 +173,7 @@ void process_setup(pid_t pid, const char* program_name) {
...
@@ -173,7 +173,7 @@ void process_setup(pid_t pid, const char* program_name) {
ptable
[
pid
].
regs
.
reg_rip
=
pgm
.
entry
();
ptable
[
pid
].
regs
.
reg_rip
=
pgm
.
entry
();
// allocate and map stack segment
// allocate and map stack segment
uintptr_t
stack_addr
=
PROC_START_ADDR
+
PROC_SIZE
*
pid
-
PAGESIZE
;
uintptr_t
stack_addr
=
MEMSIZE_VIRTUAL
-
PAGESIZE
;
uintptr_t
pa
=
(
uintptr_t
)
kalloc
(
PAGESIZE
);
uintptr_t
pa
=
(
uintptr_t
)
kalloc
(
PAGESIZE
);
memory_map
(
process_pagetable
,
stack_addr
,
pa
,
PTE_PWU
);
memory_map
(
process_pagetable
,
stack_addr
,
pa
,
PTE_PWU
);
ptable
[
pid
].
regs
.
reg_rsp
=
stack_addr
+
PAGESIZE
;
ptable
[
pid
].
regs
.
reg_rsp
=
stack_addr
+
PAGESIZE
;
...
@@ -325,6 +325,7 @@ uintptr_t syscall(regstate* regs) {
...
@@ -325,6 +325,7 @@ uintptr_t syscall(regstate* regs) {
int
syscall_page_alloc
(
uintptr_t
addr
)
{
int
syscall_page_alloc
(
uintptr_t
addr
)
{
uintptr_t
pa
=
(
uintptr_t
)
kalloc
(
PAGESIZE
);
uintptr_t
pa
=
(
uintptr_t
)
kalloc
(
PAGESIZE
);
if
(
pa
==
0
)
return
-
1
;
memory_map
(
current
->
pagetable
,
addr
,
pa
,
PTE_PWU
);
memory_map
(
current
->
pagetable
,
addr
,
pa
,
PTE_PWU
);
memset
(
memory_virtual_to_physical
(
current
->
pagetable
,
addr
),
0
,
PAGESIZE
);
memset
(
memory_virtual_to_physical
(
current
->
pagetable
,
addr
),
0
,
PAGESIZE
);
return
0
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help