From: Vincent Hanquez <tab@snarc.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
lkml <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>
Subject: [PATCH][RESENT] remove hardcoded offsets from ppc asm
Date: Sat, 7 Aug 2004 17:18:38 +0200 [thread overview]
Message-ID: <20040807151838.GA6760@snarc.org> (raw)
Hi LKML,
This patch removes hardcoded offsets from ppc asm.
It generate offsets for thread_info structure instead of hardcoding them.
Please apply or comments,
Signed-off-by: Vincent Hanquez <tab@snarc.org>
diff -Naur linux-2.6.8-rc3.orig/arch/ppc/kernel/asm-offsets.c linux-2.6.8-rc3/arch/ppc/kernel/asm-offsets.c
--- linux-2.6.8-rc3.orig/arch/ppc/kernel/asm-offsets.c 2004-08-07 16:19:55.000000000 +0200
+++ linux-2.6.8-rc3/arch/ppc/kernel/asm-offsets.c 2004-08-07 16:26:06.000000000 +0200
@@ -129,6 +129,13 @@
DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
+ DEFINE(TI_task, offsetof(struct thread_info, task));
+ DEFINE(TI_exec_domain, 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_count, offsetof(struct thread_info, preempt_count));
+
DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28);
return 0;
}
diff -Naur linux-2.6.8-rc3.orig/arch/ppc/kernel/entry.S linux-2.6.8-rc3/arch/ppc/kernel/entry.S
--- linux-2.6.8-rc3.orig/arch/ppc/kernel/entry.S 2004-08-07 16:19:55.000000000 +0200
+++ linux-2.6.8-rc3/arch/ppc/kernel/entry.S 2004-08-07 16:26:06.000000000 +0200
@@ -199,10 +199,10 @@
bl do_show_syscall
#endif /* SHOW_SYSCALLS */
rlwinm r10,r1,0,0,18 /* current_thread_info() */
- lwz r11,TI_LOCAL_FLAGS(r10)
+ lwz r11,TI_local_flags(r10)
rlwinm r11,r11,0,~_TIFL_FORCE_NOERROR
- stw r11,TI_LOCAL_FLAGS(r10)
- lwz r11,TI_FLAGS(r10)
+ stw r11,TI_local_flags(r10)
+ lwz r11,TI_flags(r10)
andi. r11,r11,_TIF_SYSCALL_TRACE
bne- syscall_dotrace
syscall_dotrace_cont:
@@ -225,7 +225,7 @@
cmpl 0,r3,r11
rlwinm r12,r1,0,0,18 /* current_thread_info() */
blt+ 30f
- lwz r11,TI_LOCAL_FLAGS(r12)
+ lwz r11,TI_local_flags(r12)
andi. r11,r11,_TIFL_FORCE_NOERROR
bne 30f
neg r3,r3
@@ -237,7 +237,7 @@
30: LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
SYNC
MTMSRD(r10)
- lwz r9,TI_FLAGS(r12)
+ lwz r9,TI_flags(r12)
andi. r0,r9,(_TIF_SYSCALL_TRACE|_TIF_SIGPENDING|_TIF_NEED_RESCHED)
bne- syscall_exit_work
syscall_exit_cont:
@@ -311,7 +311,7 @@
SYNC
MTMSRD(r10) /* disable interrupts again */
rlwinm r12,r1,0,0,18 /* current_thread_info() */
- lwz r9,TI_FLAGS(r12)
+ lwz r9,TI_flags(r12)
5:
andi. r0,r9,_TIF_NEED_RESCHED
bne 1f
@@ -567,7 +567,7 @@
sigreturn_exit:
subi r1,r3,STACK_FRAME_OVERHEAD
rlwinm r12,r1,0,0,18 /* current_thread_info() */
- lwz r9,TI_FLAGS(r12)
+ lwz r9,TI_flags(r12)
andi. r0,r9,_TIF_SYSCALL_TRACE
bnel- do_syscall_trace
/* fall through */
@@ -593,7 +593,7 @@
user_exc_return: /* r10 contains MSR_KERNEL here */
/* Check current_thread_info()->flags */
rlwinm r9,r1,0,0,18
- lwz r9,TI_FLAGS(r9)
+ lwz r9,TI_flags(r9)
andi. r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED)
bne do_work
@@ -612,16 +612,16 @@
resume_kernel:
/* check current_thread_info->preempt_count */
rlwinm r9,r1,0,0,18
- lwz r0,TI_PREEMPT(r9)
+ lwz r0,TI_preempt_count(r9)
cmpwi 0,r0,0 /* if non-zero, just restore regs and return */
bne restore
- lwz r0,TI_FLAGS(r9)
+ lwz r0,TI_flags(r9)
andi. r0,r0,_TIF_NEED_RESCHED
beq+ restore
andi. r0,r3,MSR_EE /* interrupts off? */
beq restore /* don't schedule if so */
1: lis r0,PREEMPT_ACTIVE@h
- stw r0,TI_PREEMPT(r9)
+ stw r0,TI_preempt_count(r9)
ori r10,r10,MSR_EE
SYNC
MTMSRD(r10) /* hard-enable interrupts */
@@ -631,8 +631,8 @@
MTMSRD(r10) /* disable interrupts */
rlwinm r9,r1,0,0,18
li r0,0
- stw r0,TI_PREEMPT(r9)
- lwz r3,TI_FLAGS(r9)
+ stw r0,TI_preempt_count(r9)
+ lwz r3,TI_flags(r9)
andi. r0,r3,_TIF_NEED_RESCHED
bne- 1b
#else
@@ -913,7 +913,7 @@
SYNC
MTMSRD(r10) /* disable interrupts */
rlwinm r9,r1,0,0,18
- lwz r9,TI_FLAGS(r9)
+ lwz r9,TI_flags(r9)
andi. r0,r9,_TIF_NEED_RESCHED
bne- do_resched
andi. r0,r9,_TIF_SIGPENDING
diff -Naur linux-2.6.8-rc3.orig/arch/ppc/kernel/head.S linux-2.6.8-rc3/arch/ppc/kernel/head.S
--- linux-2.6.8-rc3.orig/arch/ppc/kernel/head.S 2004-08-07 16:19:55.000000000 +0200
+++ linux-2.6.8-rc3/arch/ppc/kernel/head.S 2004-08-07 16:26:06.000000000 +0200
@@ -1240,7 +1240,7 @@
tophys(r1,r1)
lwz r1,secondary_ti@l(r1)
tophys(r2,r1)
- lwz r2,TI_TASK(r2)
+ lwz r2,TI_task(r2)
/* stack */
addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
diff -Naur linux-2.6.8-rc3.orig/arch/ppc/kernel/idle_6xx.S linux-2.6.8-rc3/arch/ppc/kernel/idle_6xx.S
--- linux-2.6.8-rc3.orig/arch/ppc/kernel/idle_6xx.S 2004-08-07 16:19:55.000000000 +0200
+++ linux-2.6.8-rc3/arch/ppc/kernel/idle_6xx.S 2004-08-07 16:26:06.000000000 +0200
@@ -94,7 +94,7 @@
/* Check current_thread_info()->flags */
rlwinm r4,r1,0,0,18
- lwz r4,TI_FLAGS(r4)
+ lwz r4,TI_flags(r4)
andi. r0,r4,_TIF_NEED_RESCHED
beq 1f
mtmsr r7 /* out of line this ? */
@@ -191,7 +191,7 @@
rlwinm r9,r1,0,0,18
tophys(r9,r9)
- lwz r11,TI_CPU(r9)
+ lwz r11,TI_cpu(r9)
slwi r11,r11,2
/* Todo make sure all these are in the same page
* and load r22 (@ha part + CPU offset) only once
diff -Naur linux-2.6.8-rc3.orig/arch/ppc/kernel/idle_power4.S linux-2.6.8-rc3/arch/ppc/kernel/idle_power4.S
--- linux-2.6.8-rc3.orig/arch/ppc/kernel/idle_power4.S 2004-08-07 16:19:55.000000000 +0200
+++ linux-2.6.8-rc3/arch/ppc/kernel/idle_power4.S 2004-08-07 16:26:06.000000000 +0200
@@ -66,7 +66,7 @@
/* Check current_thread_info()->flags */
rlwinm r4,r1,0,0,18
- lwz r4,TI_FLAGS(r4)
+ lwz r4,TI_flags(r4)
andi. r0,r4,_TIF_NEED_RESCHED
beq 1f
mtmsr r7 /* out of line this ? */
diff -Naur linux-2.6.8-rc3.orig/arch/ppc/kernel/misc.S linux-2.6.8-rc3/arch/ppc/kernel/misc.S
--- linux-2.6.8-rc3.orig/arch/ppc/kernel/misc.S 2004-08-07 16:19:55.000000000 +0200
+++ linux-2.6.8-rc3/arch/ppc/kernel/misc.S 2004-08-07 16:26:06.000000000 +0200
@@ -233,7 +233,7 @@
/* Store new HID1 image */
rlwinm r6,r1,0,0,18
- lwz r6,TI_CPU(r6)
+ lwz r6,TI_cpu(r6)
slwi r6,r6,2
addis r6,r6,nap_save_hid1@ha
stw r4,nap_save_hid1@l(r6)
@@ -457,7 +457,7 @@
#else /* !(CONFIG_40x || CONFIG_44x || CONFIG_FSL_BOOKE) */
#if defined(CONFIG_SMP)
rlwinm r8,r1,0,0,18
- lwz r8,TI_CPU(r8)
+ lwz r8,TI_cpu(r8)
oris r8,r8,10
mfmsr r10
SYNC
@@ -538,7 +538,7 @@
#else /* !(CONFIG_40x || CONFIG_44x || CONFIG_FSL_BOOKE) */
#if defined(CONFIG_SMP)
rlwinm r8,r1,0,0,18
- lwz r8,TI_CPU(r8)
+ lwz r8,TI_cpu(r8)
oris r8,r8,11
mfmsr r10
SYNC
diff -Naur linux-2.6.8-rc3.orig/include/asm-ppc/thread_info.h linux-2.6.8-rc3/include/asm-ppc/thread_info.h
--- linux-2.6.8-rc3.orig/include/asm-ppc/thread_info.h 2004-08-07 16:20:00.000000000 +0200
+++ linux-2.6.8-rc3/include/asm-ppc/thread_info.h 2004-08-07 16:26:06.000000000 +0200
@@ -65,16 +65,6 @@
*/
#define THREAD_SIZE 8192 /* 2 pages */
-/*
- * Offsets in thread_info structure, used in assembly code
- */
-#define TI_TASK 0
-#define TI_EXECDOMAIN 4
-#define TI_FLAGS 8
-#define TI_LOCAL_FLAGS 12
-#define TI_CPU 16
-#define TI_PREEMPT 20
-
#define PREEMPT_ACTIVE 0x4000000
/*
next reply other threads:[~2004-08-07 15:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-07 15:18 Vincent Hanquez [this message]
2004-08-07 23:32 ` [PATCH][RESENT] remove hardcoded offsets from ppc asm Benjamin Herrenschmidt
2004-08-08 10:25 ` Vincent Hanquez
2004-08-08 10:25 ` Benjamin Herrenschmidt
2004-08-08 10:52 ` Vincent Hanquez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040807151838.GA6760@snarc.org \
--to=tab@snarc.org \
--cc=akpm@osdl.org \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.