Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zipr_push64_reloc_plugin
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Open Source Software
zipr_push64_reloc_plugin
Commits
bd742af5
Commit
bd742af5
authored
6 years ago
by
Jason Hiser
Browse files
Options
Downloads
Patches
Plain Diff
sdk factorying
parent
8ac3db93
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
push64_relocs.cpp
+9
-15
9 additions, 15 deletions
push64_relocs.cpp
push64_relocs.h
+8
-19
8 additions, 19 deletions
push64_relocs.h
with
17 additions
and
34 deletions
push64_relocs.cpp
+
9
−
15
View file @
bd742af5
...
...
@@ -29,32 +29,27 @@
**************************************************************************/
#include
<zipr_sdk.h>
#include
<irdb-core>
#include
<string>
#include
<algorithm>
#include
"push64_relocs.h"
using
namespace
IRDB_SDK
;
using
namespace
std
;
using
namespace
Zipr_SDK
;
using
namespace
ELFIO
;
using
namespace
std
;
#define ALLOF(a) begin(a), end(a)
Push64Relocs_t
::
Push64Relocs_t
(
MemorySpace_t
*
p_ms
,
elfio
*
p_elfio
,
FileIR_t
*
p_firp
,
InstructionLocationMap_t
*
p_fil
)
:
m_memory_space
(
*
p_ms
),
m_elfio
(
*
p_elfio
),
m_firp
(
*
p_firp
),
final_insn_locations
(
*
p_fil
),
m_verbose
(
"verbose"
)
{
}
ZiprOptionsNamespace_t
*
Push64Relocs_t
::
R
egisterOptions
(
ZiprOptionsNamespace_t
*
global
)
{
global
->
A
ddOption
(
&
m_verbose
);
ZiprOptionsNamespace_t
*
Push64Relocs_t
::
r
egisterOptions
(
ZiprOptionsNamespace_t
*
global
)
{
global
->
a
ddOption
(
&
m_verbose
);
return
NULL
;
}
...
...
@@ -298,9 +293,9 @@ void Push64Relocs_t::UpdatePush64Adds()
if
(
change_to_add
)
{
char
add
=
(
char
)
0x04
;
m_memory_space
.
P
lopBytes
(
add_addr
+
rex_skip
+
1
,
(
const
char
*
)
&
add
,
1
);
m_memory_space
.
p
lopBytes
(
add_addr
+
rex_skip
+
1
,
(
const
char
*
)
&
add
,
1
);
}
m_memory_space
.
P
lopBytes
(
add_addr
+
rex_skip
+
3
,
(
const
char
*
)
&
relocated_value
,
4
);
m_memory_space
.
p
lopBytes
(
add_addr
+
rex_skip
+
3
,
(
const
char
*
)
&
relocated_value
,
4
);
}
}
}
...
...
@@ -309,9 +304,8 @@ extern "C"
Zipr_SDK
::
ZiprPluginInterface_t
*
GetPluginInterface
(
Zipr_SDK
::
Zipr_t
*
zipr_object
)
{
Zipr_SDK
::
MemorySpace_t
*
p_ms
=
zipr_object
->
GetMemorySpace
();
ELFIO
::
elfio
*
p_elfio
=
zipr_object
->
getELFIO
();
IRDB_SDK
::
FileIR_t
*
p_firp
=
zipr_object
->
getFileIR
();
Zipr_SDK
::
InstructionLocationMap_t
*
p_fil
=
zipr_object
->
GetLocationMap
();
return
new
Push64Relocs_t
(
p_ms
,
p_elfio
,
p_firp
,
p_fil
);
auto
*
p_ms
=
zipr_object
->
getMemorySpace
();
auto
*
p_firp
=
zipr_object
->
getFileIR
();
auto
*
p_fil
=
zipr_object
->
getLocationMap
();
return
new
Push64Relocs_t
(
p_ms
,
p_firp
,
p_fil
);
}
This diff is collapsed.
Click to expand it.
push64_relocs.h
+
8
−
19
View file @
bd742af5
...
...
@@ -32,20 +32,18 @@
#define push_relocs_h
#include
<irdb-core>
#include
<zipr-sdk>
class
Push64Relocs_t
:
public
Zipr_SDK
::
ZiprPluginInterface_t
{
public:
Push64Relocs_t
(
Zipr_SDK
::
MemorySpace_t
*
p_ms
,
ELFIO
::
elfio
*
p_elfio
,
IRDB_SDK
::
FileIR_t
*
p_firp
,
Zipr_SDK
::
InstructionLocationMap_t
*
p_fil
);
virtual
void
PinningBegin
()
{
}
virtual
void
PinningEnd
()
virtual
void
doPinningEnd
()
override
{
if
(
m_elfio
.
get_type
()
==
ET_EXEC
)
// if(m_elfio.get_type()==ET_EXEC)
if
(
m_firp
.
getArchitecture
()
->
getFileType
()
==
IRDB_SDK
::
adftELFEXE
)
{
std
::
cout
<<
"Push64_reloc: elide PinningEnd as type==ET_EXEC"
<<
std
::
endl
;
return
;
...
...
@@ -53,18 +51,10 @@ class Push64Relocs_t : public Zipr_SDK::ZiprPluginInterface_t
std
::
cout
<<
"Push64Plugin: Ending pinning, applying push64 relocs."
<<
std
::
endl
;
HandlePush64Relocs
();
}
virtual
void
DollopBegin
()
{
}
virtual
void
DollopEnd
()
{
}
virtual
void
CallbackLinkingBegin
()
{
}
virtual
void
CallbackLinkingEnd
()
virtual
void
doCallbackLinkingEnd
()
override
{
if
(
m_elfio
.
get_type
()
==
ET_EXEC
)
// if(m_elfio.get_type()==ET_EXEC)
if
(
m_firp
.
getArchitecture
()
->
getFileType
()
==
IRDB_SDK
::
adftELFEXE
)
{
std
::
cout
<<
"Push64_reloc: elide CallbackLinkingEnd as type==ET_EXEC"
<<
std
::
endl
;
return
;
...
...
@@ -73,7 +63,7 @@ class Push64Relocs_t : public Zipr_SDK::ZiprPluginInterface_t
UpdatePush64Adds
();
}
virtual
Zipr_SDK
::
ZiprOptionsNamespace_t
*
R
egisterOptions
(
Zipr_SDK
::
ZiprOptionsNamespace_t
*
);
virtual
Zipr_SDK
::
ZiprOptionsNamespace_t
*
r
egisterOptions
(
Zipr_SDK
::
ZiprOptionsNamespace_t
*
)
override
;
private
:
// main workhorses
void
HandlePush64Relocs
();
...
...
@@ -123,7 +113,6 @@ class Push64Relocs_t : public Zipr_SDK::ZiprPluginInterface_t
// references to input
Zipr_SDK
::
MemorySpace_t
&
m_memory_space
;
ELFIO
::
elfio
&
m_elfio
;
IRDB_SDK
::
FileIR_t
&
m_firp
;
Zipr_SDK
::
InstructionLocationMap_t
&
final_insn_locations
;
...
...
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