Skip to content

Commit

Permalink
csky: Fixup remove unnecessary save/restore PSR code
Browse files Browse the repository at this point in the history
All processes' PSR could success from SETUP_MMU, so need set it
in INIT_THREAD again.

And use a3 instead of r7 in __switch_to for code convention.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
  • Loading branch information
guoren83 committed May 13, 2020
1 parent 6633a5a commit 9e2ca15
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
2 changes: 0 additions & 2 deletions arch/csky/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ extern struct cpuinfo_csky cpu_data[];

struct thread_struct {
unsigned long ksp; /* kernel stack pointer */
unsigned long sr; /* saved status register */
unsigned long trap_no; /* saved status register */

/* FPU regs */
Expand All @@ -51,7 +50,6 @@ struct thread_struct {

#define INIT_THREAD { \
.ksp = sizeof(init_stack) + (unsigned long) &init_stack, \
.sr = DEFAULT_PSR_VALUE, \
}

/*
Expand Down
1 change: 0 additions & 1 deletion arch/csky/kernel/asm-offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ int main(void)

/* offsets into the thread struct */
DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
DEFINE(THREAD_SR, offsetof(struct thread_struct, sr));
DEFINE(THREAD_FESR, offsetof(struct thread_struct, user_fp.fesr));
DEFINE(THREAD_FCR, offsetof(struct thread_struct, user_fp.fcr));
DEFINE(THREAD_FPREG, offsetof(struct thread_struct, user_fp.vr));
Expand Down
10 changes: 2 additions & 8 deletions arch/csky/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,6 @@ ENTRY(__switch_to)
lrw a3, TASK_THREAD
addu a3, a0

mfcr a2, psr /* Save PSR value */
stw a2, (a3, THREAD_SR) /* Save PSR in task struct */

SAVE_SWITCH_STACK

stw sp, (a3, THREAD_KSP)
Expand All @@ -343,12 +340,9 @@ ENTRY(__switch_to)

ldw sp, (a3, THREAD_KSP) /* Set next kernel sp */

ldw a2, (a3, THREAD_SR) /* Set next PSR */
mtcr a2, psr

#if defined(__CSKYABIV2__)
addi r7, a1, TASK_THREAD_INFO
ldw tls, (r7, TINFO_TP_VALUE)
addi a3, a1, TASK_THREAD_INFO
ldw tls, (a3, TINFO_TP_VALUE)
#endif

RESTORE_SWITCH_STACK
Expand Down

0 comments on commit 9e2ca15

Please sign in to comment.