Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
f74ec002
Commit
f74ec002
authored
Sep 18, 2008
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add -K flag to check stack underflow
R=ken DELTA=38 (36 added, 0 deleted, 2 changed) OCL=15482 CL=15491
parent
d1d7dc6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
2 deletions
+38
-2
src/cmd/6l/pass.c
src/cmd/6l/pass.c
+38
-2
No files found.
src/cmd/6l/pass.c
View file @
f74ec002
...
...
@@ -565,7 +565,7 @@ brloop(Prog *p)
void
dostkoff
(
void
)
{
Prog
*
p
,
*
q
;
Prog
*
p
,
*
q
,
*
q1
;
int32
autoffset
,
deltasp
;
int
a
,
f
,
curframe
,
curbecome
,
maxbecome
,
pcsize
;
Prog
*
pmorestack
;
...
...
@@ -667,8 +667,33 @@ dostkoff(void)
autoffset
=
0
;
q
=
P
;
q1
=
P
;
if
(
pmorestack
!=
P
)
if
(
!
(
p
->
from
.
scale
&
NOSPLIT
))
{
if
(
debug
[
'K'
])
{
// 6l -K means check not only for stack
// overflow but stack underflow.
// On underflow, INT 3 (breakpoint).
// Underflow itself is rare but this also
// catches out-of-sync stack guard info.
p
=
appendp
(
p
);
p
->
as
=
ACMPQ
;
p
->
from
.
type
=
D_INDIR
+
D_R15
;
p
->
from
.
offset
=
8
;
p
->
to
.
type
=
D_SP
;
p
=
appendp
(
p
);
p
->
as
=
AJHI
;
p
->
to
.
type
=
D_BRANCH
;
p
->
to
.
offset
=
4
;
q1
=
p
;
p
=
appendp
(
p
);
p
->
as
=
AINT
;
p
->
from
.
type
=
D_CONST
;
p
->
from
.
offset
=
3
;
}
if
(
autoffset
<
4096
)
{
// do we need to call morestack
if
(
autoffset
<=
75
)
{
// small stack
...
...
@@ -676,7 +701,10 @@ dostkoff(void)
p
->
as
=
ACMPQ
;
p
->
from
.
type
=
D_SP
;
p
->
to
.
type
=
D_INDIR
+
D_R15
;
if
(
q1
)
{
q1
->
pcond
=
p
;
q1
=
P
;
}
}
else
{
// large stack
p
=
appendp
(
p
);
...
...
@@ -684,6 +712,10 @@ dostkoff(void)
p
->
from
.
type
=
D_INDIR
+
D_SP
;
p
->
from
.
offset
=
-
(
autoffset
-
75
);
p
->
to
.
type
=
D_AX
;
if
(
q1
)
{
q1
->
pcond
=
p
;
q1
=
P
;
}
p
=
appendp
(
p
);
p
->
as
=
ACMPQ
;
...
...
@@ -704,6 +736,10 @@ dostkoff(void)
p
->
from
.
type
=
D_CONST
;
p
->
from
.
offset
=
0
;
p
->
to
.
type
=
D_AX
;
if
(
q1
)
{
q1
->
pcond
=
p
;
q1
=
P
;
}
/* 160 comes from 3 calls (3*8) 4 safes (4*8) and 104 guard */
if
(
autoffset
+
160
>
4096
)
...
...
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