in sparc linux system call entry assembly code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

below is a code snippet from arch/sparc/kernel/entry.S. I can't understand a part of it (I think I once understood it but forgot..).
#define LINUX_SYSCALL_TRAP \
        sethi %hi(sys_call_table), %l7; \
        or %l7, %lo(sys_call_table), %l7; \
        b linux_sparc_syscall; \
        rd %psr, %l0;
....
linux_sparc_syscall:
        sethi   %hi(PSR_SYSCALL), %l4
        or      %l0, %l4, %l0
        /* Direct access to user regs, must faster. */
        cmp     %g1, NR_syscalls
        bgeu    linux_sparc_ni_syscall
         sll    %g1, 2, %l4
        ld      [%l7 + %l4], %l7
        andcc   %l7, 1, %g0
        bne     linux_fast_syscall
         /* Just do first insn from SAVE_ALL in the delay slot */
when linux system call trap is entered, the sys_call_table address is stored in %l7 and %psr in %l0 and it branches to linux_sparc_syscall.
(%psr is read in branch delayed slot). From the linux_sparc_syscall, the the %l0 (PSR value) is set with system call bit (to indicate it's in system
 call later), and if the system call number is compared with the max value, if it is greater or equal, it branches to linux_sparc_ni_syscall (not implemented).
The part I can't understand follows. %l7 contains sys_call_table, so it loads the system call address with corresponding offset (nubmer * 4, or 2 bit shift left). Then what is this "andcc %l7, 1, %g0" doing?
 
Thanks!
Chan
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux