Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xv6-19au
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
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
csep551
xv6-19au
Commits
9583b476
Commit
9583b476
authored
17 years ago
by
rsc
Browse files
Options
Downloads
Patches
Plain Diff
try to use cp only for curproc[cpu()]
parent
22330658
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
proc.c
+9
-9
9 additions, 9 deletions
proc.c
syscall.c
+9
-9
9 additions, 9 deletions
syscall.c
sysfile.c
+12
-11
12 additions, 11 deletions
sysfile.c
umalloc.c
+7
-7
7 additions, 7 deletions
umalloc.c
with
37 additions
and
36 deletions
proc.c
+
9
−
9
View file @
9583b476
...
...
@@ -204,9 +204,9 @@ scheduler(void)
void
sched
(
void
)
{
struct
proc
*
p
=
curproc
[
cpu
()];
struct
proc
*
c
p
=
curproc
[
cpu
()];
if
(
p
->
state
==
RUNNING
)
if
(
c
p
->
state
==
RUNNING
)
panic
(
"sched running"
);
if
(
!
holding
(
&
proc_table_lock
))
panic
(
"sched proc_table_lock"
);
...
...
@@ -221,10 +221,10 @@ sched(void)
void
yield
(
void
)
{
struct
proc
*
p
=
curproc
[
cpu
()];
struct
proc
*
c
p
=
curproc
[
cpu
()];
acquire
(
&
proc_table_lock
);
p
->
state
=
RUNNABLE
;
c
p
->
state
=
RUNNABLE
;
sched
();
release
(
&
proc_table_lock
);
}
...
...
@@ -246,9 +246,9 @@ forkret(void)
void
sleep
(
void
*
chan
,
struct
spinlock
*
lk
)
{
struct
proc
*
p
=
curproc
[
cpu
()];
struct
proc
*
c
p
=
curproc
[
cpu
()];
if
(
p
==
0
)
if
(
c
p
==
0
)
panic
(
"sleep"
);
if
(
lk
==
0
)
...
...
@@ -266,12 +266,12 @@ sleep(void *chan, struct spinlock *lk)
}
// Go to sleep.
p
->
chan
=
chan
;
p
->
state
=
SLEEPING
;
c
p
->
chan
=
chan
;
c
p
->
state
=
SLEEPING
;
sched
();
// Tidy up.
p
->
chan
=
0
;
c
p
->
chan
=
0
;
// Reacquire original lock.
if
(
lk
!=
&
proc_table_lock
){
...
...
This diff is collapsed.
Click to expand it.
syscall.c
+
9
−
9
View file @
9583b476
...
...
@@ -37,15 +37,15 @@ fetchint(struct proc *p, uint addr, int *ip)
int
fetchstr
(
struct
proc
*
p
,
uint
addr
,
char
**
pp
)
{
char
*
cp
,
*
ep
;
char
*
s
,
*
ep
;
if
(
addr
>=
p
->
sz
)
return
-
1
;
*
pp
=
p
->
mem
+
addr
;
ep
=
p
->
mem
+
p
->
sz
;
for
(
cp
=
*
pp
;
cp
<
ep
;
cp
++
)
if
(
*
cp
==
0
)
return
cp
-
*
pp
;
for
(
s
=
*
pp
;
s
<
ep
;
s
++
)
if
(
*
s
==
0
)
return
s
-
*
pp
;
return
-
1
;
}
...
...
@@ -53,9 +53,9 @@ fetchstr(struct proc *p, uint addr, char **pp)
int
argint
(
int
argno
,
int
*
ip
)
{
struct
proc
*
p
=
curproc
[
cpu
()];
struct
proc
*
c
p
=
curproc
[
cpu
()];
return
fetchint
(
p
,
p
->
tf
->
esp
+
4
+
4
*
argno
,
ip
);
return
fetchint
(
c
p
,
c
p
->
tf
->
esp
+
4
+
4
*
argno
,
ip
);
}
// Fetch the nth word-sized system call argument as a pointer
...
...
@@ -65,13 +65,13 @@ int
argptr
(
int
argno
,
char
**
pp
,
int
size
)
{
int
i
;
struct
proc
*
p
=
curproc
[
cpu
()];
struct
proc
*
c
p
=
curproc
[
cpu
()];
if
(
argint
(
argno
,
&
i
)
<
0
)
return
-
1
;
if
((
uint
)
i
>=
p
->
sz
||
(
uint
)
i
+
size
>=
p
->
sz
)
if
((
uint
)
i
>=
c
p
->
sz
||
(
uint
)
i
+
size
>=
c
p
->
sz
)
return
-
1
;
*
pp
=
p
->
mem
+
i
;
*
pp
=
c
p
->
mem
+
i
;
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
sysfile.c
+
12
−
11
View file @
9583b476
...
...
@@ -22,11 +22,11 @@ argfd(int argno, int *pfd, struct file **pf)
{
int
fd
;
struct
file
*
f
;
struct
proc
*
p
=
curproc
[
cpu
()];
struct
proc
*
c
p
=
curproc
[
cpu
()];
if
(
argint
(
argno
,
&
fd
)
<
0
)
return
-
1
;
if
(
fd
<
0
||
fd
>=
NOFILE
||
(
f
=
p
->
ofile
[
fd
])
==
0
)
if
(
fd
<
0
||
fd
>=
NOFILE
||
(
f
=
c
p
->
ofile
[
fd
])
==
0
)
return
-
1
;
if
(
pfd
)
*
pfd
=
fd
;
...
...
@@ -41,10 +41,11 @@ static int
fdalloc
(
struct
file
*
f
)
{
int
fd
;
struct
proc
*
p
=
curproc
[
cpu
()];
struct
proc
*
cp
=
curproc
[
cpu
()];
for
(
fd
=
0
;
fd
<
NOFILE
;
fd
++
){
if
(
p
->
ofile
[
fd
]
==
0
){
p
->
ofile
[
fd
]
=
f
;
if
(
c
p
->
ofile
[
fd
]
==
0
){
c
p
->
ofile
[
fd
]
=
f
;
return
fd
;
}
}
...
...
@@ -57,7 +58,7 @@ sys_pipe(void)
int
*
fd
;
struct
file
*
rf
=
0
,
*
wf
=
0
;
int
fd0
,
fd1
;
struct
proc
*
p
=
curproc
[
cpu
()];
struct
proc
*
c
p
=
curproc
[
cpu
()];
if
(
argptr
(
0
,
(
void
*
)
&
fd
,
2
*
sizeof
fd
[
0
])
<
0
)
return
-
1
;
...
...
@@ -66,7 +67,7 @@ sys_pipe(void)
fd0
=
-
1
;
if
((
fd0
=
fdalloc
(
rf
))
<
0
||
(
fd1
=
fdalloc
(
wf
))
<
0
){
if
(
fd0
>=
0
)
p
->
ofile
[
fd0
]
=
0
;
c
p
->
ofile
[
fd0
]
=
0
;
fileclose
(
rf
);
fileclose
(
wf
);
return
-
1
;
...
...
@@ -241,7 +242,7 @@ sys_mkdir(void)
int
sys_chdir
(
void
)
{
struct
proc
*
p
=
curproc
[
cpu
()];
struct
proc
*
c
p
=
curproc
[
cpu
()];
struct
inode
*
ip
;
char
*
path
;
...
...
@@ -261,9 +262,9 @@ sys_chdir(void)
return
-
1
;
}
idecref
(
p
->
cwd
);
p
->
cwd
=
ip
;
iunlock
(
p
->
cwd
);
idecref
(
c
p
->
cwd
);
c
p
->
cwd
=
ip
;
iunlock
(
c
p
->
cwd
);
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
umalloc.c
+
7
−
7
View file @
9583b476
...
...
@@ -46,17 +46,17 @@ free(void *ap)
static
Header
*
morecore
(
uint
nu
)
{
char
*
c
p
;
Header
*
u
p
;
char
*
p
;
Header
*
h
p
;
if
(
nu
<
PAGE
)
nu
=
PAGE
;
c
p
=
sbrk
(
nu
*
sizeof
(
Header
));
if
(
c
p
==
(
char
*
)
-
1
)
p
=
sbrk
(
nu
*
sizeof
(
Header
));
if
(
p
==
(
char
*
)
-
1
)
return
0
;
u
p
=
(
Header
*
)
c
p
;
u
p
->
s
.
size
=
nu
;
free
((
void
*
)(
u
p
+
1
));
h
p
=
(
Header
*
)
p
;
h
p
->
s
.
size
=
nu
;
free
((
void
*
)(
h
p
+
1
));
return
freep
;
}
...
...
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