From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 14-JUN-1994 16:57:31.55
To:	EVERHART
CC:	
Subj:	Re: COU idle time under ALPHA

Date: Tue, 14 Jun 1994 19:40:26 +0100
From: Arne Vajhoej <ARNE@kopc.hhs.dk>
Subject: Re: COU idle time under ALPHA
To: ARVIDSSONA@ADMINA.RFERL.ORG, INFO-VAX@SRI.COM
Message-id: <01HDJL6J2BCY8ZDVID@kopc.hhs.dk>
X-VMS-To: KOPC::IN%"ARVIDSSONA@ADMINA.RFERL.ORG"
X-VMS-Cc: IN::"INFO-VAX@SRI.COM"
MIME-version: 1.0
Content-type: TEXT/PLAIN; CHARSET=ISO-8859-1
Content-transfer-encoding: 8BIT

> I have a problem with the location of the system idle time on an ALPHA
> 3000/800 running ACP 1.5.  It was before located in the location (macro)
> CPU$L_NULLCPU  and this have changed to CPU$Q_NULLCPU where I assume the
> "Q" stands for quadword.  Does anyone know how to use this on an ALPHA.
> 
> The code I was using on the VAX contained the following
> 
>         ADDL2   CPU$L_NULLCPU(R3),R2
> 
>         where R3 contained the address to the CPU counter.
> 
> When using this code on an ALPHA (with CPU$Q_NULLCPU) I get an access
> voilation.
> 
> 
> Can anyone tell me what changed. DO I need the 64-macro compiler to solve
> this? I do not have documentation and I am not a macro specialist so please
> forgive if the problem above is obvious.

Obvious ? Hm... DEC has changed the protection of that memory location !

Small example on VAX (for single CPU machine):

      INTEGER*4 NULLCPU
      WRITE(*,*) NULLCPU()
      END

        .title  nullcpu
        .link   "sys$system:sys.stb"/selective_search
        .library "sys$library:lib"
        $CPUDEF
        .psect  $CODE quad,pic,con,lcl,shr,exe,nowrt
        .entry  nullcpu,^m<>
        movl    G^SMP$GL_CPU_DATA,r0
        movl    CPU$L_NULLCPU(r0),r0
        ret
        .end

$ FORTRAN TEST
$ MACRO NULLCPU
$ LINK TEST+NULLCPU
$ RUN NULLCPU

The same example on AXP looks like:

      EXTERNAL X
      INTEGER*8 V
      COMMON /BB/V
      CALL SYS$CMEXEC(X,)
      WRITE(*,*) V
      END
C
      INTEGER*4 FUNCTION X
      INTEGER*8 V
      COMMON /BB/V
      INTEGER*8 NULLCPU
      V=NULLCPU()
      X=1
      RETURN
      END

        .title  nullcpu
        .library "sys$library:lib"
        $CPUDEF
        .psect  $CODE quad,pic,con,lcl,shr,exe,nowrt
        .entry  nullcpu,^m<>
        movl    G^SMP$GL_CPU_DATA,r0
        movl    CPU$Q_NULLCPU(r0),r0
        ret
        .end

$ FORTRAN TEST
$ MACRO NULLCPU
$ LINK/SYSEXE TEST+NULLCPU
$ SET PROC/PRIV=CMEXEC
$ RUN NULLCPU

If you do not have CMEXEC priv and still need the same functionality, then
you can get it by using the undocumented EXE$GETSPI, which can get the
same information without privs on both VAX and AXP !

PS: There are a special mailing-list ALPHA-IDS for this kind of problems !
    (ALPHA-IDS@WKUVX1.BITNET)

                                                          Arne

Arne Vajhøj                             local DECNET:  KO::ARNE
Computer Department                     PSI:           PSI%238310013040::ARNE
Business School of Southern Denmark     Internet:      ARNE@KO.HHS.DK