• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Assembly code for making riscv64 syscalls.
2#
3# riscv64 syscall argument register ordering is the same as the riscv64
4# userspace argument register ordering except that the syscall number
5# (nr) is passed in a7.
6#
7# nr_last.rs takes care of reordering the nr argument to the end for us,
8# so we only need to move nr into a7.
9
10    .file       "riscv64.s"
11
12    .section    .text.rustix_syscall0_nr_last,"ax",@progbits
13    .p2align    4
14    .weak       rustix_syscall0_nr_last
15    .hidden     rustix_syscall0_nr_last
16    .type       rustix_syscall0_nr_last, @function
17rustix_syscall0_nr_last:
18    .cfi_startproc
19    mv      a7, a0
20    ecall
21    ret
22    .cfi_endproc
23    .size rustix_syscall0_nr_last, .-rustix_syscall0_nr_last
24
25    .section    .text.rustix_syscall1_nr_last,"ax",@progbits
26    .p2align    4
27    .weak       rustix_syscall1_nr_last
28    .hidden     rustix_syscall1_nr_last
29    .type       rustix_syscall1_nr_last, @function
30rustix_syscall1_nr_last:
31    .cfi_startproc
32    mv      a7, a1
33    ecall
34    ret
35    .cfi_endproc
36    .size rustix_syscall1_nr_last, .-rustix_syscall1_nr_last
37
38    .section    .text.rustix_syscall1_noreturn_nr_last,"ax",@progbits
39    .p2align    4
40    .weak       rustix_syscall1_noreturn_nr_last
41    .hidden     rustix_syscall1_noreturn_nr_last
42    .type       rustix_syscall1_noreturn_nr_last, @function
43rustix_syscall1_noreturn_nr_last:
44    .cfi_startproc
45    mv      a7, a1
46    ecall
47    unimp
48    .cfi_endproc
49    .size rustix_syscall1_noreturn_nr_last, .-rustix_syscall1_noreturn_nr_last
50
51    .section    .text.rustix_syscall2_nr_last,"ax",@progbits
52    .p2align    4
53    .weak       rustix_syscall2_nr_last
54    .hidden     rustix_syscall2_nr_last
55    .type       rustix_syscall2_nr_last, @function
56rustix_syscall2_nr_last:
57    .cfi_startproc
58    mv      a7, a2
59    ecall
60    ret
61    .cfi_endproc
62    .size rustix_syscall2_nr_last, .-rustix_syscall2_nr_last
63
64    .section    .text.rustix_syscall3_nr_last,"ax",@progbits
65    .p2align    4
66    .weak       rustix_syscall3_nr_last
67    .hidden     rustix_syscall3_nr_last
68    .type       rustix_syscall3_nr_last, @function
69rustix_syscall3_nr_last:
70    .cfi_startproc
71    mv      a7, a3
72    ecall
73    ret
74    .cfi_endproc
75    .size rustix_syscall3_nr_last, .-rustix_syscall3_nr_last
76
77    .section    .text.rustix_syscall4_nr_last,"ax",@progbits
78    .p2align    4
79    .weak       rustix_syscall4_nr_last
80    .hidden     rustix_syscall4_nr_last
81    .type       rustix_syscall4_nr_last, @function
82rustix_syscall4_nr_last:
83    .cfi_startproc
84    mv      a7, a4
85    ecall
86    ret
87    .cfi_endproc
88    .size rustix_syscall4_nr_last, .-rustix_syscall4_nr_last
89
90    .section    .text.rustix_syscall5_nr_last,"ax",@progbits
91    .p2align    4
92    .weak       rustix_syscall5_nr_last
93    .hidden     rustix_syscall5_nr_last
94    .type       rustix_syscall5_nr_last, @function
95rustix_syscall5_nr_last:
96    .cfi_startproc
97    mv      a7, a5
98    ecall
99    ret
100    .cfi_endproc
101    .size rustix_syscall5_nr_last, .-rustix_syscall5_nr_last
102
103    .section    .text.rustix_syscall6_nr_last,"ax",@progbits
104    .p2align    4
105    .weak       rustix_syscall6_nr_last
106    .hidden     rustix_syscall6_nr_last
107    .type       rustix_syscall6_nr_last, @function
108rustix_syscall6_nr_last:
109    .cfi_startproc
110    mv      a7, a6
111    ecall
112    ret
113    .cfi_endproc
114    .size rustix_syscall6_nr_last, .-rustix_syscall6_nr_last
115
116    .section .note.GNU-stack,"",@progbits
117