Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zipr Toolchain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
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
Open Source Software
Zipr Toolchain
Commits
40376024
Commit
40376024
authored
8 years ago
by
clc5q
Browse files
Options
Downloads
Patches
Plain Diff
Process new IL lines in SPRI.
Former-commit-id: adec54ea56daa0c6e2357aa86a48847f22f0ef49
parent
78bef58d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/spasm/spasm.cpp
+36
-21
36 additions, 21 deletions
tools/spasm/spasm.cpp
with
36 additions
and
21 deletions
tools/spasm/spasm.cpp
+
36
−
21
View file @
40376024
...
...
@@ -58,7 +58,7 @@ static string insertRedirectRegex = "^[[:blank:]]*([.]|[a-zA-Z][a-zA-Z0-9_]*)[[:
static
string
instructionRegex
=
"^[[:blank:]]*([.]|[a-zA-Z][a-zA-Z0-9_]*)[[:blank:]]+([*][*])[[:blank:]]+.*$"
;
static
string
callbackRegex
=
"^[[:blank:]]*([.]|[a-zA-Z][a-zA-Z0-9_]*)[[:blank:]]+([(][)])[[:blank:]]+.*$"
;
static
string
relocRegex
=
"^[[:blank:]]*([.]|[a-zA-Z][a-zA-Z0-9_]*)[[:blank:]]+([r][l])[[:blank:]]+.*$"
;
static
string
ibtlRegex
=
"^[[:blank:]]*([a-zA-Z][a-zA-Z0-9_]*)[[:blank:]]+([I][L])[[:blank:]]+.*$"
;
static
string
ibtlRegex
=
"^[[:blank:]]*([a-zA-Z][a-zA-Z0-9_]*)[[:blank:]]+([I][L])[[:blank:]]+
([a-zA-Z][a-zA-Z0-9_]*)
.*$"
;
static
regex_t
coPattern
,
erPattern
,
orPattern
,
irPattern
,
insPattern
,
cbPattern
,
rlPattern
,
ibtlPattern
;
...
...
@@ -671,7 +671,7 @@ static void printSPRI(const string &symbolFilename, const string &outFileName)
spasmline_t
sline
;
while
(
getNextSpasmLine
(
sline
))
while
(
getNextSpasmLine
(
sline
))
{
int
incSize
=
0
;
...
...
@@ -784,6 +784,29 @@ static void printSPRI(const string &symbolFilename, const string &outFileName)
outFile
<<
spriline
<<
endl
;
continue
;
}
else
if
(
IBTLop
)
{
// We are parsing: Label1 IL Label2.
// The Label1 was in address and was xformed to SymMap[address] above.
if
(
symMap
.
find
(
rhs
)
==
symMap
.
end
())
{
stringstream
ss
;
ss
<<
sline
.
lineNum
;
throw
SpasmException
(
"ERROR: unresolved symbol "
+
rhs
+
" for symbol referenced on aspri line "
+
ss
.
str
());
}
if
(
comments
.
empty
())
comments
=
"#"
;
else
comments
+=
" ; "
;
comments
+=
"dest addr = <"
+
rhs
+
">"
;
spriline
+=
symMap
[
rhs
]
+
" "
;
spriline
+=
(
"
\t
"
+
comments
);
outFile
<<
spriline
<<
endl
;
continue
;
}
//grabbing bin can only happen here since the above "rl" check does not use any assembly
//checking after results in buffer overrun of bin. It is assumed from this point on
...
...
@@ -807,27 +830,19 @@ static void printSPRI(const string &symbolFilename, const string &outFileName)
}
//terminating and non-terminating redirects may have symbols on the right hand side
//resolve them.
else
if
(
op
.
compare
(
"->"
)
==
0
||
TerminatingRedirectOp
||
IBTLop
)
else
if
(
op
.
compare
(
"->"
)
==
0
||
TerminatingRedirectOp
)
{
if
(
IBTLop
)
{
// We are parsing: Label1 IL Label2.
// The Label1 was in address and was xformed to SymMap[address] above.
// We will skip the special-case code for -> and -| lines.
;
}
else
{
//If the current disassembled instruction is not nop, then something is out of sync
stringstream
ss
;
ss
<<
sline
.
lineNum
;
if
(
binLine
.
hex_str
.
compare
(
"1 90"
)
!=
0
)
throw
SpasmException
(
string
(
"ERROR: Bug detected in getSPRI, bin out of sync with spasm lines. "
)
+
"Expected a place holder nop (1 90) for a SPRI redirect, but found "
+
binLine
.
hex_str
+
". "
+
"Sync error occurs on line "
+
ss
.
str
()
+
" of the SPASM input file"
);
//If the current disassembled instruction is not nop, then something is out of sync
stringstream
ss
;
ss
<<
sline
.
lineNum
;
if
(
binLine
.
hex_str
.
compare
(
"1 90"
)
!=
0
)
throw
SpasmException
(
string
(
"ERROR: Bug detected in getSPRI, bin out of sync with spasm lines. "
)
+
"Expected a place holder nop (1 90) for a SPRI redirect, but found "
+
binLine
.
hex_str
+
". "
+
"Sync error occurs on line "
+
ss
.
str
()
+
" of the SPASM input file"
);
//non-entry point redirects require one byte of memory
incSize
=
1
;
//non-entry point redirects require one byte of memory
incSize
=
1
;
}
if
(
rhs
.
find
(
"+"
)
!=
string
::
npos
||
rhs
[
0
]
==
'0'
)
{
spriline
+=
rhs
;
...
...
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