<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>P {MARGIN-TOP: 0mm; MARGIN-BOTTOM: 0mm}</style>
</head>
<body>
<div style="FONT-FAMILY: 굴림; FONT-SIZE: 10pt" id="ezFormProc_div">
<div id="msgbody">
<div>
<div style="LINE-HEIGHT: 15pt">Hi,</div>
<div style="LINE-HEIGHT: 15pt"><br>
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..).</div>
<div style="LINE-HEIGHT: 15pt">#define LINUX_SYSCALL_TRAP \<br>
sethi %hi(sys_call_table), %l7; \<br>
or %l7, %lo(sys_call_table), %l7; \<br>
b linux_sparc_syscall; \ <br>
rd %psr, %l0;<br>
....<br>
linux_sparc_syscall:<br>
sethi %hi(PSR_SYSCALL), %l4<br>
or %l0, %l4, %l0<br>
/* Direct access to user regs, must faster. */<br>
cmp %g1, NR_syscalls<br>
bgeu linux_sparc_ni_syscall<br>
sll %g1, 2, %l4<br>
ld [%l7 + %l4], %l7<br>
andcc %l7, 1, %g0<br>
bne linux_fast_syscall<br>
/* Just do first insn from SAVE_ALL in the delay slot */</div>
<div style="LINE-HEIGHT: 15pt">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.
<br>
(%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<br>
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).<br>
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?</div>
<div style="LINE-HEIGHT: 15pt"> </div>
<div style="LINE-HEIGHT: 15pt">Thanks!</div>
<div style="LINE-HEIGHT: 15pt">Chan</div>
</div>
</div>
</div>
</body>
</html>