/* Write contents of register REGNO in task TASK.  */
static int put_reg(struct task_struct *task, int regno, unsigned long data)
/* Write contents of register REGNO in task TASK.  */
static int put_reg(struct task_struct *task, int regno, unsigned long data)
{
	unsigned long *addr;
	if (regno == PT_USP)
		addr = &task->thread.usp;
	else if (regno < ARRAY_SIZE(regoff))
		addr = (unsigned long *)(task->thread.esp0 + regoff[regno]);
	else
		return -1;
	if (regno == PT_SR || regno == PT_PC) {
		long stkadj = *(long *)(task->thread.esp0 + PT_REG(stkadj));
		addr = (unsigned long *) ((unsigned long)addr + stkadj);
		if (regno == PT_SR) {
			*(unsigned short *)addr = data;
			return 0;
		}
	}
	*addr = data;
	return 0;
}