Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SandHook
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
Administrator
SandHook
Commits
89594d29
Commit
89594d29
authored
May 22, 2019
by
swift_gan
Committed by
swift_gan
May 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NativeHook]tweak register & add some insts
parent
1b1df47a
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
206 additions
and
38 deletions
+206
-38
assembler_a32.cpp
.../src/main/cpp/archs/arm/arm32/assembler/assembler_a32.cpp
+27
-0
assembler_a32.h
...ok/src/main/cpp/archs/arm/arm32/assembler/assembler_a32.h
+5
-0
arm32_base.h
nativehook/src/main/cpp/archs/arm/arm32/inst/arm32_base.h
+6
-7
inst_code_arm32.h
...ehook/src/main/cpp/archs/arm/arm32/inst/inst_code_arm32.h
+3
-0
inst_struct_t16.h
...ehook/src/main/cpp/archs/arm/arm32/inst/inst_struct_t16.h
+14
-0
inst_t16.cpp
nativehook/src/main/cpp/archs/arm/arm32/inst/inst_t16.cpp
+39
-1
inst_t16.h
nativehook/src/main/cpp/archs/arm/arm32/inst/inst_t16.h
+50
-3
inst_t32.h
nativehook/src/main/cpp/archs/arm/arm32/inst/inst_t32.h
+6
-2
register_a32.h
...hook/src/main/cpp/archs/arm/arm32/register/register_a32.h
+14
-1
inst_arm64.h
nativehook/src/main/cpp/archs/arm/arm64/inst/inst_arm64.h
+0
-17
register_a64.h
...hook/src/main/cpp/archs/arm/arm64/register/register_a64.h
+14
-1
cpu.h
nativehook/src/main/cpp/asm/cpu.h
+12
-0
register.h
nativehook/src/main/cpp/asm/register.h
+10
-0
unit.h
nativehook/src/main/cpp/asm/unit.h
+5
-5
assembler.cpp
nativehook/src/main/cpp/assembler/assembler.cpp
+1
-1
No files found.
nativehook/src/main/cpp/archs/arm/arm32/assembler/assembler_a32.cpp
View file @
89594d29
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
//
//
#include "assembler_a32.h"
#include "assembler_a32.h"
#include "exception.h"
using
namespace
SandHook
::
Assembler
;
using
namespace
SandHook
::
Assembler
;
using
namespace
SandHook
::
RegistersA32
;
using
namespace
SandHook
::
RegistersA32
;
...
@@ -127,3 +128,29 @@ void AssemblerA32::Add(RegisterA32 &rdn, U8 imm8) {
...
@@ -127,3 +128,29 @@ void AssemblerA32::Add(RegisterA32 &rdn, U8 imm8) {
void
AssemblerA32
::
Add
(
RegisterA32
&
rd
,
RegisterA32
&
rn
,
RegisterA32
&
rm
)
{
void
AssemblerA32
::
Add
(
RegisterA32
&
rd
,
RegisterA32
&
rn
,
RegisterA32
&
rm
)
{
Emit
(
reinterpret_cast
<
Unit
<
Base
>*>
(
new
INST_T16
(
ADD_REG
)(
&
rd
,
&
rn
,
&
rm
)));
Emit
(
reinterpret_cast
<
Unit
<
Base
>*>
(
new
INST_T16
(
ADD_REG
)(
&
rd
,
&
rn
,
&
rm
)));
}
}
void
AssemblerA32
::
Cmp
(
RegisterA32
&
rd
,
RegisterA32
&
rn
)
{
if
(
rd
.
getCode
()
<
8
&&
rn
.
getCode
()
<
8
)
{
Emit
(
reinterpret_cast
<
Unit
<
Base
>*>
(
new
INST_T16
(
CMP_REG
)(
rd
,
rn
)));
}
else
{
Emit
(
reinterpret_cast
<
Unit
<
Base
>*>
(
new
INST_T16
(
CMP_REG_EXT
)(
rd
,
rn
)));
}
}
void
AssemblerA32
::
Pop
(
RegisterA32
&
rt
)
{
if
(
rt
.
getCode
()
<
8
||
rt
==
PC
)
{
Emit
(
reinterpret_cast
<
Unit
<
Base
>*>
(
new
INST_T16
(
POP
)(
RegisterList
(
rt
))));
}
else
{
throw
ErrorCodeException
(
"error pop inst"
);
}
}
void
AssemblerA32
::
Push
(
RegisterA32
&
rt
)
{
if
(
rt
.
getCode
()
<
8
||
rt
==
PC
)
{
Emit
(
reinterpret_cast
<
Unit
<
Base
>*>
(
new
INST_T16
(
PUSH
)(
RegisterList
(
rt
))));
}
else
{
throw
ErrorCodeException
(
"error pop inst"
);
}
}
nativehook/src/main/cpp/archs/arm/arm32/assembler/assembler_a32.h
View file @
89594d29
...
@@ -58,6 +58,11 @@ namespace SandHook {
...
@@ -58,6 +58,11 @@ namespace SandHook {
void
Add
(
RegisterA32
&
rd
,
RegisterA32
&
rn
,
RegisterA32
&
rm
);
void
Add
(
RegisterA32
&
rd
,
RegisterA32
&
rn
,
RegisterA32
&
rm
);
void
Cmp
(
RegisterA32
&
rn
,
RegisterA32
&
rm
);
void
Pop
(
RegisterA32
&
rt
);
void
Push
(
RegisterA32
&
rt
);
public
:
public
:
CodeContainer
codeContainer
=
CodeContainer
(
nullptr
);
CodeContainer
codeContainer
=
CodeContainer
(
nullptr
);
};
};
...
...
nativehook/src/main/cpp/archs/arm/arm32/inst/arm32_base.h
View file @
89594d29
...
@@ -68,9 +68,9 @@ namespace SandHook {
...
@@ -68,9 +68,9 @@ namespace SandHook {
RegisterList
(
RegisterA32
&
reg1
,
RegisterA32
&
reg2
,
RegisterA32
&
reg3
,
RegisterA32
&
reg4
)
RegisterList
(
RegisterA32
&
reg1
,
RegisterA32
&
reg2
,
RegisterA32
&
reg3
,
RegisterA32
&
reg4
)
:
list_
(
RegisterToList
(
reg1
)
|
RegisterToList
(
reg2
)
|
:
list_
(
RegisterToList
(
reg1
)
|
RegisterToList
(
reg2
)
|
RegisterToList
(
reg3
)
|
RegisterToList
(
reg4
))
{}
RegisterToList
(
reg3
)
|
RegisterToList
(
reg4
))
{}
explicit
RegisterList
(
uint32_t
list
)
:
list_
(
list
)
{}
explicit
RegisterList
(
U16
list
)
:
list_
(
list
)
{}
uint32_t
GetList
()
const
{
return
list_
;
}
U16
GetList
()
const
{
return
list_
;
}
void
SetList
(
uint32_t
list
)
{
list_
=
list
;
}
void
SetList
(
U16
list
)
{
list_
=
list
;
}
bool
Includes
(
RegisterA32
&
reg
)
const
{
bool
Includes
(
RegisterA32
&
reg
)
const
{
return
(
list_
&
RegisterToList
(
reg
))
!=
0
;
return
(
list_
&
RegisterToList
(
reg
))
!=
0
;
}
}
...
@@ -89,7 +89,6 @@ namespace SandHook {
...
@@ -89,7 +89,6 @@ namespace SandHook {
// True if all the registers from the list are not from r8-r13 nor from r15.
// True if all the registers from the list are not from r8-r13 nor from r15.
return
(
list_
&
0xbf00
)
==
0
;
return
(
list_
&
0xbf00
)
==
0
;
}
}
Register
GetFirstAvailableRegister
()
const
;
bool
IsEmpty
()
const
{
return
list_
==
0
;
}
bool
IsEmpty
()
const
{
return
list_
==
0
;
}
static
RegisterList
Union
(
const
RegisterList
&
list_1
,
static
RegisterList
Union
(
const
RegisterList
&
list_1
,
const
RegisterList
&
list_2
)
{
const
RegisterList
&
list_2
)
{
...
@@ -124,17 +123,17 @@ namespace SandHook {
...
@@ -124,17 +123,17 @@ namespace SandHook {
}
}
private
:
private
:
static
uint32_t
RegisterToList
(
RegisterA32
&
reg
)
{
static
U16
RegisterToList
(
RegisterA32
&
reg
)
{
if
(
reg
.
getCode
()
==
UnknowRegiser
.
getCode
())
{
if
(
reg
.
getCode
()
==
UnknowRegiser
.
getCode
())
{
return
0
;
return
0
;
}
else
{
}
else
{
return
UINT32_C
(
1
)
<<
reg
.
getCode
(
);
return
static_cast
<
U16
>
(
UINT16_C
(
1
)
<<
reg
.
getCode
()
);
}
}
}
}
// Bitfield representation of all registers in the list
// Bitfield representation of all registers in the list
// (1 for r0, 2 for r1, 4 for r2, ...).
// (1 for r0, 2 for r1, 4 for r2, ...).
uint32_t
list_
;
U16
list_
;
};
};
inline
uint32_t
GetRegisterListEncoding
(
const
RegisterList
&
registers
,
inline
uint32_t
GetRegisterListEncoding
(
const
RegisterList
&
registers
,
...
...
nativehook/src/main/cpp/archs/arm/arm32/inst/inst_code_arm32.h
View file @
89594d29
...
@@ -28,6 +28,9 @@ enum class InstCodeT16 {
...
@@ -28,6 +28,9 @@ enum class InstCodeT16 {
CMP_REG_EXT
,
CMP_REG_EXT
,
MOV_IMM
,
MOV_IMM
,
MOV_REG
,
MOV_REG
,
ADD_IMM_RND
,
POP
,
PUSH
};
};
enum
class
InstCodeT32
{
enum
class
InstCodeT32
{
...
...
nativehook/src/main/cpp/archs/arm/arm32/inst/inst_struct_t16.h
View file @
89594d29
...
@@ -131,5 +131,19 @@ DEFINE_STRUCT_T16(ADD_REG) {
...
@@ -131,5 +131,19 @@ DEFINE_STRUCT_T16(ADD_REG) {
InstT16
opcode
:
7
;
InstT16
opcode
:
7
;
};
};
DEFINE_OPCODE_T16
(
POP
,
0
b1011110
)
DEFINE_STRUCT_T16
(
POP
)
{
InstT16
regs
:
8
;
InstT16
P
:
1
;
InstT16
opcode
:
7
;
};
DEFINE_OPCODE_T16
(
PUSH
,
0
b1011010
)
DEFINE_STRUCT_T16
(
PUSH
)
{
InstT16
regs
:
8
;
InstT16
M
:
1
;
InstT16
opcode
:
7
;
};
#endif //SANDHOOK_NH_INST_STRUCT_T16_H
#endif //SANDHOOK_NH_INST_STRUCT_T16_H
nativehook/src/main/cpp/archs/arm/arm32/inst/inst_t16.cpp
View file @
89594d29
...
@@ -315,7 +315,7 @@ T16_CMP_REG_EXT::T16_CMP_REG_EXT(T16_STRUCT_CMP_REG_EXT *inst) : InstructionT16(
...
@@ -315,7 +315,7 @@ T16_CMP_REG_EXT::T16_CMP_REG_EXT(T16_STRUCT_CMP_REG_EXT *inst) : InstructionT16(
decode
(
inst
);
decode
(
inst
);
}
}
T16_CMP_REG_EXT
::
T16_CMP_REG_EXT
(
RegisterA32
*
rn
,
RegisterA32
*
rm
)
:
rn
(
rn
),
rm
(
rm
)
{}
T16_CMP_REG_EXT
::
T16_CMP_REG_EXT
(
RegisterA32
&
rn
,
RegisterA32
&
rm
)
:
rn
(
&
rn
),
rm
(
&
rm
)
{}
void
T16_CMP_REG_EXT
::
decode
(
T16_STRUCT_CMP_REG_EXT
*
inst
)
{
void
T16_CMP_REG_EXT
::
decode
(
T16_STRUCT_CMP_REG_EXT
*
inst
)
{
rn
=
Reg
(
COMBINE
(
inst
->
N
,
inst
->
rn
,
3
));
rn
=
Reg
(
COMBINE
(
inst
->
N
,
inst
->
rn
,
3
));
...
@@ -328,3 +328,41 @@ void T16_CMP_REG_EXT::assembler() {
...
@@ -328,3 +328,41 @@ void T16_CMP_REG_EXT::assembler() {
get
()
->
rn
=
BITS
(
rn
->
getCode
(),
0
,
2
);
get
()
->
rn
=
BITS
(
rn
->
getCode
(),
0
,
2
);
get
()
->
N
=
BIT
(
rn
->
getCode
(),
3
);
get
()
->
N
=
BIT
(
rn
->
getCode
(),
3
);
}
}
//POP
T16_POP
::
T16_POP
(
T16_STRUCT_POP
*
inst
)
:
InstructionT16
(
inst
)
{
decode
(
inst
);
}
T16_POP
::
T16_POP
(
const
RegisterList
&
registerList
)
:
registerList
(
registerList
)
{}
void
T16_POP
::
decode
(
T16_STRUCT_POP
*
inst
)
{
registerList
.
SetList
(
COMBINE
(
inst
->
P
<<
7
,
inst
->
regs
,
8
));
}
void
T16_POP
::
assembler
()
{
SET_OPCODE
(
POP
);
U16
regs
=
registerList
.
GetList
();
get
()
->
regs
=
BITS
(
regs
,
0
,
7
);
get
()
->
P
=
BIT
(
regs
,
15
);
}
//PUSH
T16_PUSH
::
T16_PUSH
(
T16_STRUCT_PUSH
*
inst
)
:
InstructionT16
(
inst
)
{
decode
(
inst
);
}
T16_PUSH
::
T16_PUSH
(
const
RegisterList
&
registerList
)
:
registerList
(
registerList
)
{}
void
T16_PUSH
::
decode
(
T16_STRUCT_PUSH
*
inst
)
{
registerList
.
SetList
(
COMBINE
(
inst
->
M
<<
7
,
inst
->
regs
,
8
));
}
void
T16_PUSH
::
assembler
()
{
SET_OPCODE
(
POP
);
U16
regs
=
registerList
.
GetList
();
get
()
->
regs
=
BITS
(
regs
,
0
,
7
);
get
()
->
M
=
BIT
(
regs
,
15
);
}
\ No newline at end of file
nativehook/src/main/cpp/archs/arm/arm32/inst/inst_t16.h
View file @
89594d29
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include "register_list_a32.h"
#include "register_list_a32.h"
#include "inst_struct_t16.h"
#include "inst_struct_t16.h"
#include "inst_code_arm32.h"
#include "inst_code_arm32.h"
#include "arm32_base.h"
#define INST_T16(X) T16_##X
#define INST_T16(X) T16_##X
...
@@ -59,8 +60,12 @@ namespace SandHook {
...
@@ -59,8 +60,12 @@ namespace SandHook {
return
2
;
return
2
;
}
}
void
onLabelApply
(
Addr
pc
)
override
{
void
*
getPC
()
override
{
this
->
onOffsetApply
(
pc
-
this
->
getVPC
()
-
2
*
size
());
return
reinterpret_cast
<
void
*>
((
Addr
)
Instruction
<
Inst
>::
getPC
()
+
2
*
size
());
}
Addr
getVPC
()
override
{
return
Instruction
<
Inst
>::
getVPC
()
+
2
*
size
();
}
}
static
inline
U32
zeroExtend32
(
unsigned
int
bits
,
U32
value
)
{
static
inline
U32
zeroExtend32
(
unsigned
int
bits
,
U32
value
)
{
...
@@ -252,6 +257,10 @@ namespace SandHook {
...
@@ -252,6 +257,10 @@ namespace SandHook {
T16_ADD_IMM_RDN
(
RegisterA32
*
rdn
,
U8
imm8
);
T16_ADD_IMM_RDN
(
RegisterA32
*
rdn
,
U8
imm8
);
DEFINE_IS
(
ADD_IMM_RDN
)
DEFINE_INST_CODE
(
ADD_IMM_RND
)
void
decode
(
T16_STRUCT_ADD_IMM_RDN
*
inst
)
override
;
void
decode
(
T16_STRUCT_ADD_IMM_RDN
*
inst
)
override
;
void
assembler
()
override
;
void
assembler
()
override
;
...
@@ -361,7 +370,7 @@ namespace SandHook {
...
@@ -361,7 +370,7 @@ namespace SandHook {
T16_CMP_REG_EXT
(
T16_STRUCT_CMP_REG_EXT
*
inst
);
T16_CMP_REG_EXT
(
T16_STRUCT_CMP_REG_EXT
*
inst
);
T16_CMP_REG_EXT
(
RegisterA32
*
rn
,
RegisterA32
*
rm
);
T16_CMP_REG_EXT
(
RegisterA32
&
rn
,
RegisterA32
&
rm
);
DEFINE_IS
(
CMP_REG_EXT
)
DEFINE_IS
(
CMP_REG_EXT
)
...
@@ -377,6 +386,44 @@ namespace SandHook {
...
@@ -377,6 +386,44 @@ namespace SandHook {
RegisterA32
*
rm
;
RegisterA32
*
rm
;
};
};
class
INST_T16
(
POP
)
:
public
InstructionT16
<
STRUCT_T16
(
POP
)
>
{
public
:
T16_POP
(
T16_STRUCT_POP
*
inst
);
T16_POP
(
const
RegisterList
&
registerList
);
DEFINE_IS
(
POP
)
DEFINE_INST_CODE
(
POP
)
void
decode
(
T16_STRUCT_POP
*
inst
)
override
;
void
assembler
()
override
;
public
:
RegisterList
registerList
;
};
class
INST_T16
(
PUSH
)
:
public
InstructionT16
<
STRUCT_T16
(
PUSH
)
>
{
public
:
T16_PUSH
(
T16_STRUCT_PUSH
*
inst
);
T16_PUSH
(
const
RegisterList
&
registerList
);
DEFINE_IS
(
PUSH
)
DEFINE_INST_CODE
(
PUSH
)
void
decode
(
T16_STRUCT_PUSH
*
inst
)
override
;
void
assembler
()
override
;
public
:
RegisterList
registerList
;
};
}
}
}
}
...
...
nativehook/src/main/cpp/archs/arm/arm32/inst/inst_t32.h
View file @
89594d29
...
@@ -61,8 +61,12 @@ namespace SandHook {
...
@@ -61,8 +61,12 @@ namespace SandHook {
return
4
;
return
4
;
}
}
void
onLabelApply
(
Addr
pc
)
override
{
void
*
getPC
()
override
{
this
->
onOffsetApply
(
pc
-
this
->
getVPC
()
-
2
*
size
());
return
reinterpret_cast
<
void
*>
((
Addr
)
Instruction
<
Inst
>::
getPC
()
+
2
*
size
());
}
Addr
getVPC
()
override
{
return
Instruction
<
Inst
>::
getVPC
()
+
2
*
size
();
}
}
static
inline
S32
signExtend32
(
unsigned
int
bits
,
U32
value
)
{
static
inline
S32
signExtend32
(
unsigned
int
bits
,
U32
value
)
{
...
...
nativehook/src/main/cpp/archs/arm/arm32/register/register_a32.h
View file @
89594d29
...
@@ -13,7 +13,20 @@ namespace SandHook {
...
@@ -13,7 +13,20 @@ namespace SandHook {
namespace
Asm
{
namespace
Asm
{
class
RegisterA32
:
public
Register
{
union
A32RegisterStruct
{
struct
{
U8
b3
;
U8
b2
;
U8
b1
;
U8
b0
;
}
u8
;
struct
{
U16
h
;
U16
l
;
}
u16
;
};
class
RegisterA32
:
public
Register
<
A32RegisterStruct
>
{
public
:
public
:
RegisterA32
();
RegisterA32
();
...
...
nativehook/src/main/cpp/archs/arm/arm64/inst/inst_arm64.h
View file @
89594d29
...
@@ -281,23 +281,6 @@ namespace SandHook {
...
@@ -281,23 +281,6 @@ namespace SandHook {
void
decode
(
STRUCT_A64
(
MOV_WIDE
)
*
decode
)
override
;
void
decode
(
STRUCT_A64
(
MOV_WIDE
)
*
decode
)
override
;
inline
U8
getShift
()
{
return
shift
;
}
inline
OP
getOpt
()
{
return
op
;
}
inline
U16
getImme
()
{
return
imme
;
}
inline
Register
*
getRd
()
{
return
rd
;
}
public
:
public
:
//can be 16/32/64/128
//can be 16/32/64/128
//hw = shift / 16
//hw = shift / 16
...
...
nativehook/src/main/cpp/archs/arm/arm64/register/register_a64.h
View file @
89594d29
...
@@ -11,7 +11,20 @@ namespace SandHook {
...
@@ -11,7 +11,20 @@ namespace SandHook {
namespace
Asm
{
namespace
Asm
{
class
RegisterA64
:
public
Register
{
union
A64RegisterStruct
{
struct
{
U16
d3
;
U16
d2
;
U16
d1
;
U16
d0
;
}
u16
;
struct
{
U32
h
;
U32
l
;
}
u32
;
};
class
RegisterA64
:
public
Register
<
A64RegisterStruct
>
{
public
:
public
:
enum
RegisterType
{
enum
RegisterType
{
...
...
nativehook/src/main/cpp/asm/cpu.h
View file @
89594d29
...
@@ -5,4 +5,16 @@
...
@@ -5,4 +5,16 @@
#ifndef SANDHOOK_CPU_H
#ifndef SANDHOOK_CPU_H
#define SANDHOOK_CPU_H
#define SANDHOOK_CPU_H
#include "register.h"
namespace
SandHook
{
namespace
VM
{
class
CPU
{
public
:
};
}
}
#endif //SANDHOOK_CPU_H
#endif //SANDHOOK_CPU_H
nativehook/src/main/cpp/asm/register.h
View file @
89594d29
...
@@ -17,6 +17,7 @@ namespace SandHook {
...
@@ -17,6 +17,7 @@ namespace SandHook {
Reg128Bit
=
128
Reg128Bit
=
128
};
};
template
<
typename
Data
>
class
Register
{
class
Register
{
public
:
public
:
...
@@ -64,8 +65,17 @@ namespace SandHook {
...
@@ -64,8 +65,17 @@ namespace SandHook {
return
!
(
rhs
==
*
this
);
return
!
(
rhs
==
*
this
);
}
}
virtual
void
setData
(
Data
data
)
{
this
->
data
=
data
;
}
virtual
Data
&
getData
()
{
return
data
;
}
private
:
private
:
U8
code
;
U8
code
;
Data
data
;
};
};
}
}
}
}
...
...
nativehook/src/main/cpp/asm/unit.h
View file @
89594d29
...
@@ -34,12 +34,12 @@ namespace SandHook {
...
@@ -34,12 +34,12 @@ namespace SandHook {
return
auto_alloc
?
nullptr
:
raw
;
return
auto_alloc
?
nullptr
:
raw
;
}
}
inline
Addr
getVPC
()
{
virtual
Addr
getVPC
()
{
return
vP
C
;
return
vP
os
;
}
}
inline
void
setVP
C
(
Addr
vPC
)
{
inline
void
setVP
os
(
Addr
vPos
)
{
this
->
vP
C
=
vPC
;
this
->
vP
os
=
vPos
;
}
}
inline
Raw
*
get
()
const
{
inline
Raw
*
get
()
const
{
...
@@ -88,7 +88,7 @@ namespace SandHook {
...
@@ -88,7 +88,7 @@ namespace SandHook {
private
:
private
:
Raw
*
raw
;
Raw
*
raw
;
Addr
vP
C
;
Addr
vP
os
;
bool
auto_alloc
=
false
;
bool
auto_alloc
=
false
;
};
};
...
...
nativehook/src/main/cpp/assembler/assembler.cpp
View file @
89594d29
...
@@ -16,7 +16,7 @@ void CodeContainer::setCodeBuffer(CodeBuffer *codeBuffer) {
...
@@ -16,7 +16,7 @@ void CodeContainer::setCodeBuffer(CodeBuffer *codeBuffer) {
void
CodeContainer
::
append
(
Unit
<
Base
>
*
unit
)
{
void
CodeContainer
::
append
(
Unit
<
Base
>
*
unit
)
{
units
.
push_back
(
unit
);
units
.
push_back
(
unit
);
unit
->
setVP
C
(
curPc
);
unit
->
setVP
os
(
curPc
);
switch
(
unit
->
unitType
())
{
switch
(
unit
->
unitType
())
{
case
UnitLabel
:
case
UnitLabel
:
labels
.
push_back
((
Label
*
)
unit
);
labels
.
push_back
((
Label
*
)
unit
);
...
...
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