Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
O
OS_XV6
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9631059
OS_XV6
Commits
aad062e1
Commit
aad062e1
authored
Dec 18, 2019
by
Amir Hosein Kashani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3.4 before add system call
parent
ad0e0b5f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
defs.h
defs.h
+1
-0
proc.c
proc.c
+19
-0
trap.c
trap.c
+1
-1
No files found.
defs.h
View file @
aad062e1
...
@@ -120,6 +120,7 @@ void userinit(void);
...
@@ -120,6 +120,7 @@ void userinit(void);
int
wait
(
void
);
int
wait
(
void
);
void
wakeup
(
void
*
);
void
wakeup
(
void
*
);
void
yield
(
void
);
void
yield
(
void
);
void
clockCounter
(
void
);
// swtch.S
// swtch.S
void
swtch
(
struct
context
**
,
struct
context
*
);
void
swtch
(
struct
context
**
,
struct
context
*
);
...
...
proc.c
View file @
aad062e1
...
@@ -271,6 +271,7 @@ exit(void)
...
@@ -271,6 +271,7 @@ exit(void)
// Jump into the scheduler, never to return.
// Jump into the scheduler, never to return.
curproc
->
state
=
ZOMBIE
;
curproc
->
state
=
ZOMBIE
;
curproc
->
timeHandeler
.
terminationTime
=
ticks
;
sched
();
sched
();
panic
(
"zombie exit"
);
panic
(
"zombie exit"
);
}
}
...
@@ -559,3 +560,21 @@ procdump(void)
...
@@ -559,3 +560,21 @@ procdump(void)
cprintf
(
"
\n
"
);
cprintf
(
"
\n
"
);
}
}
}
}
void
clockCounter
(){
struct
proc
*
p
;
acquire
(
&
ptable
.
lock
);
for
(
p
=
ptable
.
proc
;
p
<
&
ptable
.
proc
[
NPROC
];
p
++
){
if
(
p
->
state
==
SLEEPING
){
p
->
timeHandeler
.
sleepingTime
++
;
}
else
if
(
p
->
state
==
RUNNABLE
){
p
->
timeHandeler
.
runningTime
++
;
}
else
if
(
p
->
state
==
RUNNING
){
p
->
timeHandeler
.
runningTime
++
;
}
}
release
(
&
ptable
.
lock
);
}
trap.c
View file @
aad062e1
...
@@ -37,7 +37,7 @@ idtinit(void)
...
@@ -37,7 +37,7 @@ idtinit(void)
void
void
trap
(
struct
trapframe
*
tf
)
trap
(
struct
trapframe
*
tf
)
{
{
clockCounter
();
if
(
tf
->
trapno
==
T_SYSCALL
){
if
(
tf
->
trapno
==
T_SYSCALL
){
if
(
myproc
()
->
killed
)
if
(
myproc
()
->
killed
)
exit
();
exit
();
...
...
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