Magellan Linux

Annotation of /trunk/mkinitrd-magellan/klibc/usr/klibc/arch/arm/sysstub.ph

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1297 - (hide annotations) (download)
Fri May 27 15:12:11 2011 UTC (12 years, 11 months ago) by niro
File size: 1473 byte(s)
-updated to klibc-1.5.22 with mntproc definitions patch included
1 niro 532 # -*- perl -*-
2     #
3     # arch/arm/sysstub.ph
4     #
5     # Script to generate system call stubs
6     #
7    
8    
9     sub make_sysstub($$$$$@) {
10     my($outputdir, $fname, $type, $sname, $stype, @args) = @_;
11    
12     open(OUT, '>', "${outputdir}/${fname}.S");
13     print OUT "#include <asm/unistd.h>\n";
14     print OUT "#include <klibc/asmmacros.h>\n";
15    
16     print OUT " .text\n";
17     print OUT " .type ${fname}, #function\n";
18     print OUT " .globl ${fname}\n";
19    
20     print OUT "#ifndef __thumb__\n";
21    
22     print OUT "#ifndef __ARM_EABI__\n";
23    
24     # ARM version first
25     print OUT " .balign 4\n";
26     print OUT "${fname}:\n";
27     print OUT " stmfd sp!,{r4,r5,lr}\n";
28     print OUT " ldr r4,[sp,#12]\n";
29     print OUT " ldr r5,[sp,#16]\n";
30     print OUT " swi # __NR_${sname}\n";
31     print OUT " b __syscall_common\n";
32    
33     print OUT "#else /* __ARM_EABI__ */\n";
34    
35     # ARM EABI version
36     print out " .balign 4\n";
37     print OUT "${fname}:\n";
38     print OUT " stmfd sp!,{r4,r5,r7,lr}\n";
39     print OUT " bl __syscall_common\n";
40     print OUT " .word __NR_${sname}\n";
41    
42     print OUT "#endif /* __ARM_EABI__ */\n";
43     print OUT "#else /* __thumb__ */\n";
44    
45     # Thumb version
46     print OUT " .balign 8\n";
47     print OUT " .thumb_func\n";
48     print OUT "${fname}:\n";
49     print OUT " push {r4,r5,r7,lr}\n";
50     print OUT " bl __syscall_common\n";
51     print OUT " .short __NR_${sname}\n";
52    
53     print OUT "#endif /* __thumb__*/\n";
54    
55 niro 1297 print OUT " .size ${fname},.-${fname}\n";
56 niro 532 }
57    
58     1;