---------------------------------
-- It would be nice to replace these with intrinsics, but that does
- -- not work yet (the back end would be ok, but GNAT itself objects)
+ -- not work yet (the back end would be ok, but GNAT itself objects) ???
type BU is mod 2 ** Unsigned_Byte'Size;
-- Unsigned type of same length as Unsigned_Byte
---------------------------------
-- It would be nice to replace these with intrinsics, but that does
- -- not work yet (the back end would be ok, but GNAT itself objects)
+ -- not work yet (the back end would be ok, but GNAT itself objects) ???
type WU is mod 2 ** Unsigned_Word'Size;
-- Unsigned type of same length as Unsigned_Word
-------------------------------------
-- It would be nice to replace these with intrinsics, but that does
- -- not work yet (the back end would be ok, but GNAT itself objects)
+ -- not work yet (the back end would be ok, but GNAT itself objects) ???
type LWU is mod 2 ** Unsigned_Longword'Size;
-- Unsigned type of same length as Unsigned_Longword
-------------------------------
-- It would be nice to replace these with intrinsics, but that does
- -- not work yet (the back end would be ok, but GNAT itself objects)
+ -- not work yet (the back end would be ok, but GNAT itself objects) ???
type U32 is mod 2 ** Unsigned_32'Size;
-- Unsigned type of same length as Unsigned_32
-------------------------------------
-- It would be nice to replace these with intrinsics, but that does
- -- not work yet (the back end would be ok, but GNAT itself objects)
+ -- not work yet (the back end would be ok, but GNAT itself objects) ???
type QWU is mod 2 ** 64; -- 64 = Unsigned_Quadword'Size
-- Unsigned type of same length as Unsigned_Quadword
use ASCII;
Clr_Bit : Boolean := Bit;
Old_Bit : Boolean;
+
begin
+ -- All these ASM sequences should be commented. I suggest definining
+ -- a constant called E which is LF & HT and then you have more space
+ -- for line by line comments ???
+
System.Machine_Code.Asm
(
"lda $16, %2" & LF & HT &
"mb" & LF & HT &
"xor %1, 1, %1" & LF & HT &
"trapb",
- Outputs => (Boolean'Asm_Output ("=m", Clr_Bit),
- Boolean'Asm_Output ("=r", Old_Bit)),
- Inputs => Boolean'Asm_Input ("m", Clr_Bit),
- Clobber => "$1, $16, $17, $18",
+ Outputs => (Boolean'Asm_Output ("=m", Clr_Bit),
+ Boolean'Asm_Output ("=r", Old_Bit)),
+ Inputs => Boolean'Asm_Input ("m", Clr_Bit),
+ Clobber => "$1, $16, $17, $18",
Volatile => True);
Bit := Clr_Bit;
use ASCII;
Clr_Bit : Boolean := Bit;
Succ, Old_Bit : Boolean;
+
begin
System.Machine_Code.Asm
(
"mb" & LF & HT &
"xor %1, 1, %1" & LF & HT &
"trapb",
- Outputs => (Boolean'Asm_Output ("=m", Clr_Bit),
- Boolean'Asm_Output ("=r", Old_Bit),
- Boolean'Asm_Output ("=r", Succ)),
- Inputs => (Boolean'Asm_Input ("m", Clr_Bit),
- Natural'Asm_Input ("rJ", Retry_Count)),
- Clobber => "$16, $17, $18, $19",
+ Outputs => (Boolean'Asm_Output ("=m", Clr_Bit),
+ Boolean'Asm_Output ("=r", Old_Bit),
+ Boolean'Asm_Output ("=r", Succ)),
+ Inputs => (Boolean'Asm_Input ("m", Clr_Bit),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$16, $17, $18, $19",
Volatile => True);
Bit := Clr_Bit;
use ASCII;
Set_Bit : Boolean := Bit;
Old_Bit : Boolean;
+
begin
+ -- Don't we need comments on these long asm sequences???
+
System.Machine_Code.Asm
(
"lda $16, %2" & LF & HT &
"beq $1, 1b" & LF & HT &
"mb" & LF & HT &
"trapb",
- Outputs => (Boolean'Asm_Output ("=m", Set_Bit),
- Boolean'Asm_Output ("=r", Old_Bit)),
- Inputs => Boolean'Asm_Input ("m", Set_Bit),
- Clobber => "$1, $16, $17, $18",
+ Outputs => (Boolean'Asm_Output ("=m", Set_Bit),
+ Boolean'Asm_Output ("=r", Old_Bit)),
+ Inputs => Boolean'Asm_Input ("m", Set_Bit),
+ Clobber => "$1, $16, $17, $18",
Volatile => True);
Bit := Set_Bit;
use ASCII;
Set_Bit : Boolean := Bit;
Succ, Old_Bit : Boolean;
+
begin
System.Machine_Code.Asm
(
"3:" & LF & HT &
"mb" & LF & HT &
"trapb",
- Outputs => (Boolean'Asm_Output ("=m", Set_Bit),
- Boolean'Asm_Output ("=r", Old_Bit),
- Boolean'Asm_Output ("=r", Succ)),
- Inputs => (Boolean'Asm_Input ("m", Set_Bit),
- Natural'Asm_Input ("rJ", Retry_Count)),
- Clobber => "$16, $17, $18, $19",
+ Outputs => (Boolean'Asm_Output ("=m", Set_Bit),
+ Boolean'Asm_Output ("=r", Old_Bit),
+ Boolean'Asm_Output ("=r", Succ)),
+ Inputs => (Boolean'Asm_Input ("m", Set_Bit),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$16, $17, $18, $19",
Volatile => True);
Bit := Set_Bit;
is
use ASCII;
Overflowed : Boolean := False;
+
begin
System.Machine_Code.Asm
(
"lda $16, -1" & LF & HT &
"cmovne $0, $16, %1" & LF & HT &
"2:",
- Outputs => (Aligned_Word'Asm_Output ("=m", Augend),
- Integer'Asm_Output ("=r", Sign),
- Boolean'Asm_Output ("=r", Overflowed)),
- Inputs => (Short_Integer'Asm_Input ("r", Addend),
- Aligned_Word'Asm_Input ("m", Augend)),
- Clobber => "$0, $1, $16, $17, $18, $19, $20, $21",
+ Outputs => (Aligned_Word'Asm_Output ("=m", Augend),
+ Integer'Asm_Output ("=r", Sign),
+ Boolean'Asm_Output ("=r", Overflowed)),
+ Inputs => (Short_Integer'Asm_Input ("r", Addend),
+ Aligned_Word'Asm_Input ("m", Augend)),
+ Clobber => "$0, $1, $16, $17, $18, $19, $20, $21",
Volatile => True);
if Overflowed then
Amount : Integer)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"stl_c $0, %1" & LF & HT &
"beq $0, 1b" & LF & HT &
"mb",
- Outputs => Aligned_Integer'Asm_Output ("=m", To),
- Inputs => (Aligned_Integer'Asm_Input ("m", To),
- Integer'Asm_Input ("rJ", Amount)),
- Clobber => "$0, $1",
+ Outputs => Aligned_Integer'Asm_Output ("=m", To),
+ Inputs => (Aligned_Integer'Asm_Input ("m", To),
+ Integer'Asm_Input ("rJ", Amount)),
+ Clobber => "$0, $1",
Volatile => True);
end Add_Atomic;
Success_Flag : out Boolean)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"bgt $17, 1b" & LF & HT &
"br 3b" & LF & HT &
"4:",
- Outputs => (Aligned_Integer'Asm_Output ("=m", To),
- Integer'Asm_Output ("=m", Old_Value),
- Boolean'Asm_Output ("=m", Success_Flag)),
- Inputs => (Aligned_Integer'Asm_Input ("m", To),
- Integer'Asm_Input ("rJ", Amount),
- Natural'Asm_Input ("rJ", Retry_Count)),
- Clobber => "$0, $1, $17",
+ Outputs => (Aligned_Integer'Asm_Output ("=m", To),
+ Integer'Asm_Output ("=m", Old_Value),
+ Boolean'Asm_Output ("=m", Success_Flag)),
+ Inputs => (Aligned_Integer'Asm_Input ("m", To),
+ Integer'Asm_Input ("rJ", Amount),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$0, $1, $17",
Volatile => True);
end Add_Atomic;
Amount : Long_Integer)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"stq_c $0, %1" & LF & HT &
"beq $0, 1b" & LF & HT &
"mb",
- Outputs => Aligned_Long_Integer'Asm_Output ("=m", To),
- Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
- Long_Integer'Asm_Input ("rJ", Amount)),
- Clobber => "$0, $1",
+ Outputs => Aligned_Long_Integer'Asm_Output ("=m", To),
+ Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
+ Long_Integer'Asm_Input ("rJ", Amount)),
+ Clobber => "$0, $1",
Volatile => True);
end Add_Atomic;
Success_Flag : out Boolean)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"bgt $17, 1b" & LF & HT &
"br 3b" & LF & HT &
"4:",
- Outputs => (Aligned_Long_Integer'Asm_Output ("=m", To),
- Long_Integer'Asm_Output ("=m", Old_Value),
- Boolean'Asm_Output ("=m", Success_Flag)),
- Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
- Long_Integer'Asm_Input ("rJ", Amount),
- Natural'Asm_Input ("rJ", Retry_Count)),
- Clobber => "$0, $1, $17",
+ Outputs => (Aligned_Long_Integer'Asm_Output ("=m", To),
+ Long_Integer'Asm_Output ("=m", Old_Value),
+ Boolean'Asm_Output ("=m", Success_Flag)),
+ Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
+ Long_Integer'Asm_Input ("rJ", Amount),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$0, $1, $17",
Volatile => True);
end Add_Atomic;
From : Integer)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"stl_c $0, %1" & LF & HT &
"beq $0, 1b" & LF & HT &
"mb",
- Outputs => Aligned_Integer'Asm_Output ("=m", To),
- Inputs => (Aligned_Integer'Asm_Input ("m", To),
- Integer'Asm_Input ("rJ", From)),
- Clobber => "$0, $1",
+ Outputs => Aligned_Integer'Asm_Output ("=m", To),
+ Inputs => (Aligned_Integer'Asm_Input ("m", To),
+ Integer'Asm_Input ("rJ", From)),
+ Clobber => "$0, $1",
Volatile => True);
end And_Atomic;
Success_Flag : out Boolean)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"bgt $17, 1b" & LF & HT &
"br 3b" & LF & HT &
"4:",
- Outputs => (Aligned_Integer'Asm_Output ("=m", To),
- Integer'Asm_Output ("=m", Old_Value),
- Boolean'Asm_Output ("=m", Success_Flag)),
- Inputs => (Aligned_Integer'Asm_Input ("m", To),
- Integer'Asm_Input ("rJ", From),
- Natural'Asm_Input ("rJ", Retry_Count)),
- Clobber => "$0, $1, $17",
+ Outputs => (Aligned_Integer'Asm_Output ("=m", To),
+ Integer'Asm_Output ("=m", Old_Value),
+ Boolean'Asm_Output ("=m", Success_Flag)),
+ Inputs => (Aligned_Integer'Asm_Input ("m", To),
+ Integer'Asm_Input ("rJ", From),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$0, $1, $17",
Volatile => True);
end And_Atomic;
From : Long_Integer)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"stq_c $0, %1" & LF & HT &
"beq $0, 1b" & LF & HT &
"mb",
- Outputs => Aligned_Long_Integer'Asm_Output ("=m", To),
- Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
- Long_Integer'Asm_Input ("rJ", From)),
- Clobber => "$0, $1",
+ Outputs => Aligned_Long_Integer'Asm_Output ("=m", To),
+ Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
+ Long_Integer'Asm_Input ("rJ", From)),
+ Clobber => "$0, $1",
Volatile => True);
end And_Atomic;
Success_Flag : out Boolean)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"bgt $17, 1b" & LF & HT &
"br 3b" & LF & HT &
"4:",
- Outputs => (Aligned_Long_Integer'Asm_Output ("=m", To),
- Long_Integer'Asm_Output ("=m", Old_Value),
- Boolean'Asm_Output ("=m", Success_Flag)),
- Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
- Long_Integer'Asm_Input ("rJ", From),
- Natural'Asm_Input ("rJ", Retry_Count)),
- Clobber => "$0, $1, $17",
+ Outputs => (Aligned_Long_Integer'Asm_Output ("=m", To),
+ Long_Integer'Asm_Output ("=m", Old_Value),
+ Boolean'Asm_Output ("=m", Success_Flag)),
+ Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
+ Long_Integer'Asm_Input ("rJ", From),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$0, $1, $17",
Volatile => True);
end And_Atomic;
From : Integer)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"stl_c $0, %1" & LF & HT &
"beq $0, 1b" & LF & HT &
"mb",
- Outputs => Aligned_Integer'Asm_Output ("=m", To),
- Inputs => (Aligned_Integer'Asm_Input ("m", To),
- Integer'Asm_Input ("rJ", From)),
- Clobber => "$0, $1",
+ Outputs => Aligned_Integer'Asm_Output ("=m", To),
+ Inputs => (Aligned_Integer'Asm_Input ("m", To),
+ Integer'Asm_Input ("rJ", From)),
+ Clobber => "$0, $1",
Volatile => True);
end Or_Atomic;
Success_Flag : out Boolean)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"bgt $17, 1b" & LF & HT &
"br 3b" & LF & HT &
"4:",
- Outputs => (Aligned_Integer'Asm_Output ("=m", To),
- Integer'Asm_Output ("=m", Old_Value),
- Boolean'Asm_Output ("=m", Success_Flag)),
- Inputs => (Aligned_Integer'Asm_Input ("m", To),
- Integer'Asm_Input ("rJ", From),
- Natural'Asm_Input ("rJ", Retry_Count)),
- Clobber => "$0, $1, $17",
+ Outputs => (Aligned_Integer'Asm_Output ("=m", To),
+ Integer'Asm_Output ("=m", Old_Value),
+ Boolean'Asm_Output ("=m", Success_Flag)),
+ Inputs => (Aligned_Integer'Asm_Input ("m", To),
+ Integer'Asm_Input ("rJ", From),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$0, $1, $17",
Volatile => True);
end Or_Atomic;
From : Long_Integer)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"stq_c $0, %1" & LF & HT &
"beq $0, 1b" & LF & HT &
"mb",
- Outputs => Aligned_Long_Integer'Asm_Output ("=m", To),
- Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
- Long_Integer'Asm_Input ("rJ", From)),
- Clobber => "$0, $1",
+ Outputs => Aligned_Long_Integer'Asm_Output ("=m", To),
+ Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
+ Long_Integer'Asm_Input ("rJ", From)),
+ Clobber => "$0, $1",
Volatile => True);
end Or_Atomic;
Success_Flag : out Boolean)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"bgt $17, 1b" & LF & HT &
"br 3b" & LF & HT &
"4:",
- Outputs => (Aligned_Long_Integer'Asm_Output ("=m", To),
- Long_Integer'Asm_Output ("=m", Old_Value),
- Boolean'Asm_Output ("=m", Success_Flag)),
- Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
- Long_Integer'Asm_Input ("rJ", From),
- Natural'Asm_Input ("rJ", Retry_Count)),
- Clobber => "$0, $1, $17",
+ Outputs => (Aligned_Long_Integer'Asm_Output ("=m", To),
+ Long_Integer'Asm_Output ("=m", Old_Value),
+ Boolean'Asm_Output ("=m", Success_Flag)),
+ Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
+ Long_Integer'Asm_Input ("rJ", From),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$0, $1, $17",
Volatile => True);
end Or_Atomic;
procedure Insqhi
(Item : Address;
Header : Address;
- Status : out Insq_Status) is
-
+ Status : out Insq_Status)
+ is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"mb" & LF & HT &
"call_pal 0x87" & LF & HT &
"mb",
- Outputs => Insq_Status'Asm_Output ("=v", Status),
- Inputs => (Address'Asm_Input ("rJ", Item),
- Address'Asm_Input ("rJ", Header)),
- Clobber => "$16, $17",
+ Outputs => Insq_Status'Asm_Output ("=v", Status),
+ Inputs => (Address'Asm_Input ("rJ", Item),
+ Address'Asm_Input ("rJ", Header)),
+ Clobber => "$16, $17",
Volatile => True);
end Insqhi;
Status : out Remq_Status)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"call_pal 0x93" & LF & HT &
"mb" & LF & HT &
"bis $31, $1, %1",
- Outputs => (Remq_Status'Asm_Output ("=v", Status),
- Address'Asm_Output ("=r", Item)),
- Inputs => Address'Asm_Input ("rJ", Header),
- Clobber => "$1, $16",
+ Outputs => (Remq_Status'Asm_Output ("=v", Status),
+ Address'Asm_Output ("=r", Item)),
+ Inputs => Address'Asm_Input ("rJ", Header),
+ Clobber => "$1, $16",
Volatile => True);
end Remqhi;
procedure Insqti
(Item : Address;
Header : Address;
- Status : out Insq_Status) is
-
+ Status : out Insq_Status)
+ is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"mb" & LF & HT &
"call_pal 0x88" & LF & HT &
"mb",
- Outputs => Insq_Status'Asm_Output ("=v", Status),
- Inputs => (Address'Asm_Input ("rJ", Item),
- Address'Asm_Input ("rJ", Header)),
- Clobber => "$16, $17",
+ Outputs => Insq_Status'Asm_Output ("=v", Status),
+ Inputs => (Address'Asm_Input ("rJ", Item),
+ Address'Asm_Input ("rJ", Header)),
+ Clobber => "$16, $17",
Volatile => True);
end Insqti;
Status : out Remq_Status)
is
use ASCII;
+
begin
System.Machine_Code.Asm
(
"call_pal 0x94" & LF & HT &
"mb" & LF & HT &
"bis $31, $1, %1",
- Outputs => (Remq_Status'Asm_Output ("=v", Status),
- Address'Asm_Output ("=r", Item)),
- Inputs => Address'Asm_Input ("rJ", Header),
- Clobber => "$1, $16",
+ Outputs => (Remq_Status'Asm_Output ("=v", Status),
+ Address'Asm_Output ("=r", Item)),
+ Inputs => Address'Asm_Input ("rJ", Header),
+ Clobber => "$1, $16",
Volatile => True);
end Remqti;