Skip to content
This repository was archived by the owner on May 22, 2023. It is now read-only.

Commit 6eb3610

Browse files
jklmnnsenier
authored andcommitted
prove rom test
ref #80
1 parent 1d3ae9b commit 6eb3610

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

src/rom/client/muen/componolit-gneiss-rom-client.adb

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,20 @@ is
1818
Rom_Name : constant Musinfo.Name_Type :=
1919
(if Name = "" then CIM.String_To_Name ("config") else CIM.String_To_Name (Name));
2020
begin
21-
C.Mem := Musinfo.Instance.Memory_By_Name (Rom_Name);
21+
if Musinfo.Instance.Is_Valid then
22+
C.Mem := Musinfo.Instance.Memory_By_Name (Rom_Name);
23+
end if;
2224
end Initialize;
2325

2426
procedure Load (C : in out Client_Session)
2527
is
2628
use type Standard.Interfaces.Unsigned_64;
2729
function Max_Index (Size : Standard.Interfaces.Unsigned_64) return Index is
28-
(if Standard.Interfaces.Unsigned_64 (Index'Last) > Size then Index (Size) else Index'Last);
30+
(if Standard.Interfaces.Unsigned_64 (Index'Last - Index'First) > Size
31+
and then Standard.Interfaces.Unsigned_64 (Index'Last) <= Size then Index (Size) else Index'Last);
2932
I : constant Index := Max_Index (C.Mem.Size / (Element'Size / 8));
3033
B : Buffer (Index'First .. Index'First + I - 1) with
34+
Import,
3135
Address => System'To_Address (C.Mem.Address);
3236
begin
3337
Parse (B);
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
with Musinfo;
3+
with Musinfo.Instance;
34

45
package body Componolit.Gneiss.Rom with
56
SPARK_Mode
@@ -8,6 +9,7 @@ is
89
use type Musinfo.Memregion_Type;
910

1011
function Initialized (C : Client_Session) return Boolean is
11-
(C.Mem /= Musinfo.Null_Memregion);
12+
(Musinfo.Instance.Is_Valid
13+
and then C.Mem /= Musinfo.Null_Memregion);
1214

1315
end Componolit.Gneiss.Rom;

test/rom/component.adb

+8-1
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,19 @@ is
3737
if not Componolit.Gneiss.Log.Initialized (Log) and then Data'Length > 1 then
3838
for I in Data'Range loop
3939
if Data (I) = ASCII.LF then
40-
Last := I - 1;
40+
if I > Data'First then
41+
Last := I - 1;
42+
else
43+
Last := Data'First;
44+
end if;
4145
exit;
4246
end if;
4347
end loop;
4448
Componolit.Gneiss.Log.Client.Initialize (Log, C, Data (Data'First .. Last));
4549
if Componolit.Gneiss.Log.Initialized (Log) then
50+
if Data (Data'First .. Last)'Length > Componolit.Gneiss.Log.Maximum_Message_Length (Log) - 35 then
51+
Last := Data'First + (Componolit.Gneiss.Log.Maximum_Message_Length (Log) - 36);
52+
end if;
4653
Componolit.Gneiss.Log.Client.Info (Log, "Log session configured with label: "
4754
& Data (Data'First .. Last));
4855
else

0 commit comments

Comments
 (0)