Subject: Re: COMPAT_LINUX for PowerPC: register names
To: David Edelsohn <dje@watson.ibm.com>
From: Emmanuel Dreyfus <p99dreyf@criens.u-psud.fr>
List: port-powerpc
Date: 01/11/2001 18:36:13
>       ccr probably is cr.  link is lr.  msr is machine status register
> which is different than srr0/srr1.  rfi instruction restores the msr from
> srr1, but is not srr1.

And what are srr0 and srr1 used for?

>       "nip" doesn't mean anything to me.  What does "nip" mean on x86?

No nip on x86, it exists only in the powerpc port. Here is some of Linux
code using nip that I have to deal with (LEgally speaking, do I need to
include a GPL copy with my e-mail?)

/*
 * Set up a signal frame.
 */
static void
setup_frame(struct pt_regs *regs, struct sigregs *frame,
       unsigned long newsp)
{
   struct sigcontext_struct *sc =3D (struct sigcontext_struct *) newsp;

   if (verify_area(VERIFY_WRITE, frame, sizeof(*frame)))
      goto badframe;
      if (regs->msr & MSR_FP)
         giveup_fpu(current);
   if (__copy_to_user(&frame->gp_regs, regs, GP_REGS_SIZE)
       || __copy_to_user(&frame->fp_regs, current->thread.fpr,
               ELF_NFPREG * sizeof(double))
       || __put_user(0x38007777UL, &frame->tramp[0])    /* li r0,0x7777
*/
       || __put_user(0x44000002UL, &frame->tramp[1]))   /* sc */
      goto badframe;
   flush_icache_range((unsigned long) &frame->tramp[0],
            (unsigned long) &frame->tramp[2]);

   newsp -=3D __SIGNAL_FRAMESIZE;
   if (put_user(regs->gpr[1], (unsigned long *)newsp)
       || get_user(regs->nip, &sc->handler)
       || get_user(regs->gpr[3], &sc->signal))
      goto badframe;
   regs->gpr[1] =3D newsp;
   regs->gpr[4] =3D (unsigned long) sc;
   regs->link =3D (unsigned long) frame->tramp;

   return;

badframe:
#if DEBUG_SIG
   printk("badframe in setup_frame, regs=3D%p frame=3D%p newsp=3D%lx\n",
          regs, frame, newsp);
#endif
   do_exit(SIGSEGV);
}

About srr0 and srr1... Here is the struct pt_reg Linux uses in various
locations. I wonder where go srr0, srr1, pc, and so on...
struct pt_regs {
   unsigned long gpr[32];
   unsigned long nip;
   unsigned long msr;
   unsigned long orig_gpr3;   /* Used for restarting system calls */
   unsigned long ctr;
   unsigned long link;
   unsigned long xer;
   unsigned long ccr;
   unsigned long mq;    /* 601 only (not used at present) */
               /* Used on APUS to hold IPL value. */
   unsigned long trap;     /* Reason for being here */
   unsigned long dar;      /* Fault registers */
   unsigned long dsisr;
   unsigned long result;      /* Result of a system call */
};


--=20
Emmanuel Dreyfus.
"L'achitecture x86 est impossible =E0 aimer." (John Hennessy)
p99dreyf@criens.u-psud.fr