6809: add mulhi
authorAlan Cox <alan@etchedpixels.co.uk>
Thu, 27 Nov 2014 01:04:02 +0000 (01:04 +0000)
committerAlan Cox <alan@etchedpixels.co.uk>
Thu, 27 Nov 2014 01:04:02 +0000 (01:04 +0000)
We need this for load average computation

Kernel/lowlevel-6809.s

index bf55c3e..2fdd9bb 100644 (file)
@@ -12,6 +12,7 @@
        .globl  _euclid
        .globl  _udivhi3
        .globl  _umodhi3
+       .globl  _mulhi3
 
        ; debugging aids
        .globl outcharhex
@@ -462,3 +463,23 @@ mod3:
        bne     mod1
        leas    3,s
        rts
+
+_mulhi3:
+       pshs    x
+       lda   5,s   ; left msb * right lsb * 256
+       ldb   ,s
+       mul
+       tfr   b,a
+       clrb
+       tfr   d,x
+       ldb   1,s   ; left lsb * right msb * 256
+       lda   4,s
+       mul
+       tfr   b,a
+       clrb
+       leax  d,x
+       ldb   1,s   ; left lsb * right lsb
+       lda   5,s
+       mul
+       leax  d,x
+       puls    d,pc  ; kill D to remove initial push