all: remove $OBJTYPE from build

Now that we assume pthreads, the only assembly
left is in libmp and libsec.
We only ever added assembly for 386.
The portable C code is fine for plan9port.
This commit is contained in:
Russ Cox 2020-12-30 07:39:16 -05:00
parent 0bd1478342
commit 99dee78c2d
56 changed files with 41 additions and 1291 deletions

View file

@ -1,15 +0,0 @@
<$PLAN9/src/mkhdr
LIB=libmp.a
UNAME=`uname`
A=`[ $UNAME = Darwin ] && echo -Darwin`
OFILES=\
mpdigdiv$A.$O\
mpvecadd$A.$O\
mpvecdigmuladd$A.$O\
mpvecdigmulsub$A.$O\
mpvecsub$A.$O\
HFILES=$PLAN9/include/mp.h ../port/dat.h
<$PLAN9/src/mksyslib

View file

@ -1,33 +0,0 @@
.text
.globl _mpdigdiv
_mpdigdiv:
/* Prelude */
pushl %ebp /* save on stack */
pushl %ebx
leal 12(%esp), %ebp /* %ebp = FP for now */
movl 0(%ebp), %ebx /* dividend */
movl 0(%ebx), %eax
movl 4(%ebx), %edx
movl 4(%ebp), %ebx /* divisor */
movl 8(%ebp), %ebp /* quotient */
xorl %ecx, %ecx
cmpl %ebx, %edx /* dividend >= 2^32 * divisor */
jae 2f
cmpl %ecx, %ebx /* divisor == 1 */
je 2f
divl %ebx /* AX = DX:AX/BX */
movl %eax, (%ebp)
1:
/* Postlude */
popl %ebx
popl %ebp
ret
/* return all 1's */
2:
notl %ecx
movl %ecx, (%ebp)
jmp 1b

View file

@ -1,33 +0,0 @@
.text
.p2align 2,0x90
.globl mpdigdiv
mpdigdiv:
/* Prelude */
pushl %ebp /* save on stack */
pushl %ebx
leal 12(%esp), %ebp /* %ebp = FP for now */
movl 0(%ebp), %ebx /* dividend */
movl 0(%ebx), %eax
movl 4(%ebx), %edx
movl 4(%ebp), %ebx /* divisor */
movl 8(%ebp), %ebp /* quotient */
xorl %ecx, %ecx
cmpl %ebx, %edx /* dividend >= 2^32 * divisor */
jae divovfl
cmpl %ecx, %ebx /* divisor == 1 */
je divovfl
divl %ebx /* AX = DX:AX/BX */
movl %eax, (%ebp)
done:
/* Postlude */
popl %ebx
popl %ebp
ret
/* return all 1's */
divovfl:
notl %ecx
movl %ecx, (%ebp)
jmp done

View file

@ -1,70 +0,0 @@
/* mpvecadd(mpdigit *a, int alen, mpdigit *b, int blen, mpdigit *sum) */
/* sum[0:alen] = a[0:alen-1] + b[0:blen-1] */
/* prereq: alen >= blen, sum has room for alen+1 digits */
/* (very old gnu assembler doesn't allow multiline comments) */
.text
.p2align 2,0x90
.globl _mpvecadd
_mpvecadd:
/* Prelude */
pushl %ebp /* save on stack */
pushl %ebx
pushl %esi
pushl %edi
leal 20(%esp), %ebp /* %ebp = FP for now */
movl 4(%ebp), %edx /* alen */
movl 12(%ebp), %ecx /* blen */
movl 0(%ebp), %esi /* a */
movl 8(%ebp), %ebx /* b */
subl %ecx, %edx
movl 16(%ebp), %edi /* sum */
xorl %ebp, %ebp /* this also sets carry to 0 */
/* skip addition if b is zero */
testl %ecx,%ecx
je 2f
/* sum[0:blen-1],carry = a[0:blen-1] + b[0:blen-1] */
1:
movl (%esi, %ebp, 4), %eax
adcl (%ebx, %ebp, 4), %eax
movl %eax, (%edi, %ebp, 4)
incl %ebp
loop 1b
2:
/* jump if alen > blen */
incl %edx
movl %edx, %ecx
loop 5f
/* sum[alen] = carry */
3:
jb 4f
movl $0, (%edi, %ebp, 4)
jmp 6f
4:
movl $1, (%edi, %ebp, 4)
jmp 6f
/* sum[blen:alen-1],carry = a[blen:alen-1] + 0 */
5:
movl (%esi, %ebp, 4),%eax
adcl $0, %eax
movl %eax, (%edi, %ebp, 4)
incl %ebp
loop 5b
jmp 3b
6:
/* Postlude */
popl %edi
popl %esi
popl %ebx
popl %ebp
ret

View file

@ -1,70 +0,0 @@
/* mpvecadd(mpdigit *a, int alen, mpdigit *b, int blen, mpdigit *sum) */
/* sum[0:alen] = a[0:alen-1] + b[0:blen-1] */
/* prereq: alen >= blen, sum has room for alen+1 digits */
/* (very old gnu assembler doesn't allow multiline comments) */
.text
.p2align 2,0x90
.globl mpvecadd
mpvecadd:
/* Prelude */
pushl %ebp /* save on stack */
pushl %ebx
pushl %esi
pushl %edi
leal 20(%esp), %ebp /* %ebp = FP for now */
movl 4(%ebp), %edx /* alen */
movl 12(%ebp), %ecx /* blen */
movl 0(%ebp), %esi /* a */
movl 8(%ebp), %ebx /* b */
subl %ecx, %edx
movl 16(%ebp), %edi /* sum */
xorl %ebp, %ebp /* this also sets carry to 0 */
/* skip addition if b is zero */
testl %ecx,%ecx
je _add1
/* sum[0:blen-1],carry = a[0:blen-1] + b[0:blen-1] */
_addloop1:
movl (%esi, %ebp, 4), %eax
adcl (%ebx, %ebp, 4), %eax
movl %eax, (%edi, %ebp, 4)
incl %ebp
loop _addloop1
_add1:
/* jump if alen > blen */
incl %edx
movl %edx, %ecx
loop _addloop2
/* sum[alen] = carry */
_addend:
jb _addcarry
movl $0, (%edi, %ebp, 4)
jmp done
_addcarry:
movl $1, (%edi, %ebp, 4)
jmp done
/* sum[blen:alen-1],carry = a[blen:alen-1] + 0 */
_addloop2:
movl (%esi, %ebp, 4),%eax
adcl $0, %eax
movl %eax, (%edi, %ebp, 4)
incl %ebp
loop _addloop2
jmp _addend
done:
/* Postlude */
popl %edi
popl %esi
popl %ebx
popl %ebp
ret

View file

@ -1,68 +0,0 @@
/*
* mpvecdigmul(mpdigit *b, int n, mpdigit m, mpdigit *p)
*
* p += b*m
*
* each step look like:
* hi,lo = m*b[i]
* lo += oldhi + carry
* hi += carry
* p[i] += lo
* oldhi = hi
*
* the registers are:
* hi = DX - constrained by hardware
* lo = AX - constrained by hardware
* b+n = SI - can't be BP
* p+n = DI - can't be BP
* i-n = BP
* m = BX
* oldhi = CX
*
*/
.text
.globl _mpvecdigmuladd
_mpvecdigmuladd:
/* Prelude */
pushl %ebp /* save on stack */
pushl %ebx
pushl %esi
pushl %edi
leal 20(%esp), %ebp /* %ebp = FP for now */
movl 0(%ebp), %esi /* b */
movl 4(%ebp), %ecx /* n */
movl 8(%ebp), %ebx /* m */
movl 12(%ebp), %edi /* p */
movl %ecx, %ebp
negl %ebp /* BP = -n */
shll $2, %ecx
addl %ecx, %esi /* SI = b + n */
addl %ecx, %edi /* DI = p + n */
xorl %ecx, %ecx
1:
movl (%esi, %ebp, 4), %eax /* lo = b[i] */
mull %ebx /* hi, lo = b[i] * m */
addl %ecx,%eax /* lo += oldhi */
jae 2f
incl %edx /* hi += carry */
2:
addl %eax, (%edi, %ebp, 4) /* p[i] += lo */
jae 3f
incl %edx /* hi += carry */
3:
movl %edx, %ecx /* oldhi = hi */
incl %ebp /* i++ */
jnz 1b
xorl %eax, %eax
addl %ecx, (%edi, %ebp, 4) /* p[n] + oldhi */
adcl %eax, %eax /* return carry out of p[n] */
/* Postlude */
popl %edi
popl %esi
popl %ebx
popl %ebp
ret

View file

@ -1,69 +0,0 @@
#
# mpvecdigmul(mpdigit *b, int n, mpdigit m, mpdigit *p)
#
# p += b*m
#
# each step look like:
# hi,lo = m*b[i]
# lo += oldhi + carry
# hi += carry
# p[i] += lo
# oldhi = hi
#
# the registers are:
# hi = DX - constrained by hardware
# lo = AX - constrained by hardware
# b+n = SI - can't be BP
# p+n = DI - can't be BP
# i-n = BP
# m = BX
# oldhi = CX
#
.text
.p2align 2,0x90
.globl mpvecdigmuladd
mpvecdigmuladd:
# Prelude
pushl %ebp # save on stack
pushl %ebx
pushl %esi
pushl %edi
leal 20(%esp), %ebp # %ebp = FP for now
movl 0(%ebp), %esi # b
movl 4(%ebp), %ecx # n
movl 8(%ebp), %ebx # m
movl 12(%ebp), %edi # p
movl %ecx, %ebp
negl %ebp # BP = -n
shll $2, %ecx
addl %ecx, %esi # SI = b + n
addl %ecx, %edi # DI = p + n
xorl %ecx, %ecx
_muladdloop:
movl (%esi, %ebp, 4), %eax # lo = b[i]
mull %ebx # hi, lo = b[i] * m
addl %ecx,%eax # lo += oldhi
jae _muladdnocarry1
incl %edx # hi += carry
_muladdnocarry1:
addl %eax, (%edi, %ebp, 4) # p[i] += lo
jae _muladdnocarry2
incl %edx # hi += carry
_muladdnocarry2:
movl %edx, %ecx # oldhi = hi
incl %ebp # i++
jnz _muladdloop
xorl %eax, %eax
addl %ecx, (%edi, %ebp, 4) # p[n] + oldhi
adcl %eax, %eax # return carry out of p[n]
# Postlude
popl %edi
popl %esi
popl %ebx
popl %ebp
ret

View file

@ -1,69 +0,0 @@
/*
* mpvecdigmulsub(mpdigit *b, int n, mpdigit m, mpdigit *p)
*
* p -= b*m
*
* each step look like:
* hi,lo = m*b[i]
* lo += oldhi + carry
* hi += carry
* p[i] += lo
* oldhi = hi
*
* the registers are:
* hi = DX - constrained by hardware
* lo = AX - constrained by hardware
* b = SI - can't be BP
* p = DI - can't be BP
* i = BP
* n = CX - constrained by LOOP instr
* m = BX
* oldhi = EX
*
*/
.text
.globl _mpvecdigmulsub
_mpvecdigmulsub:
/* Prelude */
pushl %ebp /* save on stack */
pushl %ebx
pushl %esi
pushl %edi
leal 20(%esp), %ebp /* %ebp = FP for now */
movl 0(%ebp), %esi /* b */
movl 4(%ebp), %ecx /* n */
movl 8(%ebp), %ebx /* m */
movl 12(%ebp), %edi /* p */
xorl %ebp, %ebp
pushl %ebp
1:
movl (%esi, %ebp, 4),%eax /* lo = b[i] */
mull %ebx /* hi, lo = b[i] * m */
addl 0(%esp), %eax /* lo += oldhi */
jae 2f
incl %edx /* hi += carry */
2:
subl %eax, (%edi, %ebp, 4)
jae 3f
incl %edx /* hi += carry */
3:
movl %edx, 0(%esp)
incl %ebp
loop 1b
popl %eax
subl %eax, (%edi, %ebp, 4)
jae 4f
movl $-1, %eax
jmp 5f
4:
movl $1, %eax
5:
/* Postlude */
popl %edi
popl %esi
popl %ebx
popl %ebp
ret

View file

@ -1,70 +0,0 @@
#
# mpvecdigmulsub(mpdigit *b, int n, mpdigit m, mpdigit *p)
#
# p -= b*m
#
# each step look like:
# hi,lo = m*b[i]
# lo += oldhi + carry
# hi += carry
# p[i] += lo
# oldhi = hi
#
# the registers are:
# hi = DX - constrained by hardware
# lo = AX - constrained by hardware
# b = SI - can't be BP
# p = DI - can't be BP
# i = BP
# n = CX - constrained by LOOP instr
# m = BX
# oldhi = EX
#
.text
.p2align 2,0x90
.globl mpvecdigmulsub
mpvecdigmulsub:
# Prelude
pushl %ebp # save on stack
pushl %ebx
pushl %esi
pushl %edi
leal 20(%esp), %ebp # %ebp = FP for now
movl 0(%ebp), %esi # b
movl 4(%ebp), %ecx # n
movl 8(%ebp), %ebx # m
movl 12(%ebp), %edi # p
xorl %ebp, %ebp
pushl %ebp
_mulsubloop:
movl (%esi, %ebp, 4),%eax # lo = b[i]
mull %ebx # hi, lo = b[i] * m
addl 0(%esp), %eax # lo += oldhi
jae _mulsubnocarry1
incl %edx # hi += carry
_mulsubnocarry1:
subl %eax, (%edi, %ebp, 4)
jae _mulsubnocarry2
incl %edx # hi += carry
_mulsubnocarry2:
movl %edx, 0(%esp)
incl %ebp
loop _mulsubloop
popl %eax
subl %eax, (%edi, %ebp, 4)
jae _mulsubnocarry3
movl $-1, %eax
jmp done
_mulsubnocarry3:
movl $1, %eax
done:
# Postlude
popl %edi
popl %esi
popl %ebx
popl %ebp
ret

View file

@ -1,60 +0,0 @@
/* mpvecsub(mpdigit *a, int alen, mpdigit *b, int blen, mpdigit *diff) */
/* diff[0:alen-1] = a[0:alen-1] - b[0:blen-1] */
/* prereq: alen >= blen, diff has room for alen digits */
/* (very old gnu assembler doesn't allow multiline comments) */
.text
.p2align 2,0x90
.globl _mpvecsub
_mpvecsub:
/* Prelude */
pushl %ebp /* save on stack */
pushl %ebx
pushl %esi
pushl %edi
leal 20(%esp), %ebp /* %ebp = FP for now */
movl 0(%ebp), %esi /* a */
movl 8(%ebp), %ebx /* b */
movl 4(%ebp), %edx /* alen */
movl 12(%ebp), %ecx /* blen */
movl 16(%ebp), %edi /* diff */
subl %ecx,%edx
xorl %ebp,%ebp /* this also sets carry to 0 */
/* skip subraction if b is zero */
testl %ecx,%ecx
jz 2f
/* diff[0:blen-1],borrow = a[0:blen-1] - b[0:blen-1] */
1:
movl (%esi, %ebp, 4), %eax
sbbl (%ebx, %ebp, 4), %eax
movl %eax, (%edi, %ebp, 4)
incl %ebp
loop 1b
2:
incl %edx
movl %edx,%ecx
loop 3f
jmp 4f
/* diff[blen:alen-1] = a[blen:alen-1] - 0 */
3:
movl (%esi, %ebp, 4), %eax
sbbl $0, %eax
movl %eax, (%edi, %ebp, 4)
incl %ebp
loop 3b
4:
/* Postlude */
popl %edi
popl %esi
popl %ebx
popl %ebp
ret

View file

@ -1,60 +0,0 @@
/* mpvecsub(mpdigit *a, int alen, mpdigit *b, int blen, mpdigit *diff) */
/* diff[0:alen-1] = a[0:alen-1] - b[0:blen-1] */
/* prereq: alen >= blen, diff has room for alen digits */
/* (very old gnu assembler doesn't allow multiline comments) */
.text
.p2align 2,0x90
.globl mpvecsub
mpvecsub:
/* Prelude */
pushl %ebp /* save on stack */
pushl %ebx
pushl %esi
pushl %edi
leal 20(%esp), %ebp /* %ebp = FP for now */
movl 0(%ebp), %esi /* a */
movl 8(%ebp), %ebx /* b */
movl 4(%ebp), %edx /* alen */
movl 12(%ebp), %ecx /* blen */
movl 16(%ebp), %edi /* diff */
subl %ecx,%edx
xorl %ebp,%ebp /* this also sets carry to 0 */
/* skip subraction if b is zero */
testl %ecx,%ecx
jz _sub1
/* diff[0:blen-1],borrow = a[0:blen-1] - b[0:blen-1] */
_subloop1:
movl (%esi, %ebp, 4), %eax
sbbl (%ebx, %ebp, 4), %eax
movl %eax, (%edi, %ebp, 4)
incl %ebp
loop _subloop1
_sub1:
incl %edx
movl %edx,%ecx
loop _subloop2
jmp done
/* diff[blen:alen-1] = a[blen:alen-1] - 0 */
_subloop2:
movl (%esi, %ebp, 4), %eax
sbbl $0, %eax
movl %eax, (%edi, %ebp, 4)
incl %ebp
loop _subloop2
done:
/* Postlude */
popl %edi
popl %esi
popl %ebx
popl %ebp
ret

View file

@ -1,4 +0,0 @@
all:
%:V:
# nothing to see here

View file

@ -1,4 +0,0 @@
all:
%:V:
# nothing to see here

View file

@ -1,4 +0,0 @@
all:
%:V:
# nothing to see here

View file

@ -1,4 +0,0 @@
all:
%:V:
# nothing to see here

View file

@ -2,6 +2,6 @@
DIRS=\
port\
$OBJTYPE\
# $OBJTYPE\
<$PLAN9/src/mkdirs

View file

@ -34,8 +34,9 @@ FILES=\
mptouv\
ALLOFILES=${FILES:%=%.$O}
# cull things in the per-machine directories from this list
OFILES= `{sh ./reduce $O $OBJTYPE $ALLOFILES}
# # cull things in the per-machine directories from this list
# OFILES= `{sh ./reduce $O $ALLOFILES}
OFILES=$ALLOFILES
HFILES=\
$PLAN9/include/lib9.h\

View file

@ -1,4 +0,0 @@
all:
%:V:
# nothing to see here

View file

@ -1,4 +0,0 @@
all:
%:V:
# nothing to see here

View file

@ -1,4 +0,0 @@
all:
%:V:
# nothing to see here

View file

@ -1,4 +0,0 @@
all:
%:V:
# nothing to see here