diff options
Diffstat (limited to 'src/lib/libcrypto/perlasm/x86asm.pl')
-rw-r--r-- | src/lib/libcrypto/perlasm/x86asm.pl | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/src/lib/libcrypto/perlasm/x86asm.pl b/src/lib/libcrypto/perlasm/x86asm.pl new file mode 100644 index 0000000000..6a9156ae9a --- /dev/null +++ b/src/lib/libcrypto/perlasm/x86asm.pl | |||
@@ -0,0 +1,113 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | # require 'x86asm.pl'; | ||
4 | # &asm_init("cpp","des-586.pl"); | ||
5 | # XXX | ||
6 | # XXX | ||
7 | # main'asm_finish | ||
8 | |||
9 | sub main'asm_finish | ||
10 | { | ||
11 | &file_end(); | ||
12 | &asm_finish_cpp() if $cpp; | ||
13 | print &asm_get_output(); | ||
14 | } | ||
15 | |||
16 | sub main'asm_init | ||
17 | { | ||
18 | ($type,$fn)=@_; | ||
19 | $filename=$fn; | ||
20 | |||
21 | $cpp=$sol=$aout=$win32=0; | ||
22 | if ( ($type eq "elf")) | ||
23 | { require "x86unix.pl"; } | ||
24 | elsif ( ($type eq "a.out")) | ||
25 | { $aout=1; require "x86unix.pl"; } | ||
26 | elsif ( ($type eq "sol")) | ||
27 | { $sol=1; require "x86unix.pl"; } | ||
28 | elsif ( ($type eq "cpp")) | ||
29 | { $cpp=1; require "x86unix.pl"; } | ||
30 | elsif ( ($type eq "win32")) | ||
31 | { $win32=1; require "x86ms.pl"; } | ||
32 | else | ||
33 | { | ||
34 | print STDERR <<"EOF"; | ||
35 | Pick one target type from | ||
36 | elf - linux, FreeBSD etc | ||
37 | a.out - old linux | ||
38 | sol - x86 solaris | ||
39 | cpp - format so x86unix.cpp can be used | ||
40 | win32 - Windows 95/Windows NT | ||
41 | EOF | ||
42 | exit(1); | ||
43 | } | ||
44 | |||
45 | &asm_init_output(); | ||
46 | |||
47 | &comment("Don't even think of reading this code"); | ||
48 | &comment("It was automatically generated by $filename"); | ||
49 | &comment("Which is a perl program used to generate the x86 assember for"); | ||
50 | &comment("any of elf, a.out, BSDI,Win32, or Solaris"); | ||
51 | &comment("eric <eay\@cryptsoft.com>"); | ||
52 | &comment(""); | ||
53 | |||
54 | $filename =~ s/\.pl$//; | ||
55 | &file($filename); | ||
56 | } | ||
57 | |||
58 | sub asm_finish_cpp | ||
59 | { | ||
60 | return unless $cpp; | ||
61 | |||
62 | local($tmp,$i); | ||
63 | foreach $i (&get_labels()) | ||
64 | { | ||
65 | $tmp.="#define $i _$i\n"; | ||
66 | } | ||
67 | print <<"EOF"; | ||
68 | /* Run the C pre-processor over this file with one of the following defined | ||
69 | * ELF - elf object files, | ||
70 | * OUT - a.out object files, | ||
71 | * BSDI - BSDI style a.out object files | ||
72 | * SOL - Solaris style elf | ||
73 | */ | ||
74 | |||
75 | #define TYPE(a,b) .type a,b | ||
76 | #define SIZE(a,b) .size a,b | ||
77 | |||
78 | #if defined(OUT) || defined(BSDI) | ||
79 | $tmp | ||
80 | #endif | ||
81 | |||
82 | #ifdef OUT | ||
83 | #define OK 1 | ||
84 | #define ALIGN 4 | ||
85 | #endif | ||
86 | |||
87 | #ifdef BSDI | ||
88 | #define OK 1 | ||
89 | #define ALIGN 4 | ||
90 | #undef SIZE | ||
91 | #undef TYPE | ||
92 | #define SIZE(a,b) | ||
93 | #define TYPE(a,b) | ||
94 | #endif | ||
95 | |||
96 | #if defined(ELF) || defined(SOL) | ||
97 | #define OK 1 | ||
98 | #define ALIGN 16 | ||
99 | #endif | ||
100 | |||
101 | #ifndef OK | ||
102 | You need to define one of | ||
103 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
104 | OUT - a.out systems - linux-a.out and FreeBSD | ||
105 | SOL - solaris systems, which are elf with strange comment lines | ||
106 | BSDI - a.out with a very primative version of as. | ||
107 | #endif | ||
108 | |||
109 | /* Let the Assembler begin :-) */ | ||
110 | EOF | ||
111 | } | ||
112 | |||
113 | 1; | ||