Skip to content

Commit 16d7c69

Browse files
leitaompe
authored andcommitted
powerpc: Redefine TIF_32BITS thread flag
Moving TIF_32BIT to use bit 20 instead of 4 in the task flag field. This change is making room for an upcoming new task macro (_TIF_SYSCALL_EMU) which is preferred to set a bit in the lower 16-bits part of the word. This upcoming flag macro will take part in a composed macro (_TIF_SYSCALL_DOTRACE) which will contain other flags as well, and it is preferred that the whole _TIF_SYSCALL_DOTRACE macro only sets the lower 16 bits of a word, so, it could be handled using immediate operations (as load immediate, add immediate, ...) where the immediate operand (SI) is limited to 16-bits. Another possible solution would be using the LOAD_REG_IMMEDIATE() macro to load a full 64-bits word immediate, but it takes 5 operations instead of one. Having TIF_32BITS being redefined to use an upper bit is not a problem since there is only one place in the assembly code where TIF_32BIT is being used, and it could be replaced with an operation with right shift (addis), since it is used alone, i.e. not being part of a composed macro, which has different bits set, and would require LOAD_REG_IMMEDIATE(). Tested on a 64 bits Big Endian machine running a 32 bits task. Signed-off-by: Breno Leitao <leitao@debian.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 06ec27a commit 16d7c69

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/powerpc/include/asm/thread_info.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src
8181
#define TIF_SIGPENDING 1 /* signal pending */
8282
#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
8383
#define TIF_FSCHECK 3 /* Check FS is USER_DS on return */
84-
#define TIF_32BIT 4 /* 32 bit binary */
8584
#define TIF_RESTORE_TM 5 /* need to restore TM FP/VEC/VSX */
8685
#define TIF_PATCH_PENDING 6 /* pending live patching update */
8786
#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
@@ -100,6 +99,7 @@ extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src
10099
#define TIF_ELF2ABI 18 /* function descriptors must die! */
101100
#endif
102101
#define TIF_POLLING_NRFLAG 19 /* true if poll_idle() is polling TIF_NEED_RESCHED */
102+
#define TIF_32BIT 20 /* 32 bit binary */
103103

104104
/* as above, but as bit values */
105105
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)

arch/powerpc/kernel/entry_64.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ system_call: /* label this so stack traces look sane */
171171
* based on caller's run-mode / personality.
172172
*/
173173
ld r11,SYS_CALL_TABLE@toc(2)
174-
andi. r10,r10,_TIF_32BIT
174+
andis. r10,r10,_TIF_32BIT@h
175175
beq 15f
176176
addi r11,r11,8 /* use 32-bit syscall entries */
177177
clrldi r3,r3,32

0 commit comments

Comments
 (0)