Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 11620
b: refs/heads/master
c: 6cb7bfe
h: refs/heads/master
v: v3
  • Loading branch information
David Gibson authored and Paul Mackerras committed Oct 21, 2005
1 parent 9deed36 commit b504070
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 147 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b0faa28493f97b55b36ff5b1a2b8c81bf253a460
refs/heads/master: 6cb7bfebb145af5ea1d052512a2ae7ff07a47202
6 changes: 1 addition & 5 deletions trunk/arch/powerpc/kernel/asm-offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ int main(void)
DEFINE(THREAD, offsetof(struct task_struct, thread));
DEFINE(MM, offsetof(struct task_struct, mm));
#ifdef CONFIG_PPC64
DEFINE(THREAD_SHIFT, THREAD_SHIFT);
DEFINE(THREAD_SIZE, THREAD_SIZE);
DEFINE(AUDITCONTEXT, offsetof(struct task_struct, audit_context));
#else
DEFINE(THREAD_INFO, offsetof(struct task_struct, thread_info));
Expand Down Expand Up @@ -94,12 +92,10 @@ int main(void)

DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
#ifdef CONFIG_PPC64
DEFINE(TI_SC_NOERR, offsetof(struct thread_info, syscall_noerror));
#else
#ifdef CONFIG_PPC32
DEFINE(TI_TASK, offsetof(struct thread_info, task));
DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, local_flags));
DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
#endif /* CONFIG_PPC64 */

Expand Down
25 changes: 12 additions & 13 deletions trunk/arch/powerpc/kernel/entry_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,9 @@ _GLOBAL(DoSyscall)
#ifdef SHOW_SYSCALLS
bl do_show_syscall
#endif /* SHOW_SYSCALLS */
rlwinm r10,r1,0,0,18 /* current_thread_info() */
lwz r11,TI_LOCAL_FLAGS(r10)
rlwinm r11,r11,0,~_TIFL_FORCE_NOERROR
stw r11,TI_LOCAL_FLAGS(r10)
rlwinm r10,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
li r11,0
stb r11,TI_SC_NOERR(r10)
lwz r11,TI_FLAGS(r10)
andi. r11,r11,_TIF_SYSCALL_T_OR_A
bne- syscall_dotrace
Expand All @@ -225,10 +224,10 @@ ret_from_syscall:
mr r6,r3
li r11,-_LAST_ERRNO
cmplw 0,r3,r11
rlwinm r12,r1,0,0,18 /* current_thread_info() */
rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
blt+ 30f
lwz r11,TI_LOCAL_FLAGS(r12)
andi. r11,r11,_TIFL_FORCE_NOERROR
lbz r11,TI_SC_NOERR(r12)
cmpwi r11,0
bne 30f
neg r3,r3
lwz r10,_CCR(r1) /* Set SO bit in CR */
Expand Down Expand Up @@ -315,7 +314,7 @@ syscall_exit_work:
LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
SYNC
MTMSRD(r10) /* disable interrupts again */
rlwinm r12,r1,0,0,18 /* current_thread_info() */
rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
lwz r9,TI_FLAGS(r12)
5:
andi. r0,r9,_TIF_NEED_RESCHED
Expand Down Expand Up @@ -630,7 +629,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_601)
.globl sigreturn_exit
sigreturn_exit:
subi r1,r3,STACK_FRAME_OVERHEAD
rlwinm r12,r1,0,0,18 /* current_thread_info() */
rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
lwz r9,TI_FLAGS(r12)
andi. r0,r9,_TIF_SYSCALL_T_OR_A
beq+ ret_from_except_full
Expand All @@ -657,7 +656,7 @@ ret_from_except:

user_exc_return: /* r10 contains MSR_KERNEL here */
/* Check current_thread_info()->flags */
rlwinm r9,r1,0,0,18
rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
lwz r9,TI_FLAGS(r9)
andi. r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED)
bne do_work
Expand All @@ -677,7 +676,7 @@ restore_user:
/* N.B. the only way to get here is from the beq following ret_from_except. */
resume_kernel:
/* check current_thread_info->preempt_count */
rlwinm r9,r1,0,0,18
rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
lwz r0,TI_PREEMPT(r9)
cmpwi 0,r0,0 /* if non-zero, just restore regs and return */
bne restore
Expand All @@ -687,7 +686,7 @@ resume_kernel:
andi. r0,r3,MSR_EE /* interrupts off? */
beq restore /* don't schedule if so */
1: bl preempt_schedule_irq
rlwinm r9,r1,0,0,18
rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
lwz r3,TI_FLAGS(r9)
andi. r0,r3,_TIF_NEED_RESCHED
bne- 1b
Expand Down Expand Up @@ -889,7 +888,7 @@ recheck:
LOAD_MSR_KERNEL(r10,MSR_KERNEL)
SYNC
MTMSRD(r10) /* disable interrupts */
rlwinm r9,r1,0,0,18
rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
lwz r9,TI_FLAGS(r9)
andi. r0,r9,_TIF_NEED_RESCHED
bne- do_resched
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/powerpc/kernel/head_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <asm/setup.h>
#include <asm/hvcall.h>
#include <asm/iSeries/LparMap.h>
#include <asm/thread_info.h>

#ifdef CONFIG_PPC_ISERIES
#define DO_SOFT_DISABLE
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/powerpc/kernel/misc_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <asm/ppc_asm.h>
#include <asm/asm-offsets.h>
#include <asm/cputable.h>
#include <asm/thread_info.h>

.text

Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/ppc/kernel/asm-offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ main(void)
DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));

DEFINE(TI_SC_NOERR, offsetof(struct thread_info, syscall_noerror));
DEFINE(TI_TASK, offsetof(struct thread_info, task));
DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, local_flags));
DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));

Expand Down
9 changes: 4 additions & 5 deletions trunk/arch/ppc/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,8 @@ _GLOBAL(DoSyscall)
bl do_show_syscall
#endif /* SHOW_SYSCALLS */
rlwinm r10,r1,0,0,18 /* current_thread_info() */
lwz r11,TI_LOCAL_FLAGS(r10)
rlwinm r11,r11,0,~_TIFL_FORCE_NOERROR
stw r11,TI_LOCAL_FLAGS(r10)
li r11,0
stb r11,TI_SC_NOERR(r10)
lwz r11,TI_FLAGS(r10)
andi. r11,r11,_TIF_SYSCALL_T_OR_A
bne- syscall_dotrace
Expand All @@ -227,8 +226,8 @@ ret_from_syscall:
cmplw 0,r3,r11
rlwinm r12,r1,0,0,18 /* current_thread_info() */
blt+ 30f
lwz r11,TI_LOCAL_FLAGS(r12)
andi. r11,r11,_TIFL_FORCE_NOERROR
lbz r11,TI_SC_NOERR(r12)
cmpwi r11,0
bne 30f
neg r3,r3
lwz r10,_CCR(r1) /* Set SO bit in CR */
Expand Down
2 changes: 0 additions & 2 deletions trunk/arch/ppc64/kernel/asm-offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
int main(void)
{
/* thread struct on stack */
DEFINE(THREAD_SHIFT, THREAD_SHIFT);
DEFINE(THREAD_SIZE, THREAD_SIZE);
DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
DEFINE(TI_SC_NOERR, offsetof(struct thread_info, syscall_noerror));
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/ppc64/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <asm/setup.h>
#include <asm/hvcall.h>
#include <asm/iSeries/LparMap.h>
#include <asm/thread_info.h>

#ifdef CONFIG_PPC_ISERIES
#define DO_SOFT_DISABLE
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/ppc64/kernel/misc.S
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <asm/ppc_asm.h>
#include <asm/asm-offsets.h>
#include <asm/cputable.h>
#include <asm/thread_info.h>

.text

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
/* thread_info.h: PPC low-level thread information
/* thread_info.h: PowerPC low-level thread information
* adapted from the i386 version by Paul Mackerras
*
* Copyright (C) 2002 David Howells (dhowells@redhat.com)
* - Incorporating suggestions made by Linus Torvalds and Dave Miller
*/

#ifndef _ASM_THREAD_INFO_H
#define _ASM_THREAD_INFO_H
#ifndef _ASM_POWERPC_THREAD_INFO_H
#define _ASM_POWERPC_THREAD_INFO_H

#ifdef __KERNEL__

/* We have 8k stacks on ppc32 and 16k on ppc64 */

#ifdef CONFIG_PPC64
#define THREAD_SHIFT 14
#else
#define THREAD_SHIFT 13
#endif

#define THREAD_SIZE (1 << THREAD_SHIFT)

#ifndef __ASSEMBLY__
#include <linux/config.h>
#include <linux/cache.h>
Expand All @@ -24,7 +34,8 @@ struct thread_info {
struct task_struct *task; /* main task structure */
struct exec_domain *exec_domain; /* execution domain */
int cpu; /* cpu we're on */
int preempt_count; /* 0 => preemptable, <0 => BUG */
int preempt_count; /* 0 => preemptable,
<0 => BUG */
struct restart_block restart_block;
/* set by force_successful_syscall_return */
unsigned char syscall_noerror;
Expand Down Expand Up @@ -54,9 +65,6 @@ struct thread_info {

/* thread information allocation */

#define THREAD_SHIFT 14
#define THREAD_ORDER (THREAD_SHIFT - PAGE_SHIFT)
#define THREAD_SIZE (1 << THREAD_SHIFT)
#ifdef CONFIG_DEBUG_STACK_USAGE
#define alloc_thread_info(tsk) \
({ \
Expand All @@ -68,7 +76,7 @@ struct thread_info {
ret; \
})
#else
#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
#endif
#define free_thread_info(ti) kfree(ti)
#define get_thread_info(ti) get_task_struct((ti)->task)
Expand All @@ -77,9 +85,11 @@ struct thread_info {
/* how to get the thread information struct from C */
static inline struct thread_info *current_thread_info(void)
{
struct thread_info *ti;
__asm__("clrrdi %0,1,%1" : "=r"(ti) : "i" (THREAD_SHIFT));
return ti;
register unsigned long sp asm("r1");

/* gcc4, at least, is smart enough to turn this into a single
* rlwinm for ppc32 and clrrdi for ppc64 */
return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
}

#endif /* __ASSEMBLY__ */
Expand Down Expand Up @@ -122,4 +132,4 @@ static inline struct thread_info *current_thread_info(void)

#endif /* __KERNEL__ */

#endif /* _ASM_THREAD_INFO_H */
#endif /* _ASM_POWERPC_THREAD_INFO_H */
2 changes: 1 addition & 1 deletion trunk/include/asm-ppc/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extern unsigned long profile_pc(struct pt_regs *regs);

#define force_successful_syscall_return() \
do { \
current_thread_info()->local_flags |= _TIFL_FORCE_NOERROR; \
current_thread_info()->syscall_noerror = 1; \
} while(0)

/*
Expand Down
107 changes: 0 additions & 107 deletions trunk/include/asm-ppc/thread_info.h

This file was deleted.

0 comments on commit b504070

Please sign in to comment.