Skip to content

Commit 0d3109a

Browse files
Brian GerstIngo Molnar
authored andcommitted
x86/entry/32: Convert do_fast_syscall_32() to bool return type
Doesn't have to be 'long' - this simplifies the code a bit. Signed-off-by: Brian Gerst <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent eec62f6 commit 0d3109a

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

arch/x86/entry/common.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs)
193193
return true;
194194
}
195195

196-
/* Returns 0 to return using IRET or 1 to return using SYSEXIT/SYSRETL. */
197-
__visible noinstr long do_fast_syscall_32(struct pt_regs *regs)
196+
/* Returns true to return using SYSEXIT/SYSRETL, or false to use IRET */
197+
__visible noinstr bool do_fast_syscall_32(struct pt_regs *regs)
198198
{
199199
/*
200200
* Called using the internal vDSO SYSENTER/SYSCALL32 calling
@@ -212,7 +212,7 @@ __visible noinstr long do_fast_syscall_32(struct pt_regs *regs)
212212

213213
/* Invoke the syscall. If it failed, keep it simple: use IRET. */
214214
if (!__do_fast_syscall_32(regs))
215-
return 0;
215+
return false;
216216

217217
#ifdef CONFIG_X86_64
218218
/*
@@ -245,8 +245,8 @@ __visible noinstr long do_fast_syscall_32(struct pt_regs *regs)
245245
#endif
246246
}
247247

248-
/* Returns 0 to return using IRET or 1 to return using SYSEXIT/SYSRETL. */
249-
__visible noinstr long do_SYSENTER_32(struct pt_regs *regs)
248+
/* Returns true to return using SYSEXIT/SYSRETL, or false to use IRET */
249+
__visible noinstr bool do_SYSENTER_32(struct pt_regs *regs)
250250
{
251251
/* SYSENTER loses RSP, but the vDSO saved it in RBP. */
252252
regs->sp = regs->bp;

arch/x86/entry/entry_32.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ SYM_FUNC_START(entry_SYSENTER_32)
837837

838838
movl %esp, %eax
839839
call do_SYSENTER_32
840-
testl %eax, %eax
840+
testb %al, %al
841841
jz .Lsyscall_32_done
842842

843843
STACKLEAK_ERASE

arch/x86/entry/entry_64_compat.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ SYM_INNER_LABEL(entry_SYSCALL_compat_after_hwframe, SYM_L_GLOBAL)
212212

213213
sysret32_from_system_call:
214214
/* XEN PV guests always use IRET path */
215-
ALTERNATIVE "testl %eax, %eax; jz swapgs_restore_regs_and_return_to_usermode", \
215+
ALTERNATIVE "testb %al, %al; jz swapgs_restore_regs_and_return_to_usermode", \
216216
"jmp swapgs_restore_regs_and_return_to_usermode", X86_FEATURE_XENPV
217217

218218
/*

arch/x86/include/asm/syscall.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void do_syscall_64(struct pt_regs *regs, int nr);
131131
#endif /* CONFIG_X86_32 */
132132

133133
void do_int80_syscall_32(struct pt_regs *regs);
134-
long do_fast_syscall_32(struct pt_regs *regs);
135-
long do_SYSENTER_32(struct pt_regs *regs);
134+
bool do_fast_syscall_32(struct pt_regs *regs);
135+
bool do_SYSENTER_32(struct pt_regs *regs);
136136

137137
#endif /* _ASM_X86_SYSCALL_H */

0 commit comments

Comments
 (0)