git://scm.lunaixsky.com
/
lunaix-os.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
aa64: finalise context switch, page fault handler and syscall
[lunaix-os.git]
/
lunaix-os
/
arch
/
aarch64
/
klibc
/
crc.c
1
#include <lunaix/types.h>
2
#include <klibc/crc.h>
3
4
unsigned int
5
crc32b(unsigned char* data, unsigned int size)
6
{
7
unsigned int register ret asm("x0");
8
9
asm volatile(
10
"1: \n"
11
"ldrb x2, [%[dest], %[l]] \n"
12
"crc32b %0, %0, x2 \n"
13
"sub %[l], %[l], %1 \n"
14
"cbnz %[l], 1b \n"
15
:
16
"=r"(ret)
17
:
18
"I"(1),
19
[dest] "r"(data),
20
[l] "r"(size)
21
: "x2"
22
);
23
24
return ret;
25
}