Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libtcg
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Anton
libtcg
Commits
b6430927
Commit
b6430927
authored
10 months ago
by
Anton
Browse files
Options
Downloads
Patches
Plain Diff
assert room in buffer
parent
1ccb3ffe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libtcg/libtcg.c
+6
-5
6 additions, 5 deletions
libtcg/libtcg.c
with
6 additions
and
5 deletions
libtcg/libtcg.c
+
6
−
5
View file @
b6430927
...
...
@@ -61,18 +61,19 @@ typedef struct BytecodeRegion {
* accel/tcg/user-exec.c. We override them to read bytecode from the
* BytecodeRegion struct passed by via CPUState->opaque instead.
*/
static
inline
void
*
vaddr_to_buf_ptr
(
CPUArchState
*
env
,
abi_ptr
ptr
)
static
inline
void
*
vaddr_to_buf_ptr
(
CPUArchState
*
env
,
abi_ptr
ptr
,
size_t
type_size
)
{
CPUState
*
cpu
=
env_cpu
(
env
);
BytecodeRegion
*
region
=
cpu
->
opaque
;
uint64_t
offset
=
(
uintptr_t
)
ptr
-
region
->
virtual_address
;
assert
(
offset
+
type_size
<=
region
->
size
);
return
(
void
*
)
((
uintptr_t
)
region
->
buffer
+
offset
);
}
uint32_t
cpu_ldub_code
(
CPUArchState
*
env
,
abi_ptr
ptr
)
{
return
ldub_p
(
vaddr_to_buf_ptr
(
env
,
ptr
));
}
uint32_t
cpu_lduw_code
(
CPUArchState
*
env
,
abi_ptr
ptr
)
{
return
lduw_p
(
vaddr_to_buf_ptr
(
env
,
ptr
));
}
uint32_t
cpu_ldl_code
(
CPUArchState
*
env
,
abi_ptr
ptr
)
{
return
ldl_p
(
vaddr_to_buf_ptr
(
env
,
ptr
));
}
uint64_t
cpu_ldq_code
(
CPUArchState
*
env
,
abi_ptr
ptr
)
{
return
ldq_p
(
vaddr_to_buf_ptr
(
env
,
ptr
));
}
uint32_t
cpu_ldub_code
(
CPUArchState
*
env
,
abi_ptr
ptr
)
{
return
ldub_p
(
vaddr_to_buf_ptr
(
env
,
ptr
,
1
));
}
uint32_t
cpu_lduw_code
(
CPUArchState
*
env
,
abi_ptr
ptr
)
{
return
lduw_p
(
vaddr_to_buf_ptr
(
env
,
ptr
,
2
));
}
uint32_t
cpu_ldl_code
(
CPUArchState
*
env
,
abi_ptr
ptr
)
{
return
ldl_p
(
vaddr_to_buf_ptr
(
env
,
ptr
,
4
));
}
uint64_t
cpu_ldq_code
(
CPUArchState
*
env
,
abi_ptr
ptr
)
{
return
ldq_p
(
vaddr_to_buf_ptr
(
env
,
ptr
,
8
));
}
//static inline bool instruction_has_label_argument(TCGOpcode opc)
//{
...
...
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