Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
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
wenyuanbo
tic
Commits
44cb1054
Commit
44cb1054
authored
Dec 22, 2019
by
Liangfu Chen
Committed by
Thierry Moreau
Dec 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[VTA] improved virtual memory mapping (#4545)
* [VTA] improved virtual memory mapping * Update virtual_memory.cc
parent
76076ec3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
vta/src/vmem/virtual_memory.cc
+12
-2
No files found.
vta/src/vmem/virtual_memory.cc
View file @
44cb1054
...
...
@@ -66,9 +66,19 @@ void* VirtualMemoryManager::GetAddr(uint64_t phy_addr) {
vta_phy_addr_t
VirtualMemoryManager
::
GetPhyAddr
(
void
*
buf
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
auto
it
=
pmap_
.
find
(
buf
);
CHECK
(
it
!=
pmap_
.
end
());
uint64_t
offset
=
0
;
if
(
it
==
pmap_
.
end
())
{
for
(
it
=
pmap_
.
begin
();
it
!=
pmap_
.
end
();
it
++
)
{
uint64_t
bytes
=
it
->
second
->
num_pages
<<
kPageBits
;
if
((
buf
>=
it
->
first
)
&&
(
buf
<
static_cast
<
char
*>
(
it
->
first
)
+
bytes
))
{
offset
=
static_cast
<
char
*>
(
buf
)
-
static_cast
<
char
*>
(
it
->
first
);
break
;
}
}
CHECK
(
it
!=
pmap_
.
end
());
}
Page
*
p
=
it
->
second
.
get
();
return
(
p
->
ptable_begin
+
1
)
<<
kPageBits
;
return
(
(
p
->
ptable_begin
+
1
)
<<
kPageBits
)
+
offset
;
}
/*!
...
...
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