From: "Luke A. Guest" <laguest@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk>
Subject: Address representation clause is getting 0
Date: Wed, 31 Dec 2003 12:29:19 +0000
Date: 2003-12-31T12:29:19+00:00 [thread overview]
Message-ID: <pan.2003.12.31.12.29.15.607621@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk> (raw)
Hi,
I'm working on an embedded project on an SGI O2 machine. I have a GNAT/GCC
compiler set for mips-elf compiled and All I'm trying to do is to get the
System Program Block from the ARCS PROM.
I have the following types:
type T_SPB is
record
SPBSignature : ULONG; -- Must be SPBSIGNATURE.
SPBLength : ULONG;
Version : USHORT;
Revision : USHORT;
RestartBlock : T_RESTARTBLOCK_PTR;
DebugBlock : VOID_PTR;
GEVector : VOID_PTR;
UTLBMissVector : VOID_PTR;
FirmwareVectorLength : ULONG;
FirmwareVector : T_FIRMWAREVECTOR_PTR;
PrivateVectorLength : ULONG;
PrivateVector : VOID_PTR;
AdapterCount : ULONG;
Adapters : aliased T_ADAPTERS;
end record;
type T_SPB_PTR is access T_SPB;
SP_Block : T_SPB;
for SP_Block'Address use To_Address(16#80001000#); -- 0x80001000
Inside a procedure I have tested the address:
package body ARCS_Prom is
procedure PutChar(C : CHAR) is
Count : aliased ULONG;
OutputChar : CHAR := c;
Output : LONG_PTR;
begin
-- if SP_Block'Address = To_Address(16#80001000#) then
if SP_Block'Address = To_Address(0) then
Output := SP_Block.FirmwareVector.ArcWrite(1, OutputChar'Address, 1, Count'Access);
end if;
end PutChar;
end ARCS_Prom;
Now, if I execute the PutChar procedure the program crashes (because of
the null pointer).
Here's the code for the ArcWrite function as well:
--typedef LONG (*_ArcWrite)(ULONG FileID, VOID *Buffer, ULONG N, ULONG *Count);
type Arc_Write is access function(FileID : ULONG; Buffer : System.Address; N : ULONG; Count : access ULONG) return LONG_PTR;
pragma Convention(C, Arc_Write);
Anyway, I think i've got everything else working ok, just not the
SP_Block'Address. Can anyone help?
FYI: I have no startup code, just a simple "main" procedure called start
in which I call PutChar(65); the program is linked at the correct address
for the O2.
Thanks,
Luke.
next reply other threads:[~2003-12-31 12:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-31 12:29 Luke A. Guest [this message]
2003-12-31 13:53 ` Address representation clause is getting 0 Luke A. Guest
2003-12-31 21:48 ` Randy Brukardt
2003-12-31 23:03 ` Luke A. Guest
2004-01-01 17:24 ` Luke A. Guest
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox