зеркало из https://github.com/mozilla/gecko-dev.git
Fix for 104740 - build bignum library on OS/2 with mpi_x86 assembly code . reviewed by nelsonb
This commit is contained in:
Родитель
b4e1895f0d
Коммит
49daf179ce
|
@ -84,6 +84,11 @@ ifneq ($(OS_TARGET),WIN16)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef XP_OS2_VACPP
|
||||||
|
ASFILES = mpi_x86.asm
|
||||||
|
DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(OS_ARCH),IRIX)
|
ifeq ($(OS_ARCH),IRIX)
|
||||||
ifeq ($(USE_N32),1)
|
ifeq ($(USE_N32),1)
|
||||||
ASFILES = mpi_mips.s
|
ASFILES = mpi_mips.s
|
||||||
|
|
|
@ -0,0 +1,277 @@
|
||||||
|
##
|
||||||
|
## Makefile.win - gmake Makefile for building MPI with MSVC on NT
|
||||||
|
##
|
||||||
|
## The contents of this file are subject to the Mozilla Public
|
||||||
|
## License Version 1.1 (the "License"); you may not use this file
|
||||||
|
## except in compliance with the License. You may obtain a copy of
|
||||||
|
## the License at http://www.mozilla.org/MPL/
|
||||||
|
##
|
||||||
|
## Software distributed under the License is distributed on an "AS
|
||||||
|
## IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||||
|
## implied. See the License for the specific language governing
|
||||||
|
## rights and limitations under the License.
|
||||||
|
##
|
||||||
|
## The Original Code is the MPI Arbitrary Precision Integer Arithmetic
|
||||||
|
## library.
|
||||||
|
##
|
||||||
|
## The Initial Developer of the Original Code is
|
||||||
|
## Michael J. Fromberger <sting@linguist.dartmouth.edu>
|
||||||
|
##
|
||||||
|
## Portions created by Michael J. Fromberger are
|
||||||
|
## Copyright (C) 1998, 2000 Michael J. Fromberger. All Rights Reserved.
|
||||||
|
##
|
||||||
|
## Contributor(s):
|
||||||
|
## Netscape Communications Corporation
|
||||||
|
##
|
||||||
|
## Alternatively, the contents of this file may be used under the
|
||||||
|
## terms of the GNU General Public License Version 2 or later (the
|
||||||
|
## "GPL"), in which case the provisions of the GPL are applicable
|
||||||
|
## instead of those above. If you wish to allow use of your
|
||||||
|
## version of this file only under the terms of the GPL and not to
|
||||||
|
## allow others to use your version of this file under the MPL,
|
||||||
|
## indicate your decision by deleting the provisions above and
|
||||||
|
## replace them with the notice and other provisions required by
|
||||||
|
## the GPL. If you do not delete the provisions above, a recipient
|
||||||
|
## may use your version of this file under either the MPL or the
|
||||||
|
## GPL.
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## $Id: Makefile.os2,v 1.1 2001/10/17 20:35:34 jpierre%netscape.com Exp $
|
||||||
|
##
|
||||||
|
|
||||||
|
## Define CC to be the C compiler you wish to use. The GNU cc
|
||||||
|
## compiler (gcc) should work, at the very least
|
||||||
|
#CC=cc
|
||||||
|
#CC=gcc
|
||||||
|
CC=icc.exe
|
||||||
|
AS=alp.exe
|
||||||
|
|
||||||
|
##
|
||||||
|
## Define PERL to point to your local Perl interpreter. It
|
||||||
|
## should be Perl 5.x, although it's conceivable that Perl 4
|
||||||
|
## might work ... I haven't tested it.
|
||||||
|
##
|
||||||
|
#PERL=/usr/bin/perl
|
||||||
|
PERL=perl
|
||||||
|
|
||||||
|
##
|
||||||
|
## Define CFLAGS to contain any local options your compiler
|
||||||
|
## setup requires.
|
||||||
|
##
|
||||||
|
## Conditional compilation options are no longer here; see
|
||||||
|
## the file 'mpi-config.h' instead.
|
||||||
|
##
|
||||||
|
MPICMN = -I. -DMP_API_COMPATIBLE -DMP_IOFUNC -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD
|
||||||
|
|
||||||
|
#OS/2
|
||||||
|
AS_SRCS = mpi_x86.asm
|
||||||
|
MPICMN += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE -DMP_ASSEMBLY_DIV_2DX1D
|
||||||
|
#CFLAGS= -Od -Z7 -MD -W3 -nologo -D_X86_ -DXP_PC \
|
||||||
|
-DDEBUG -D_DEBUG -UNDEBUG -DWIN32 -D_WINDOWS -DWIN95 $(MPICMN)
|
||||||
|
#CFLAGS = -O2 -MD -W3 -nologo -D_X86_ -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \
|
||||||
|
-DWIN32 -D_WINDOWS -DWIN95 $(MPICMN)
|
||||||
|
#CFLAGS = -Od -Z7 -MD -W3 -nologo -D_X86_ -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \
|
||||||
|
-DWIN32 -D_WINDOWS -DWIN95 $(MPICMN)
|
||||||
|
CFLAGS = /Ti+ -D_X86_ -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \
|
||||||
|
$(MPICMN)
|
||||||
|
ASFLAGS =
|
||||||
|
|
||||||
|
##
|
||||||
|
## Define LIBS to include any libraries you need to link against.
|
||||||
|
## If NO_TABLE is define, LIBS should include '-lm' or whatever is
|
||||||
|
## necessary to bring in the math library. Otherwise, it can be
|
||||||
|
## left alone, unless your system has other peculiar requirements.
|
||||||
|
##
|
||||||
|
LIBS=#-lmalloc#-lefence#-lm
|
||||||
|
|
||||||
|
##
|
||||||
|
## Define RANLIB to be the library header randomizer; you might not
|
||||||
|
## need this on some systems (just set it to 'echo' on these systems,
|
||||||
|
## such as IRIX)
|
||||||
|
##
|
||||||
|
RANLIB=echo
|
||||||
|
|
||||||
|
##
|
||||||
|
## This is the version string used for the documentation and
|
||||||
|
## building the distribution tarball. Don't mess with it unless
|
||||||
|
## you are releasing a new version
|
||||||
|
VERS=1.7p6
|
||||||
|
|
||||||
|
## ----------------------------------------------------------------------
|
||||||
|
## You probably don't need to change anything below this line...
|
||||||
|
##
|
||||||
|
|
||||||
|
##
|
||||||
|
## This is the list of source files that need to be packed into
|
||||||
|
## the distribution file
|
||||||
|
SRCS= mpi.c mpprime.c mplogic.c mpmontg.c mpi-test.c primes.c tests/ \
|
||||||
|
utils/gcd.c utils/invmod.c utils/lap.c \
|
||||||
|
utils/ptab.pl utils/sieve.c utils/isprime.c\
|
||||||
|
utils/dec2hex.c utils/hex2dec.c utils/bbs_rand.c \
|
||||||
|
utils/bbsrand.c utils/prng.c utils/primegen.c \
|
||||||
|
utils/basecvt.c utils/makeprime.c\
|
||||||
|
utils/fact.c utils/exptmod.c utils/pi.c utils/metime.c \
|
||||||
|
utils/mpi.h utils/mpprime.h mulsqr.c \
|
||||||
|
make-test-arrays test-arrays.txt all-tests make-logtab \
|
||||||
|
types.pl stats timetest multest
|
||||||
|
|
||||||
|
## These are the header files that go into the distribution file
|
||||||
|
HDRS=mpi.h mpi-config.h utils/mpi.h utils/mpi-config.h mpprime.h mplogic.h \
|
||||||
|
utils/bbs_rand.h tests/mpi.h tests/mpprime.h
|
||||||
|
|
||||||
|
## These are the documentation files that go into the distribution file
|
||||||
|
DOCS=README doc utils/README utils/PRIMES
|
||||||
|
|
||||||
|
## This is the list of tools built by 'make tools'
|
||||||
|
TOOLS=gcd.exe invmod.exe isprime.exe lap.exe dec2hex.exe hex2dec.exe \
|
||||||
|
primegen.exe prng.exe basecvt.exe fact.exe exptmod.exe pi.exe makeprime.exe
|
||||||
|
|
||||||
|
AS_OBJS = $(AS_SRCS:.asm=.obj)
|
||||||
|
LIBOBJS = mpprime.obj mpmontg.obj mplogic.obj mpi.obj $(AS_OBJS)
|
||||||
|
LIBHDRS = mpi-config.h mpi-priv.h mpi.h
|
||||||
|
APPHDRS = mpi-config.h mpi.h mplogic.h mpprime.h
|
||||||
|
|
||||||
|
|
||||||
|
help:
|
||||||
|
@ echo ""
|
||||||
|
@ echo "The following targets can be built with this Makefile:"
|
||||||
|
@ echo ""
|
||||||
|
@ echo "mpi.lib - arithmetic and prime testing library"
|
||||||
|
@ echo "mpi-test.exe - test driver (requires MP_IOFUNC)"
|
||||||
|
@ echo "tools - command line tools"
|
||||||
|
@ echo "doc - manual pages for tools"
|
||||||
|
@ echo "clean - clean up objects and such"
|
||||||
|
@ echo "distclean - get ready for distribution"
|
||||||
|
@ echo "dist - distribution tarball"
|
||||||
|
@ echo ""
|
||||||
|
|
||||||
|
.SUFFIXES: .c .obj .i .lib .exe .asm
|
||||||
|
|
||||||
|
.c.i:
|
||||||
|
$(CC) $(CFLAGS) -E $< > $@
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
$(CC) $(CFLAGS) -c $<
|
||||||
|
|
||||||
|
.asm.obj:
|
||||||
|
$(AS) $(ASFLAGS) $<
|
||||||
|
|
||||||
|
.obj.exe:
|
||||||
|
$(CC) $(CFLAGS) -Fo$@ $<
|
||||||
|
|
||||||
|
#---------------------------------------
|
||||||
|
|
||||||
|
$(LIBOBJS): $(LIBHDRS)
|
||||||
|
|
||||||
|
logtab.h: make-logtab
|
||||||
|
$(PERL) make-logtab > logtab.h
|
||||||
|
|
||||||
|
mpi.obj: mpi.c logtab.h $(LIBHDRS)
|
||||||
|
|
||||||
|
mplogic.obj: mplogic.c mpi-priv.h mplogic.h $(LIBHDRS)
|
||||||
|
|
||||||
|
mpmontg.obj: mpmontg.c mpi-priv.h mplogic.h mpprime.h $(LIBHDRS)
|
||||||
|
|
||||||
|
mpprime.obj: mpprime.c mpi-priv.h mpprime.h mplogic.h primes.c $(LIBHDRS)
|
||||||
|
|
||||||
|
mpi_mips.obj: mpi_mips.s
|
||||||
|
$(CC) -Fo$@ $(ASFLAGS) -c mpi_mips.s
|
||||||
|
|
||||||
|
mpi.lib: $(LIBOBJS)
|
||||||
|
ilib /out:mpi.lib $(LIBOBJS)
|
||||||
|
$(RANLIB) mpi.lib
|
||||||
|
|
||||||
|
lib libs: mpi.lib
|
||||||
|
|
||||||
|
#---------------------------------------
|
||||||
|
|
||||||
|
MPTESTOBJS = mptest1.obj mptest2.obj mptest3.obj mptest3a.obj mptest4.obj \
|
||||||
|
mptest4a.obj mptest4b.obj mptest6.obj mptest7.obj mptest8.obj mptest9.obj
|
||||||
|
MPTESTS = $(MPTESTOBJS:.obj=.exe)
|
||||||
|
|
||||||
|
$(MPTESTOBJS): mptest%.obj: tests/mptest-%.c $(LIBHDRS)
|
||||||
|
$(CC) $(CFLAGS) -Fo$@ -c $<
|
||||||
|
|
||||||
|
$(MPTESTS): mptest%.exe: mptest%.obj mpi.lib $(LIBS)
|
||||||
|
$(CC) $(CFLAGS) -Fo$@ $^
|
||||||
|
|
||||||
|
tests: mptest1.exe mptest2.exe mptest3.exe mptest3a.exe mptest4.exe \
|
||||||
|
mptest4a.exe mptest4b.exe mptest6.exe bbsrand.exe
|
||||||
|
|
||||||
|
utests: mptest7.exe mptest8.exe mptest9.exe
|
||||||
|
|
||||||
|
#---------------------------------------
|
||||||
|
|
||||||
|
EXTRAOBJS = bbsrand.obj bbs_rand.obj prng.obj
|
||||||
|
UTILOBJS = primegen.obj metime.obj identest.obj basecvt.obj fact.obj \
|
||||||
|
exptmod.obj pi.obj makeprime.obj karatsuba.obj gcd.obj invmod.obj lap.obj \
|
||||||
|
isprime.obj dec2hex.obj hex2dec.obj
|
||||||
|
UTILS = $(UTILOBJS:.obj=.exe)
|
||||||
|
|
||||||
|
$(UTILS): %.exe : %.obj mpi.lib $(LIBS)
|
||||||
|
$(CC) $(CFLAGS) -Fo$@ $^
|
||||||
|
|
||||||
|
$(UTILOBJS) $(EXTRAOBJS): %.obj : utils/%.c $(LIBHDRS)
|
||||||
|
$(CC) $(CFLAGS) -Fo$@ -c $<
|
||||||
|
|
||||||
|
prng.exe: prng.obj bbs_rand.obj mpi.lib $(LIBS)
|
||||||
|
$(CC) $(CFLAGS) -Fo$@ $^
|
||||||
|
|
||||||
|
bbsrand.exe: bbsrand.obj bbs_rand.obj mpi.lib $(LIBS)
|
||||||
|
$(CC) $(CFLAGS) -Fo$@ $^
|
||||||
|
|
||||||
|
utils: $(UTILS) prng.exe bbsrand.exe
|
||||||
|
|
||||||
|
#---------------------------------------
|
||||||
|
|
||||||
|
test-info.c: test-arrays.txt
|
||||||
|
$(PERL) make-test-arrays test-arrays.txt > test-info.c
|
||||||
|
|
||||||
|
mpi-test.obj: mpi-test.c test-info.c $(LIBHDRS)
|
||||||
|
$(CC) $(CFLAGS) -Fo$@ -c $<
|
||||||
|
|
||||||
|
mpi-test.exe: mpi-test.obj mpi.lib $(LIBS)
|
||||||
|
$(CC) $(CFLAGS) -Fo$@ $^
|
||||||
|
|
||||||
|
mdxptest.obj: mdxptest.c $(LIBHDRS) mpi-priv.h
|
||||||
|
|
||||||
|
mdxptest.exe: mdxptest.obj mpi.lib $(LIBS)
|
||||||
|
$(CC) $(CFLAGS) -Fo$@ $^
|
||||||
|
|
||||||
|
mulsqr.obj: mulsqr.c logtab.h mpi.h mpi-config.h mpprime.h
|
||||||
|
$(CC) $(CFLAGS) -DMP_SQUARE=1 -Fo$@ -c mulsqr.c
|
||||||
|
|
||||||
|
mulsqr.exe: mulsqr.obj mpi.lib $(LIBS)
|
||||||
|
$(CC) $(CFLAGS) -Fo$@ $^
|
||||||
|
|
||||||
|
#---------------------------------------
|
||||||
|
|
||||||
|
alltests: tests utests mpi-test.exe
|
||||||
|
|
||||||
|
tools: $(TOOLS)
|
||||||
|
|
||||||
|
doc:
|
||||||
|
(cd doc; ./build)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.obj *.lib *.pdb *.ilk
|
||||||
|
cd utils; rm -f *.obj *.lib *.pdb *.ilk
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
rm -f mptest? mpi-test metime mulsqr karatsuba
|
||||||
|
rm -f mptest?a mptest?b
|
||||||
|
rm -f utils/mptest?
|
||||||
|
rm -f test-info.c logtab.h
|
||||||
|
rm -f mpi.lib
|
||||||
|
rm -f $(TOOLS)
|
||||||
|
|
||||||
|
dist: Makefile $(HDRS) $(SRCS) $(DOCS)
|
||||||
|
tar -cvf mpi-$(VERS).tar Makefile $(HDRS) $(SRCS) $(DOCS)
|
||||||
|
pgps -ab mpi-$(VERS).tar
|
||||||
|
chmod +r mpi-$(VERS).tar.asc
|
||||||
|
gzip -9 mpi-$(VERS).tar
|
||||||
|
|
||||||
|
|
||||||
|
print:
|
||||||
|
@echo LIBOBJS = $(LIBOBJS)
|
||||||
|
# END
|
|
@ -38,7 +38,7 @@
|
||||||
* the GPL. If you do not delete the provisions above, a recipient
|
* the GPL. If you do not delete the provisions above, a recipient
|
||||||
* may use your version of this file under either the MPL or the GPL.
|
* may use your version of this file under either the MPL or the GPL.
|
||||||
*
|
*
|
||||||
* $Id: mpi-priv.h,v 1.13 2000/12/20 05:54:18 nelsonb%netscape.com Exp $
|
* $Id: mpi-priv.h,v 1.14 2001/10/17 20:35:34 jpierre%netscape.com Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _MPI_PRIV_H_
|
#ifndef _MPI_PRIV_H_
|
||||||
#define _MPI_PRIV_H_ 1
|
#define _MPI_PRIV_H_ 1
|
||||||
|
@ -229,14 +229,25 @@ mp_err s_mp_invmod_2d( const mp_int *a, mp_size k, mp_int *c);
|
||||||
mp_err s_mp_invmod_even_m(const mp_int *a, const mp_int *m, mp_int *c);
|
mp_err s_mp_invmod_even_m(const mp_int *a, const mp_int *m, mp_int *c);
|
||||||
|
|
||||||
/* ------ mpv functions, operate on arrays of digits, not on mp_int's ------ */
|
/* ------ mpv functions, operate on arrays of digits, not on mp_int's ------ */
|
||||||
void s_mpv_mul_d(const mp_digit *a, mp_size a_len, mp_digit b, mp_digit *c);
|
#if defined (__OS2__) && defined (__IBMC__)
|
||||||
void s_mpv_mul_d_add(const mp_digit *a, mp_size a_len, mp_digit b,
|
#define MPI_ASM_DECL __cdecl
|
||||||
mp_digit *c);
|
#else
|
||||||
void s_mpv_mul_d_add_prop(const mp_digit *a, mp_size a_len, mp_digit b,
|
#define MPI_ASM_DECL
|
||||||
mp_digit *c);
|
#endif
|
||||||
void s_mpv_sqr_add_prop(const mp_digit *a, mp_size a_len, mp_digit *sqrs);
|
|
||||||
mp_err s_mpv_div_2dx1d(mp_digit Nhi, mp_digit Nlo, mp_digit divisor,
|
void MPI_ASM_DECL s_mpv_mul_d(const mp_digit *a, mp_size a_len,
|
||||||
mp_digit *quot, mp_digit *rem);
|
mp_digit b, mp_digit *c);
|
||||||
|
void MPI_ASM_DECL s_mpv_mul_d_add(const mp_digit *a, mp_size a_len,
|
||||||
|
mp_digit b, mp_digit *c);
|
||||||
|
void MPI_ASM_DECL s_mpv_mul_d_add_prop(const mp_digit *a,
|
||||||
|
mp_size a_len, mp_digit b,
|
||||||
|
mp_digit *c);
|
||||||
|
void MPI_ASM_DECL s_mpv_sqr_add_prop(const mp_digit *a,
|
||||||
|
mp_size a_len,
|
||||||
|
mp_digit *sqrs);
|
||||||
|
|
||||||
|
mp_err MPI_ASM_DECL s_mpv_div_2dx1d(mp_digit Nhi, mp_digit Nlo,
|
||||||
|
mp_digit divisor, mp_digit *quot, mp_digit *rem);
|
||||||
|
|
||||||
/* c += a * b * (MP_RADIX ** offset); */
|
/* c += a * b * (MP_RADIX ** offset); */
|
||||||
#define s_mp_mul_d_add_offset(a, b, c, off) \
|
#define s_mp_mul_d_add_offset(a, b, c, off) \
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
* the GPL. If you do not delete the provisions above, a recipient
|
* the GPL. If you do not delete the provisions above, a recipient
|
||||||
* may use your version of this file under either the MPL or the GPL.
|
* may use your version of this file under either the MPL or the GPL.
|
||||||
*
|
*
|
||||||
* $Id: lap.c,v 1.1 2000/07/14 00:44:58 nelsonb%netscape.com Exp $
|
* $Id: lap.c,v 1.2 2001/10/17 20:35:37 jpierre%netscape.com Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -67,7 +67,9 @@ int main(int argc, char *argv[])
|
||||||
mp_init_copy(&k, &a);
|
mp_init_copy(&k, &a);
|
||||||
|
|
||||||
signal(SIGINT, sig_catch);
|
signal(SIGINT, sig_catch);
|
||||||
|
#ifndef __OS2__
|
||||||
signal(SIGHUP, sig_catch);
|
signal(SIGHUP, sig_catch);
|
||||||
|
#endif
|
||||||
signal(SIGTERM, sig_catch);
|
signal(SIGTERM, sig_catch);
|
||||||
|
|
||||||
while(mp_cmp(&p, &m) < 0) {
|
while(mp_cmp(&p, &m) < 0) {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
* the GPL. If you do not delete the provisions above, a recipient
|
* the GPL. If you do not delete the provisions above, a recipient
|
||||||
* may use your version of this file under either the MPL or the GPL.
|
* may use your version of this file under either the MPL or the GPL.
|
||||||
*
|
*
|
||||||
* $Id: prng.c,v 1.1 2000/07/14 00:45:01 nelsonb%netscape.com Exp $
|
* $Id: prng.c,v 1.2 2001/10/17 20:35:37 jpierre%netscape.com Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -42,7 +42,12 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#ifdef __OS2__
|
||||||
|
#include <types.h>
|
||||||
|
#include <process.h>
|
||||||
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "bbs_rand.h"
|
#include "bbs_rand.h"
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче