11.10Sriastrad/* $NetBSD: skpc.S,v 1.10 2014/03/18 18:20:43 riastradh Exp $ */ 21.2Scgd 31.1Scgd/* 41.6Srmind * Copyright (c) 1988 University of Utah. 51.1Scgd * Copyright (c) 1980, 1990 The Regents of the University of California. 61.1Scgd * All rights reserved. 71.4Sagc * 81.4Sagc * This code is derived from software contributed to Berkeley by 91.4Sagc * the Systems Programming Group of the University of Utah Computer 101.4Sagc * Science Department. 111.4Sagc * 121.4Sagc * Redistribution and use in source and binary forms, with or without 131.4Sagc * modification, are permitted provided that the following conditions 141.4Sagc * are met: 151.4Sagc * 1. Redistributions of source code must retain the above copyright 161.4Sagc * notice, this list of conditions and the following disclaimer. 171.4Sagc * 2. Redistributions in binary form must reproduce the above copyright 181.4Sagc * notice, this list of conditions and the following disclaimer in the 191.4Sagc * documentation and/or other materials provided with the distribution. 201.4Sagc * 3. Neither the name of the University nor the names of its contributors 211.4Sagc * may be used to endorse or promote products derived from this software 221.4Sagc * without specific prior written permission. 231.4Sagc * 241.4Sagc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251.4Sagc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261.4Sagc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271.4Sagc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281.4Sagc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291.4Sagc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301.4Sagc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311.4Sagc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321.4Sagc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331.4Sagc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341.4Sagc * SUCH DAMAGE. 351.4Sagc * 361.4Sagc * from: Utah Hdr: locore.s 1.58 91/04/22 371.4Sagc * @(#)locore.s 7.11 (Berkeley) 5/9/91 381.4Sagc */ 391.4Sagc 401.1Scgd#include "DEFS.h" 411.1Scgd 421.1Scgd/* 431.1Scgd * Emulate fancy VAX string operations: 441.1Scgd * skpc(mask, count, startc) 451.1Scgd */ 461.1ScgdENTRY(skpc) 471.7Smatt movl 8(%sp),%d0 | get length 481.1Scgd jeq Lskdone | nothing to do, return 491.7Smatt movb 7(%sp),%d1 | mask to use 501.7Smatt movl 12(%sp),%a0 | where to start 511.9Smatt#ifndef __mcoldfire__ 521.3Sthorpej subqw #1,%d0 | adjust for dbcc 531.9Smatt#endif 541.1ScgdLskloop: 551.8Smatt cmpb (%a0)+,%d1 | compare with mask 561.9Smatt#ifdef __mcoldfire__ 571.9Smatt jne Lskdone | keep going til no more or zero 581.9Smatt subql #1,%d0 591.9Smatt jne Lskloop 601.9Smatt#else 611.3Sthorpej dbne %d0,Lskloop | keep going til no more or zero 621.3Sthorpej addqw #1,%d0 | overshot by one 631.9Smatt#endif 641.1ScgdLskdone: 651.1Scgd rts 66