static void set_reg()

in kernel/ptrace.c [467:506]


static void set_reg(struct pt_regs *regs, int num, unsigned long val)
{
	switch (num) {
	case RI(gr[0]): /*
			 * PSW is in gr[0].
			 * Allow writing to Nullify, Divide-step-correction,
			 * and carry/borrow bits.
			 * BEWARE, if you set N, and then single step, it won't
			 * stop on the nullified instruction.
			 */
			val &= USER_PSW_BITS;
			regs->gr[0] &= ~USER_PSW_BITS;
			regs->gr[0] |= val;
			return;
	case RI(gr[1]) ... RI(gr[31]):
			regs->gr[num - RI(gr[0])] = val;
			return;
	case RI(iaoq[0]):
	case RI(iaoq[1]):
			/* set 2 lowest bits to ensure userspace privilege: */
			regs->iaoq[num - RI(iaoq[0])] = val | 3;
			return;
	case RI(sar):	regs->sar = val;
			return;
	default:	return;
#if 0
	/* do not allow to change any of the following registers (yet) */
	case RI(sr[0]) ... RI(sr[7]):	return regs->sr[num - RI(sr[0])];
	case RI(iasq[0]):		return regs->iasq[0];
	case RI(iasq[1]):		return regs->iasq[1];
	case RI(iir):			return regs->iir;
	case RI(isr):			return regs->isr;
	case RI(ior):			return regs->ior;
	case RI(ipsw):			return regs->ipsw;
	case RI(cr27):			return regs->cr27;
        case cr0, cr24, cr25, cr26, cr27, cr28, cr29, cr30, cr31;
        case cr8, cr9, cr12, cr13, cr10, cr15;
#endif
	}
}