xen: fix build by adding missing rdrandbuf() function

This commit is contained in:
cinap_lenrek 2016-12-14 20:02:07 +01:00
parent 6cbc226351
commit 052abe1cc8
2 changed files with 33 additions and 0 deletions

View file

@ -102,6 +102,7 @@ int wrmsr(int, vlong);
uint xchgl(uint*, uint);
uint xchgw(ushort*, uint);
uint xchgb(uchar*, uint);
void rdrandbuf(void*, ulong);
#define waserror() (up->nerrlab++, setlabel(&up->errlab[up->nerrlab-1]))
#define KADDR(a) ((void*)((ulong)(a)|KZERO))

View file

@ -296,6 +296,38 @@ TEXT mul64fract(SB), $0
ADCL BX, 4(CX) /* r2 += carry */
RET
#define RDRANDAX BYTE $0x0f; BYTE $0xc7; BYTE $0xf0
TEXT rdrand32(SB), $-4
_rloop32:
RDRANDAX
JCC _rloop32
RET
TEXT rdrandbuf(SB), $0
MOVL buf+0(FP), DI
MOVL cnt+4(FP), CX
CLD
MOVL CX, DX
SHRL $2, CX
CMPL CX, $0
JE _rndleft
_rnddwords:
CALL rdrand32(SB)
STOSL
LOOP _rnddwords
_rndleft:
MOVL DX, CX
ANDL $3, CX
CMPL CX, $0
JE _rnddone
_rndbytes:
CALL rdrand32(SB)
STOSB
LOOP _rndbytes
_rnddone:
RET
/*
* label consists of a stack pointer and a PC
*/