Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pintos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Project Purple Stallion
Pintos
Commits
b088432a
Commit
b088432a
authored
5 years ago
by
a2-stratford
Browse files
Options
Downloads
Patches
Plain Diff
Basic fixes
parent
1d97a772
No related branches found
No related tags found
2 merge requests
!22
Merge Feature/system calls
,
!7
Implemented the close system call
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
threads/thread.h
+1
-2
1 addition, 2 deletions
threads/thread.h
userprog/populate_stack.c
+3
-3
3 additions, 3 deletions
userprog/populate_stack.c
userprog/syscall_close.c
+4
-3
4 additions, 3 deletions
userprog/syscall_close.c
with
8 additions
and
8 deletions
threads/thread.h
+
1
−
2
View file @
b088432a
...
@@ -6,8 +6,7 @@
...
@@ -6,8 +6,7 @@
#include
<stdint.h>
#include
<stdint.h>
/* States in a thread's life cycle. */
/* States in a thread's life cycle. */
enum
thread_status
enum
thread_status
{
{
THREAD_RUNNING
,
/* Running thread. */
THREAD_RUNNING
,
/* Running thread. */
THREAD_READY
,
/* Not running but ready to run. */
THREAD_READY
,
/* Not running but ready to run. */
THREAD_BLOCKED
,
/* Waiting for an event to trigger. */
THREAD_BLOCKED
,
/* Waiting for an event to trigger. */
...
...
This diff is collapsed.
Click to expand it.
userprog/populate_stack.c
+
3
−
3
View file @
b088432a
...
@@ -22,8 +22,8 @@ void populate_stack(void** stack_pointer, int argc, char** argv) {
...
@@ -22,8 +22,8 @@ void populate_stack(void** stack_pointer, int argc, char** argv) {
while
(
--
i
>=
0
)
while
(
--
i
>=
0
)
{
{
*
stack_pointer
=
*
stack_pointer
-
(
strlen
(
argv
[
i
])
+
1
)
*
sizeof
(
char
);
*
stack_pointer
=
*
stack_pointer
-
(
strlen
(
argv
[
i
])
+
1
)
*
sizeof
(
char
);
// Assigns the current reference of the stack pointer to the array
arr
[
i
]
=
(
uint32_t
*
)
*
stack_pointer
;
// Assigns the current reference of the stack pointer to the array
arr
[
i
]
=
(
uint32_t
*
)
*
stack_pointer
;
memcpy
(
*
stack_pointer
,
argv
[
i
],
strlen
(
argv
[
i
])
+
1
);
memcpy
(
*
stack_pointer
,
argv
[
i
],
strlen
(
argv
[
i
])
+
1
);
}
}
...
@@ -35,7 +35,7 @@ void populate_stack(void** stack_pointer, int argc, char** argv) {
...
@@ -35,7 +35,7 @@ void populate_stack(void** stack_pointer, int argc, char** argv) {
while
(
--
i
>=
0
)
while
(
--
i
>=
0
)
{
{
move_stack_pointer
(
stack_pointer
,
-
4
);
//
32bit
Moves the stack pointer back 4
move_stack_pointer
(
stack_pointer
,
-
4
);
//Moves the stack pointer back 4
(
*
(
uint32_t
**
)(
*
stack_pointer
))
=
arr
[
i
];
(
*
(
uint32_t
**
)(
*
stack_pointer
))
=
arr
[
i
];
}
}
...
...
This diff is collapsed.
Click to expand it.
userprog/syscall_close.c
+
4
−
3
View file @
b088432a
/*
/*
* Closes file descriptor fd. Exiting or terminating a process implicitly closes
all its open file
* Closes file descriptor fd. Exiting or terminating a process implicitly closes
* descriptors, as if by calling this function for each one.
*
all its open file
descriptors, as if by calling this function for each one.
* Authored by Alex Stratford
* Authored by Alex Stratford
*/
*/
...
@@ -11,7 +11,8 @@
...
@@ -11,7 +11,8 @@
#include
"lib/kernel/list.h"
// Dependency for list_remove
#include
"lib/kernel/list.h"
// Dependency for list_remove
int
syscall_close
(
struct
intr_frame
*
f
)
{
int
syscall_close
(
struct
intr_frame
*
f
)
{
int
file_descriptor
=
*
((
int
*
)
f
->
esp
+
1
);
// pop off first int argument from interrupt frame
// pop off first int argument from interrupt frame
int
file_descriptor
=
*
((
int
*
)
f
->
esp
+
1
);
// Described in system_calls.h, stores file descriptors mapped to files
// Described in system_calls.h, stores file descriptors mapped to files
struct
file_map
*
f_map
=
get_file
(
file_descriptor
);
struct
file_map
*
f_map
=
get_file
(
file_descriptor
);
if
(
f_map
==
NULL
)
// Checking if file is empty or non-existent
if
(
f_map
==
NULL
)
// Checking if file is empty or non-existent
...
...
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