Mark writes:
...
> int getccr(void)
> {
> /*
> * Get the coprocessor control register.
> */
GETPRIVMODE (); /* unless caller was already in priv mode */
> return get_control_reg(10) & 0xff;
> }
...
> /*
> * Get the address of the IVA.
> */
You're about to get the address of the "monarch's" IVA (Interrupt Vector
Address) ... there's one IVA per CPU.
> LONGPOINTER lptr = _get_monarch_model();
>
> lptr.offset += 6 * sizeof(int);
>
> asm("ldw %0, %%r31" : : "m" (lptr.offset));
> asm("ldw %0, %%r28" : : "m" (lptr.spaceid));
> asm("mtsp %r28,%sr1");
> asm("ldw 0(%sr1,%r31), %r28");
> }
Note: _get_monarch_model requires the caller to be in priv mode,
and the data area that _get_monarch_model returns a pointer to also
requires priv mode to be able to read the data.
Mark...thanks for the 64-bit pointer example, too!
BTW, the result of the final LDW should be treated as follows:
0 = PA-RISC 1.0
4 = PA-RISC 1.1
I don't currently know any other values, but suspect there must be some :)
--
Stan Sieler [log in to unmask]http://www.allegro.com/sieler.html