|
|
1.1 ! root 1: / SCO's memmove() function in the 3.2v2 development system libc.a ! 2: / library has an insidious bug: it trashes the EBX register. This ! 3: / register is used to hold register variables. I suspect the bug crept ! 4: / in due to a simple-minded translation of a '286 routine, because on ! 5: / the '286, BX need not be preserved. ! 6: / ! 7: / The fix is to replace memmove.o in /lib/libc.a with the version ! 8: / included below. Note that if you use profiling, you must also put a ! 9: / profiling version of memmove() in /usr/lib/libp/libc.a. ! 10: / ! 11: / To assemble the non-profiling version: ! 12: / ! 13: / as -m -o memmove.o memmove.s ! 14: / ! 15: / To assemble the profiling verson: ! 16: / ! 17: / as -m -o memmove_p.o profile.s memmove.s ! 18: / ! 19: / where the file profile.s contains the following single line: ! 20: / ! 21: / define(`PROFILE',``PROFILE'') ! 22: / ! 23: / (How strange that this bug has gone unnoticed for so long...) ! 24: ! 25: / $Id: memmove.s,v 1.3 1991/06/05 19:15:44 chip Exp $ ! 26: / ! 27: / Implementation of memmove(), which is inexplicably missing ! 28: / from the SCO Unix C library. ! 29: / ! 30: ! 31: .globl memmove ! 32: memmove: ! 33: ifdef(`PROFILE',` ! 34: .bss ! 35: .L1: .=.+4 ! 36: .text ! 37: mov $.L1,%edx ! 38: .globl _mcount ! 39: call _mcount ! 40: ') ! 41: push %edi ! 42: push %esi ! 43: mov 12(%esp),%edi ! 44: mov 16(%esp),%esi ! 45: mov 20(%esp),%ecx ! 46: mov %edi,%eax / return value: dest ! 47: jcxz mm_exit ! 48: ! 49: mov %edi,%edx ! 50: sub %esi,%edx ! 51: jb mm_simple ! 52: cmp %edx,%ecx ! 53: jb mm_simple ! 54: ! 55: add %ecx,%edi ! 56: dec %edi ! 57: add %ecx,%esi ! 58: dec %esi ! 59: std ! 60: rep; movsb ! 61: cld ! 62: jmp mm_exit ! 63: ! 64: mm_simple: ! 65: cld ! 66: mov %ecx,%edx ! 67: shr $2,%ecx ! 68: rep; movs ! 69: mov %edx,%ecx ! 70: and $3,%ecx ! 71: rep; movsb ! 72: ! 73: mm_exit: ! 74: pop %esi ! 75: pop %edi ! 76: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.