comp.lang.ada
 help / color / mirror / Atom feed
* Address representation clause is getting 0
@ 2003-12-31 12:29 Luke A. Guest
  2003-12-31 13:53 ` Luke A. Guest
  0 siblings, 1 reply; 5+ messages in thread
From: Luke A. Guest @ 2003-12-31 12:29 UTC (permalink / 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.




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-01-01 17:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-31 12:29 Address representation clause is getting 0 Luke A. Guest
2003-12-31 13:53 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox