Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 789154c2 authored by Guo Ren's avatar Guo Ren
Browse files

csky: fixup save hi,lo,dspcr regs in switch_stack.



HI, LO, DSPCR registers are 807/810 related regs and no need for 610/860.
All of the regs must be saved in pt_regs and switch_stack. This patch
fixup saving dspcr reg in switch_stack and pt_regs.

Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
parent 31295a72
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.

#ifndef __ABI_CSKY_PTRACE_H
#define __ABI_CSKY_PTRACE_H

struct switch_stack {
	unsigned long r8;
	unsigned long r9;
	unsigned long r10;
	unsigned long r11;
	unsigned long r12;
	unsigned long r13;
	unsigned long r14;
	unsigned long r15;
};
#endif /* __ABI_CSKY_PTRACE_H */
+25 −3
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@
	stw	lr, (sp, 60)
	mflo	lr
	stw	lr, (sp, 64)
	mfcr	lr, cr14
	stw	lr, (sp, 68)
#endif
	subi	sp, 80
.endm
@@ -77,6 +79,8 @@
	mthi	a0
	ldw	a0, (sp, 144)
	mtlo	a0
	ldw	a0, (sp, 148)
	mtcr	a0, cr14
#endif

	ldw     a0, (sp, 24)
@@ -95,7 +99,7 @@
.macro SAVE_SWITCH_STACK
	subi    sp, 64
	stm	r4-r11, (sp)
	stw	r15, (sp, 32)
	stw	lr,  (sp, 32)
	stw	r16, (sp, 36)
	stw	r17, (sp, 40)
	stw	r26, (sp, 44)
@@ -103,11 +107,29 @@
	stw	r28, (sp, 52)
	stw	r29, (sp, 56)
	stw	r30, (sp, 60)
#ifdef CONFIG_CPU_HAS_HILO
	subi	sp, 16
	mfhi	lr
	stw	lr, (sp, 0)
	mflo	lr
	stw	lr, (sp, 4)
	mfcr	lr, cr14
	stw	lr, (sp, 8)
#endif
.endm

.macro RESTORE_SWITCH_STACK
#ifdef CONFIG_CPU_HAS_HILO
	ldw	lr, (sp, 0)
	mthi	lr
	ldw	lr, (sp, 4)
	mtlo	lr
	ldw	lr, (sp, 8)
	mtcr	lr, cr14
	addi	sp, 16
#endif
	ldm	r4-r11, (sp)
	ldw	r15, (sp, 32)
	ldw	lr,  (sp, 32)
	ldw	r16, (sp, 36)
	ldw	r17, (sp, 40)
	ldw	r26, (sp, 44)
+32 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.

#ifndef __ABI_CSKY_PTRACE_H
#define __ABI_CSKY_PTRACE_H

struct switch_stack {
#ifdef CONFIG_CPU_HAS_HILO
	unsigned long rhi;
	unsigned long rlo;
	unsigned long cr14;
	unsigned long pad;
#endif
	unsigned long r4;
	unsigned long r5;
	unsigned long r6;
	unsigned long r7;
	unsigned long r8;
	unsigned long r9;
	unsigned long r10;
	unsigned long r11;

	unsigned long r15;
	unsigned long r16;
	unsigned long r17;
	unsigned long r26;
	unsigned long r27;
	unsigned long r28;
	unsigned long r29;
	unsigned long r30;
};
#endif /* __ABI_CSKY_PTRACE_H */
+1 −2
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <asm/cache.h>
#include <abi/reg_ops.h>
#include <abi/regdef.h>
#include <abi/switch_context.h>
#ifdef CONFIG_CPU_HAS_FPU
#include <abi/fpu.h>
#endif
@@ -50,8 +51,6 @@ struct thread_struct {
	unsigned long  ksp;       /* kernel stack pointer */
	unsigned long  sr;        /* saved status register */
	unsigned long  esp0;      /* points to SR of stack frame */
	unsigned long  hi;
	unsigned long  lo;

	/* Other stuff associated with the thread. */
	unsigned long address;      /* Last user fault */
+1 −38
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ struct pt_regs {

	unsigned long	rhi;
	unsigned long	rlo;
	unsigned long	pad; /* reserved */
	unsigned long	dcsr;
#endif
};

@@ -48,43 +48,6 @@ struct user_fp {
	unsigned long	reserved;
};

/*
 * Switch stack for switch_to after push pt_regs.
 *
 * ABI_CSKYV2: r4 ~ r11, r15 ~ r17, r26 ~ r30;
 * ABI_CSKYV1: r8 ~ r14, r15;
 */
struct  switch_stack {
#if defined(__CSKYABIV2__)
	unsigned long   r4;
	unsigned long   r5;
	unsigned long   r6;
	unsigned long   r7;
	unsigned long   r8;
	unsigned long   r9;
	unsigned long   r10;
	unsigned long   r11;
#else
	unsigned long   r8;
	unsigned long   r9;
	unsigned long   r10;
	unsigned long   r11;
	unsigned long   r12;
	unsigned long   r13;
	unsigned long   r14;
#endif
	unsigned long   r15;
#if defined(__CSKYABIV2__)
	unsigned long   r16;
	unsigned long   r17;
	unsigned long   r26;
	unsigned long   r27;
	unsigned long   r28;
	unsigned long   r29;
	unsigned long   r30;
#endif
};

#ifdef __KERNEL__

#define PS_S	0x80000000 /* Supervisor Mode */
Loading