Skip to content

Commit 8672a0a

Browse files
committed
.DEBUG: Add utility function to dump memory page
1 parent 4eea5f7 commit 8672a0a

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

kernel/debug/sk-dump.adb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
--
1818

19+
with System;
20+
1921
with SK.KC;
2022
with SK.Debug_Lock;
2123
with SK.CPU_Info;
@@ -36,6 +38,26 @@ is
3638

3739
-------------------------------------------------------------------------
3840

41+
procedure Dump_Page (Address : SK.Word64)
42+
is
43+
Mem_Page : array (0 .. SK.Page_Size - 1) of SK.Byte
44+
with
45+
Address => System'To_Address (Address);
46+
begin
47+
for I in Mem_Page'Range loop
48+
if I mod 16 = 0 then
49+
KC.New_Line;
50+
KC.Put_String (Item => SK.Strings.Img (SK.Word16 (I)) & ": ");
51+
end if;
52+
KC.Put_String
53+
(Item => SK.Strings.Img_Nobase (Item => Mem_Page (I)) & " ");
54+
end loop;
55+
KC.New_Line;
56+
KC.New_Line;
57+
end Dump_Page;
58+
59+
-------------------------------------------------------------------------
60+
3961
procedure Print_Segment
4062
(Name : String;
4163
Seg : Segment_Type)

kernel/debug/sk-dump.ads

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,7 @@ is
7575
(Reason : Crash_Audit_Types.VTx_Reason_Range;
7676
Context : Crash_Audit_Types.VTx_Context_Type);
7777

78+
-- Dump contents of the 4K memory page with given address.
79+
procedure Dump_Page (Address : SK.Word64);
80+
7881
end SK.Dump;

0 commit comments

Comments
 (0)