Skip to content

Commit 8a322f3

Browse files
committed
Move VMX_Timer_Rate from Skp.Scheduling to Skp.Arch
Generate VMX_Timer_Rate constant in Skp.Arch package instead of Skp.Scheduling.
1 parent e06d9b4 commit 8a322f3

File tree

6 files changed

+18
-16
lines changed

6 files changed

+18
-16
lines changed

mugenspec/data/skp-arch.ads

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package Skp.Arch
55
is
66

7-
Vmxon_Address : constant := 16#1000#;
7+
Vmxon_Address : constant := 16#1000#;
8+
VMX_Timer_Rate : constant := 5;
89

910
end Skp.Arch;

mugenspec/data/skp-scheduling.ads

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ with SK;
77
package Skp.Scheduling
88
is
99

10-
VMX_Timer_Rate : constant := 5;
11-
1210
Max_Groups_Per_Partition : constant := 64;
1311

1412
type Scheduling_Partition_Range is range 1 .. 3;

mugenspec/src/spec-skp_arch.adb

Lines changed: 14 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 Ada.Strings.Fixed;
20+
1921
with Interfaces;
2022

2123
with Mulog;
@@ -42,6 +44,12 @@ is
4244
XPath => "/system/memory/memory[@type='system_vmxon' and "
4345
& "contains(string(@name),'kernel_0')]",
4446
Name => "physicalAddress"));
47+
Timer_Rate : constant Natural
48+
:= Natural'Value
49+
(Muxml.Utils.Get_Attribute
50+
(Doc => Policy.Doc,
51+
XPath => "/system/hardware/processor",
52+
Name => "vmxTimerRate"));
4553

4654
Tmpl : Mutools.Templates.Template_Type;
4755
begin
@@ -54,6 +62,12 @@ is
5462
(Template => Tmpl,
5563
Pattern => "__vmxon_addr__",
5664
Content => Mutools.Utils.To_Hex (Number => VMXON_Addr));
65+
Mutools.Templates.Replace
66+
(Template => Tmpl,
67+
Pattern => "__vmx_timer_rate__",
68+
Content => Ada.Strings.Fixed.Trim
69+
(Source => Timer_Rate'Img,
70+
Side => Ada.Strings.Left));
5771
Mutools.Templates.Write
5872
(Template => Tmpl,
5973
Filename => Output_Dir & "/" & Filename);

mugenspec/src/spec-skp_scheduling.adb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,6 @@ is
108108
(DOM.Core.Elements.Get_Attribute
109109
(Elem => Processor,
110110
Name => "speed"));
111-
Timer_Rate : constant Natural
112-
:= Natural'Value
113-
(DOM.Core.Elements.Get_Attribute (Elem => Processor,
114-
Name => "vmxTimerRate"));
115111
Timer_Factor : constant Interfaces.Unsigned_64
116112
:= CPU_Speed_Hz / Interfaces.Unsigned_64'Value
117113
(DOM.Core.Elements.Get_Attribute
@@ -564,12 +560,6 @@ is
564560
Max_Minor_Count := Get_Max_Minor_Count (Schedule => Scheduling);
565561
Max_Barrier_Count := Get_Max_Barrier_Count (Schedule => Scheduling);
566562

567-
TMPL.Stream (Template => Template);
568-
TMPL.Write
569-
(Template => Template,
570-
Item => Ada.Strings.Fixed.Trim
571-
(Source => Timer_Rate'Img,
572-
Side => Ada.Strings.Left));
573563
TMPL.Stream (Template => Template);
574564
TMPL.Write
575565
(Template => Template,

mugenspec/templates/skp-arch.ads

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package Skp.Arch
55
is
66

7-
Vmxon_Address : constant := __vmxon_addr__;
7+
Vmxon_Address : constant := __vmxon_addr__;
8+
VMX_Timer_Rate : constant := __vmx_timer_rate__;
89

910
end Skp.Arch;

mugenspec/templates/skp-scheduling-x86_64.ads

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ with SK;
77
package Skp.Scheduling
88
is
99

10-
VMX_Timer_Rate : constant := __vmx_timer_rate__;
11-
1210
Max_Groups_Per_Partition : constant := __max_groups_per_partition__;
1311

1412
type Scheduling_Partition_Range is range __scheduling_partition_range__;

0 commit comments

Comments
 (0)