* Set syscallno to -1 by default (overridden later if real syscall).
         */
        .if     \el == 0
-       mvn     x21, xzr
-       str     x21, [sp, #S_SYSCALLNO]
+       mvn     w21, wzr
+       str     w21, [sp, #S_SYSCALLNO]
        .endif
 
        /*
  *
  * x7 is reserved for the system call number in 32-bit mode.
  */
-sc_nr  .req    x25             // number of system calls
-scno   .req    x26             // syscall number
+wsc_nr .req    w25             // number of system calls
+wscno  .req    w26             // syscall number
+xscno  .req    x26             // syscall number (zero-extended)
 stbl   .req    x27             // syscall table pointer
 tsk    .req    x28             // current thread_info
 
         * AArch32 syscall handling
         */
        adrp    stbl, compat_sys_call_table     // load compat syscall table pointer
-       uxtw    scno, w7                        // syscall number in w7 (r7)
-       mov     sc_nr, #__NR_compat_syscalls
+       mov     wscno, w7                       // syscall number in w7 (r7)
+       mov     wsc_nr, #__NR_compat_syscalls
        b       el0_svc_naked
 
        .align  6
        .align  6
 el0_svc:
        adrp    stbl, sys_call_table            // load syscall table pointer
-       uxtw    scno, w8                        // syscall number in w8
-       mov     sc_nr, #__NR_syscalls
+       mov     wscno, w8                       // syscall number in w8
+       mov     wsc_nr, #__NR_syscalls
 el0_svc_naked:                                 // compat entry point
-       stp     x0, scno, [sp, #S_ORIG_X0]      // save the original x0 and syscall number
+       stp     x0, xscno, [sp, #S_ORIG_X0]     // save the original x0 and syscall number
        enable_dbg_and_irq
        ct_user_exit 1
 
        ldr     x16, [tsk, #TSK_TI_FLAGS]       // check for syscall hooks
        tst     x16, #_TIF_SYSCALL_WORK
        b.ne    __sys_trace
-       cmp     scno, sc_nr                     // check upper syscall limit
+       cmp     wscno, wsc_nr                   // check upper syscall limit
        b.hs    ni_sys
-       ldr     x16, [stbl, scno, lsl #3]       // address in the syscall table
+       ldr     x16, [stbl, xscno, lsl #3]      // address in the syscall table
        blr     x16                             // call sys_* routine
        b       ret_fast_syscall
 ni_sys:
         * switches, and waiting for our parent to respond.
         */
 __sys_trace:
-       mov     w0, #-1                         // set default errno for
-       cmp     scno, x0                        // user-issued syscall(-1)
+       cmp     wscno, #-1                      // user-issued syscall(-1)?
        b.ne    1f
-       mov     x0, #-ENOSYS
+       mov     x0, #-ENOSYS                    // set default errno if so
        str     x0, [sp, #S_X0]
 1:     mov     x0, sp
        bl      syscall_trace_enter
        cmp     w0, #-1                         // skip the syscall?
        b.eq    __sys_trace_return_skipped
-       uxtw    scno, w0                        // syscall number (possibly new)
+       mov     wscno, w0                       // syscall number (possibly new)
        mov     x1, sp                          // pointer to regs
-       cmp     scno, sc_nr                     // check upper syscall limit
+       cmp     wscno, wsc_nr                   // check upper syscall limit
        b.hs    __ni_sys_trace
        ldp     x0, x1, [sp]                    // restore the syscall args
        ldp     x2, x3, [sp, #S_X2]
        ldp     x4, x5, [sp, #S_X4]
        ldp     x6, x7, [sp, #S_X6]
-       ldr     x16, [stbl, scno, lsl #3]       // address in the syscall table
+       ldr     x16, [stbl, xscno, lsl #3]      // address in the syscall table
        blr     x16                             // call sys_* routine
 
 __sys_trace_return: