From 967b1248f82e5f64eab4dbf45898a37851b71fa2 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 27 Feb 2019 18:29:08 +0100 Subject: libip: move optimized 386 assembly version of ptclbsum() from kernel to libip --- sys/src/9/pc/pc | 2 +- sys/src/9/pc/ptclbsum386.s | 126 -------------------------------------------- sys/src/9/xen/mkfile | 3 -- sys/src/9/xen/xenpcf | 2 +- sys/src/libip/mkfile | 3 ++ sys/src/libip/ptclbsum386.s | 126 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 131 insertions(+), 131 deletions(-) delete mode 100644 sys/src/9/pc/ptclbsum386.s create mode 100644 sys/src/libip/ptclbsum386.s diff --git a/sys/src/9/pc/pc b/sys/src/9/pc/pc index 73c25d350..68e2e5e33 100644 --- a/sys/src/9/pc/pc +++ b/sys/src/9/pc/pc @@ -22,7 +22,7 @@ dev ether netif bridge netif log - ip arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium ptclbsum386 inferno + ip arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium inferno draw screen vga vgax swcursor mouse mouse diff --git a/sys/src/9/pc/ptclbsum386.s b/sys/src/9/pc/ptclbsum386.s deleted file mode 100644 index ba0a6a4d1..000000000 --- a/sys/src/9/pc/ptclbsum386.s +++ /dev/null @@ -1,126 +0,0 @@ -TEXT ptclbsum(SB), $0 - MOVL addr+0(FP), SI - MOVL len+4(FP), CX - - XORL AX, AX /* sum */ - - TESTL $1, SI /* byte aligned? */ - MOVL SI, DI - JEQ _2align - - DECL CX - JLT _return - - MOVB 0x00(SI), AH - INCL SI - -_2align: - TESTL $2, SI /* word aligned? */ - JEQ _32loop - - CMPL CX, $2 /* less than 2 bytes? */ - JLT _1dreg - SUBL $2, CX - - XORL BX, BX - MOVW 0x00(SI), BX - ADDL BX, AX - ADCL $0, AX - LEAL 2(SI), SI - -_32loop: - CMPL CX, $0x20 - JLT _8loop - - MOVL CX, BP - SHRL $5, BP - ANDL $0x1F, CX - -_32loopx: - MOVL 0x00(SI), BX - MOVL 0x1C(SI), DX - ADCL BX, AX - MOVL 0x04(SI), BX - ADCL DX, AX - MOVL 0x10(SI), DX - ADCL BX, AX - MOVL 0x08(SI), BX - ADCL DX, AX - MOVL 0x14(SI), DX - ADCL BX, AX - MOVL 0x0C(SI), BX - ADCL DX, AX - MOVL 0x18(SI), DX - ADCL BX, AX - LEAL 0x20(SI), SI - ADCL DX, AX - - DECL BP - JNE _32loopx - - ADCL $0, AX - -_8loop: - CMPL CX, $0x08 - JLT _2loop - - MOVL CX, BP - SHRL $3, BP - ANDL $0x07, CX - -_8loopx: - MOVL 0x00(SI), BX - ADCL BX, AX - MOVL 0x04(SI), DX - ADCL DX, AX - - LEAL 0x08(SI), SI - DECL BP - JNE _8loopx - - ADCL $0, AX - -_2loop: - CMPL CX, $0x02 - JLT _1dreg - - MOVL CX, BP - SHRL $1, BP - ANDL $0x01, CX - -_2loopx: - MOVWLZX 0x00(SI), BX - ADCL BX, AX - - LEAL 0x02(SI), SI - DECL BP - JNE _2loopx - - ADCL $0, AX - -_1dreg: - TESTL $1, CX /* 1 byte left? */ - JEQ _fold - - XORL BX, BX - MOVB 0x00(SI), BX - ADDL BX, AX - ADCL $0, AX - -_fold: - MOVL AX, BX - SHRL $16, BX - JEQ _swab - - ANDL $0xFFFF, AX - ADDL BX, AX - JMP _fold - -_swab: - TESTL $1, addr+0(FP) - /*TESTL $1, DI*/ - JNE _return - XCHGB AH, AL - -_return: - RET diff --git a/sys/src/9/xen/mkfile b/sys/src/9/xen/mkfile index e7bbe9503..4649210aa 100644 --- a/sys/src/9/xen/mkfile +++ b/sys/src/9/xen/mkfile @@ -128,9 +128,6 @@ REPCC=`{../port/mkfilelist ../pc} <../port/portmkfile <|../port/mkbootrules $CONF -ptclbsum386.$O: ../pc/ptclbsum386.s - $AS $AFLAGS ../pc/ptclbsum386.s - # we inherited these.. revisit. $ETHER: ../port/etherif.h ../port/netif.h $SDEV: ../port/sd.h diff --git a/sys/src/9/xen/xenpcf b/sys/src/9/xen/xenpcf index b6de0768d..a1d83cb02 100644 --- a/sys/src/9/xen/xenpcf +++ b/sys/src/9/xen/xenpcf @@ -20,7 +20,7 @@ dev xenstore ether netif - ip arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium ptclbsum386 inferno + ip arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium inferno sd diff --git a/sys/src/libip/mkfile b/sys/src/libip/mkfile index 5a63a01a7..47c25c4ea 100644 --- a/sys/src/libip/mkfile +++ b/sys/src/libip/mkfile @@ -24,3 +24,6 @@ UPDATE=\ ${LIB:/$objtype/%=/386/%}\