Rev 2479 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2479 | Rev 2606 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | # |
27 | # |
28 | 28 | ||
29 | .text |
29 | .text |
30 | 30 | ||
31 | .globl __syscall |
31 | .global __syscall |
32 | - | ||
33 | 32 | ||
- | 33 | ## Make a system call. |
|
- | 34 | # |
|
- | 35 | # @param rdi First argument. |
|
- | 36 | # @param rsi Second argument. |
|
- | 37 | # @param rdx Third argument. |
|
- | 38 | # @param rcx Fourth argument. |
|
- | 39 | # @param r8 Fifth argument. |
|
- | 40 | # @param r9 Sixth argument. |
|
- | 41 | # @param 8(%rsp) Syscall number. |
|
- | 42 | # |
|
- | 43 | # @return The return value will be stored in RAX. |
|
- | 44 | # |
|
34 | __syscall: |
45 | __syscall: |
- | 46 | # |
|
35 | # rcx gets rewritten on syscall |
47 | # Move the syscall number into RAX. |
- | 48 | movslq 8(%rsp), %rax |
|
- | 49 | ||
- | 50 | # |
|
- | 51 | # Save RCX, the 4th argument, aside because RCX gets rewritten by the |
|
- | 52 | # SYSCALL instruction. |
|
- | 53 | # |
|
36 | movq %rcx, %r9 |
54 | movq %rcx, %r10 |
37 | syscall |
55 | syscall |
38 | ret |
56 | ret |
39 | 57 | ||
40 | .end __syscall |
- |