2009-06-23 12:54:23 -06:00
|
|
|
// Inferno's libkern/memset-arm.s
|
2016-08-28 18:04:46 -06:00
|
|
|
// https://bitbucket.org/inferno-os/inferno-os/src/default/libkern/memset-arm.s
|
2009-06-23 12:54:23 -06:00
|
|
|
//
|
2016-03-01 16:21:55 -07:00
|
|
|
// Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
|
2009-06-23 12:54:23 -06:00
|
|
|
// Revisions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com). All rights reserved.
|
|
|
|
// Portions Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
|
|
// in the Software without restriction, including without limitation the rights
|
|
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
|
|
// furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
// THE SOFTWARE.
|
|
|
|
|
2014-09-04 21:05:18 -06:00
|
|
|
#include "textflag.h"
|
2013-08-07 13:20:05 -06:00
|
|
|
|
2015-02-13 15:21:18 -07:00
|
|
|
#define TO R8
|
|
|
|
#define TOE R11
|
|
|
|
#define N R12
|
|
|
|
#define TMP R12 /* N and TMP don't overlap */
|
2012-06-24 15:59:50 -06:00
|
|
|
|
2016-10-17 16:41:56 -06:00
|
|
|
TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-8
|
2015-02-13 15:21:18 -07:00
|
|
|
MOVW ptr+0(FP), TO
|
|
|
|
MOVW n+4(FP), N
|
|
|
|
MOVW $0, R0
|
2009-06-23 12:54:23 -06:00
|
|
|
|
2015-02-13 15:21:18 -07:00
|
|
|
ADD N, TO, TOE /* to end pointer */
|
2009-06-23 12:54:23 -06:00
|
|
|
|
2015-02-13 15:21:18 -07:00
|
|
|
CMP $4, N /* need at least 4 bytes to copy */
|
2009-06-23 12:54:23 -06:00
|
|
|
BLT _1tail
|
|
|
|
|
|
|
|
_4align: /* align on 4 */
|
2015-02-13 15:21:18 -07:00
|
|
|
AND.S $3, TO, TMP
|
2009-06-23 12:54:23 -06:00
|
|
|
BEQ _4aligned
|
|
|
|
|
2015-02-13 15:21:18 -07:00
|
|
|
MOVBU.P R0, 1(TO) /* implicit write back */
|
2009-06-23 12:54:23 -06:00
|
|
|
B _4align
|
|
|
|
|
|
|
|
_4aligned:
|
2015-02-13 15:21:18 -07:00
|
|
|
SUB $31, TOE, TMP /* do 32-byte chunks if possible */
|
|
|
|
CMP TMP, TO
|
2009-06-23 12:54:23 -06:00
|
|
|
BHS _4tail
|
|
|
|
|
2012-06-24 15:59:50 -06:00
|
|
|
MOVW R0, R1 /* replicate */
|
|
|
|
MOVW R0, R2
|
|
|
|
MOVW R0, R3
|
|
|
|
MOVW R0, R4
|
|
|
|
MOVW R0, R5
|
|
|
|
MOVW R0, R6
|
|
|
|
MOVW R0, R7
|
2009-06-23 12:54:23 -06:00
|
|
|
|
|
|
|
_f32loop:
|
2015-02-13 15:21:18 -07:00
|
|
|
CMP TMP, TO
|
2009-06-23 12:54:23 -06:00
|
|
|
BHS _4tail
|
|
|
|
|
2015-02-13 15:21:18 -07:00
|
|
|
MOVM.IA.W [R0-R7], (TO)
|
2009-06-23 12:54:23 -06:00
|
|
|
B _f32loop
|
|
|
|
|
|
|
|
_4tail:
|
2015-02-13 15:21:18 -07:00
|
|
|
SUB $3, TOE, TMP /* do remaining words if possible */
|
2009-06-23 12:54:23 -06:00
|
|
|
_4loop:
|
2015-02-13 15:21:18 -07:00
|
|
|
CMP TMP, TO
|
2009-06-23 12:54:23 -06:00
|
|
|
BHS _1tail
|
|
|
|
|
2015-02-13 15:21:18 -07:00
|
|
|
MOVW.P R0, 4(TO) /* implicit write back */
|
2009-06-23 12:54:23 -06:00
|
|
|
B _4loop
|
|
|
|
|
|
|
|
_1tail:
|
2015-02-13 15:21:18 -07:00
|
|
|
CMP TO, TOE
|
2009-06-23 12:54:23 -06:00
|
|
|
BEQ _return
|
|
|
|
|
2015-02-13 15:21:18 -07:00
|
|
|
MOVBU.P R0, 1(TO) /* implicit write back */
|
2009-06-23 12:54:23 -06:00
|
|
|
B _1tail
|
|
|
|
|
|
|
|
_return:
|
|
|
|
RET
|