mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-18 23:54:26 +08:00
1da177e4c3
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
46 lines
903 B
ArmAsm
46 lines
903 B
ArmAsm
/*
|
|
* Returns 0 if exception before NUL or reaching the supplied limit (N),
|
|
* a value greater than N if the string is longer than the limit, else
|
|
* strlen.
|
|
*
|
|
* Inputs:
|
|
* in0: address of buffer
|
|
* in1: string length limit N
|
|
* Outputs:
|
|
* r8: 0 in case of fault, strlen(buffer)+1 otherwise
|
|
*
|
|
* Copyright (C) 1999, 2001 David Mosberger-Tang <davidm@hpl.hp.com>
|
|
*/
|
|
|
|
#include <asm/asmmacro.h>
|
|
|
|
GLOBAL_ENTRY(__strnlen_user)
|
|
.prologue
|
|
alloc r2=ar.pfs,2,0,0,0
|
|
.save ar.lc, r16
|
|
mov r16=ar.lc // preserve ar.lc
|
|
|
|
.body
|
|
|
|
add r3=-1,in1
|
|
;;
|
|
mov ar.lc=r3
|
|
mov r9=0
|
|
;;
|
|
// XXX braindead strlen loop---this needs to be optimized
|
|
.Loop1:
|
|
EXCLR(.Lexit, ld1 r8=[in0],1)
|
|
add r9=1,r9
|
|
;;
|
|
cmp.eq p6,p0=r8,r0
|
|
(p6) br.cond.dpnt .Lexit
|
|
br.cloop.dptk.few .Loop1
|
|
|
|
add r9=1,in1 // NUL not found---return N+1
|
|
;;
|
|
.Lexit:
|
|
mov r8=r9
|
|
mov ar.lc=r16 // restore ar.lc
|
|
br.ret.sptk.many rp
|
|
END(__strnlen_user)
|