1/* SPDX-License-Identifier: GPL-2.0 */ 2/* memset.S */ 3 4#include <asm/linkage.h> 5 6#if defined(CONFIG_CPU_H8300H) 7 .h8300h 8#endif 9#if defined(CONFIG_CPU_H8S) 10 .h8300s 11#endif 12 .text 13 14.global memset 15.global clear_user 16 17;;void *memset(*ptr, int c, size_t count) 18;; ptr = er0 19;; c = er1(r1l) 20;; count = er2 21memset: 22 btst #0,r0l 23 beq 2f 24 25 ;; odd address 261: 27 mov.b r1l,@er0 28 adds #1,er0 29 dec.l #1,er2 30 beq 6f 31 32 ;; even address 332: 34 mov.l er2,er3 35 cmp.l #4,er2 36 blo 4f 37 ;; count>=4 -> count/4 38#if defined(CONFIG_CPU_H8300H) 39 shlr.l er2 40 shlr.l er2 41#endif 42#if defined(CONFIG_CPU_H8S) 43 shlr.l #2,er2 44#endif 45 ;; byte -> long 46 mov.b r1l,r1h 47 mov.w r1,e1 483: 49 mov.l er1,@er0 50 adds #4,er0 51 dec.l #1,er2 52 bne 3b 534: 54 ;; count % 4 55 and.b #3,r3l 56 beq 6f 575: 58 mov.b r1l,@er0 59 adds #1,er0 60 dec.b r3l 61 bne 5b 626: 63 rts 64 65clear_user: 66 mov.l er1, er2 67 sub.l er1, er1 68 bra memset 69 70 .end 71