Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tools
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
CodeLinaro
public-release-test-restored
platform
vendor
qcom-opensource
tools
Commits
42a0a8ec
Commit
42a0a8ec
authored
10 years ago
by
Linux Build Service Account
Committed by
Gerrit - the friendly Code Review server
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "linux-ramdump-parser-v2: Update mm functions for arm64"
parents
8a36966c
f5f3b0bc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
linux-ramdump-parser-v2/mm.py
+29
-6
29 additions, 6 deletions
linux-ramdump-parser-v2/mm.py
with
29 additions
and
6 deletions
linux-ramdump-parser-v2/mm.py
+
29
−
6
View file @
42a0a8ec
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
def
page_buddy
(
ramdump
,
page
):
def
page_buddy
(
ramdump
,
page
):
mapcount_offset
=
ramdump
.
field_offset
(
'
struct page
'
,
'
_mapcount
'
)
mapcount_offset
=
ramdump
.
field_offset
(
'
struct page
'
,
'
_mapcount
'
)
val
=
ramdump
.
read_
word
(
page
+
mapcount_offset
)
val
=
ramdump
.
read_
int
(
page
+
mapcount_offset
)
# -128 is the magic for in the buddy allocator
# -128 is the magic for in the buddy allocator
return
val
==
0xffffff80
return
val
==
0xffffff80
...
@@ -41,6 +41,9 @@ def page_zone(ramdump, page):
...
@@ -41,6 +41,9 @@ def page_zone(ramdump, page):
def
zone_is_highmem
(
ramdump
,
zone
):
def
zone_is_highmem
(
ramdump
,
zone
):
if
not
ramdump
.
is_config_defined
(
'
CONFIG_HIGHMEM
'
):
return
False
if
zone
is
None
:
if
zone
is
None
:
return
False
return
False
# not at all how linux does it but it works for our purposes...
# not at all how linux does it but it works for our purposes...
...
@@ -119,6 +122,22 @@ def page_to_pfn_sparse(ramdump, page):
...
@@ -119,6 +122,22 @@ def page_to_pfn_sparse(ramdump, page):
# divide by struct page size for division fun
# divide by struct page size for division fun
return
(
page
-
addr
)
/
sizeof_page
return
(
page
-
addr
)
/
sizeof_page
# Yes, we are hard coding the vmemmap. This isn't very likely to change unless
# the rest of the addresses start changing as well. When that happens, the
# entire parser will probably be broken in many other ways so a better solution
# can be derived then.
def
page_to_pfn_vmemmap
(
ramdump
,
page
):
mem_map
=
0xffffffbc00000000
page_size
=
ramdump
.
sizeof
(
'
struct page
'
)
return
((
page
-
mem_map
)
/
page_size
)
def
pfn_to_page_vmemmap
(
ramdump
,
pfn
):
mem_map
=
0xffffffbc00000000
page_size
=
ramdump
.
sizeof
(
'
struct page
'
)
pfn_offset
=
ramdump
.
phys_offset
>>
12
return
mem_map
+
(
pfn
*
page_size
)
def
page_to_pfn_flat
(
ramdump
,
page
):
def
page_to_pfn_flat
(
ramdump
,
page
):
mem_map_addr
=
ramdump
.
addr_lookup
(
'
mem_map
'
)
mem_map_addr
=
ramdump
.
addr_lookup
(
'
mem_map
'
)
...
@@ -139,6 +158,8 @@ def pfn_to_page_flat(ramdump, pfn):
...
@@ -139,6 +158,8 @@ def pfn_to_page_flat(ramdump, pfn):
def
page_to_pfn
(
ramdump
,
page
):
def
page_to_pfn
(
ramdump
,
page
):
if
ramdump
.
arm64
:
return
page_to_pfn_vmemmap
(
ramdump
,
page
)
if
ramdump
.
is_config_defined
(
'
CONFIG_SPARSEMEM
'
):
if
ramdump
.
is_config_defined
(
'
CONFIG_SPARSEMEM
'
):
return
page_to_pfn_sparse
(
ramdump
,
page
)
return
page_to_pfn_sparse
(
ramdump
,
page
)
else
:
else
:
...
@@ -146,6 +167,8 @@ def page_to_pfn(ramdump, page):
...
@@ -146,6 +167,8 @@ def page_to_pfn(ramdump, page):
def
pfn_to_page
(
ramdump
,
pfn
):
def
pfn_to_page
(
ramdump
,
pfn
):
if
ramdump
.
arm64
:
return
pfn_to_page_vmemmap
(
ramdump
,
pfn
)
if
ramdump
.
is_config_defined
(
'
CONFIG_SPARSEMEM
'
):
if
ramdump
.
is_config_defined
(
'
CONFIG_SPARSEMEM
'
):
return
pfn_to_page_sparse
(
ramdump
,
pfn
)
return
pfn_to_page_sparse
(
ramdump
,
pfn
)
else
:
else
:
...
@@ -157,7 +180,7 @@ def sparsemem_lowmem_page_address(ramdump, page):
...
@@ -157,7 +180,7 @@ def sparsemem_lowmem_page_address(ramdump, page):
membank0_size
=
ramdump
.
read_word
(
ramdump
.
addr_lookup
(
'
membank0_size
'
))
membank0_size
=
ramdump
.
read_word
(
ramdump
.
addr_lookup
(
'
membank0_size
'
))
# XXX currently magic
# XXX currently magic
membank0_phys_offset
=
ramdump
.
phys_offset
membank0_phys_offset
=
ramdump
.
phys_offset
membank0_page_offset
=
0xc0000000
membank0_page_offset
=
ramdump
.
page_offset
membank1_phys_offset
=
membank1_start
membank1_phys_offset
=
membank1_start
membank1_page_offset
=
membank0_page_offset
+
membank0_size
membank1_page_offset
=
membank0_page_offset
+
membank0_size
phys
=
page_to_pfn
(
ramdump
,
page
)
<<
12
phys
=
page_to_pfn
(
ramdump
,
page
)
<<
12
...
@@ -178,18 +201,18 @@ def dont_map_hole_lowmem_page_address(ramdump, page):
...
@@ -178,18 +201,18 @@ def dont_map_hole_lowmem_page_address(ramdump, page):
hole_end
=
ramdump
.
read_word
(
hole_end_addr
)
hole_end
=
ramdump
.
read_word
(
hole_end_addr
)
hole_offset
=
ramdump
.
read_word
(
hole_offset_addr
)
hole_offset
=
ramdump
.
read_word
(
hole_offset_addr
)
if
hole_end
!=
0
and
phys
>=
hole_end
:
if
hole_end
!=
0
and
phys
>=
hole_end
:
return
phys
-
hole_end
+
hole_offset
+
0xc0000000
return
phys
-
hole_end
+
hole_offset
+
ramdump
.
page_offset
else
:
else
:
return
phys
-
ramdump
.
phys_offset
+
0xc0000000
return
phys
-
ramdump
.
phys_offset
+
ramdump
.
page_offset
def
normal_lowmem_page_address
(
ramdump
,
page
):
def
normal_lowmem_page_address
(
ramdump
,
page
):
phys
=
page_to_pfn
(
ramdump
,
page
)
<<
12
phys
=
page_to_pfn
(
ramdump
,
page
)
<<
12
return
phys
-
ramdump
.
phys_offset
+
0xc0000000
return
phys
-
ramdump
.
phys_offset
+
ramdump
.
page_offset
def
lowmem_page_address
(
ramdump
,
page
):
def
lowmem_page_address
(
ramdump
,
page
):
if
ramdump
.
is_config_defined
(
'
CONFIG_SPARSEMEM
'
):
if
ramdump
.
is_config_defined
(
'
CONFIG_SPARSEMEM
'
)
and
not
ramdump
.
arm64
:
return
sparsemem_lowmem_page_address
(
ramdump
,
page
)
return
sparsemem_lowmem_page_address
(
ramdump
,
page
)
elif
ramdump
.
is_config_defined
(
'
CONFIG_DONT_MAP_HOLE_AFTER_MEMBANK0
'
):
elif
ramdump
.
is_config_defined
(
'
CONFIG_DONT_MAP_HOLE_AFTER_MEMBANK0
'
):
return
dont_map_hole_lowmem_page_address
(
ramdump
,
page
)
return
dont_map_hole_lowmem_page_address
(
ramdump
,
page
)
...
...
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