kernel: change peek to return number of characters left rather than 0/-1
This commit is contained in:
parent
cc066d8130
commit
a6517fb498
5 changed files with 3 additions and 7 deletions
|
@ -513,13 +513,13 @@ TEXT _wrmsrinst(SB), $0
|
|||
|
||||
/* fault-proof memcpy */
|
||||
TEXT peek(SB), $0
|
||||
MOVL $0, AX /* AX set to -1 if traped */
|
||||
MOVL src+0(FP), SI
|
||||
MOVL dst+4(FP), DI
|
||||
MOVL cnt+8(FP), CX
|
||||
CLD
|
||||
TEXT _peekinst(SB), $0
|
||||
REP; MOVSB
|
||||
MOVL CX, AX
|
||||
RET
|
||||
|
||||
/*
|
||||
|
|
|
@ -481,7 +481,6 @@ trap(Ureg* ureg)
|
|||
}
|
||||
} else if(pc == _peekinst){
|
||||
if(vno == VectorGPF){
|
||||
ureg->ax = -1;
|
||||
ureg->pc += 2;
|
||||
return;
|
||||
}
|
||||
|
@ -722,7 +721,6 @@ fault386(Ureg* ureg, void*)
|
|||
{
|
||||
extern void _peekinst(void);
|
||||
if((void(*)(void))ureg->pc == _peekinst){
|
||||
ureg->ax = -1;
|
||||
ureg->pc += 2;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -451,13 +451,13 @@ TEXT _wrmsrinst(SB), $0
|
|||
|
||||
/* fault-proof memcpy */
|
||||
TEXT peek(SB), 1, $-4
|
||||
MOVQ $0, AX
|
||||
MOVQ RARG, SI
|
||||
MOVQ dst+8(FP), DI
|
||||
MOVL cnt+16(FP), CX
|
||||
CLD
|
||||
TEXT _peekinst(SB), $0
|
||||
REP; MOVSB
|
||||
MOVL CX, AX
|
||||
RET
|
||||
|
||||
|
||||
|
|
|
@ -451,7 +451,6 @@ trap(Ureg *ureg)
|
|||
}
|
||||
} else if(pc == _peekinst){
|
||||
if(vno == VectorGPF){
|
||||
ureg->ax = -1;
|
||||
ureg->pc += 2;
|
||||
return;
|
||||
}
|
||||
|
@ -683,7 +682,6 @@ faultamd64(Ureg* ureg, void*)
|
|||
extern void _peekinst(void);
|
||||
|
||||
if((void(*)(void))ureg->pc == _peekinst){
|
||||
ureg->ax = -1;
|
||||
ureg->pc += 2;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -529,5 +529,5 @@ dtpeek(uvlong addr, void *buf, int len)
|
|||
if(len == 0) return 0;
|
||||
if(a != addr || a > -(uintptr)len || len < 0) return -1;
|
||||
if(up == nil || up->privatemem || a >= KZERO) return -1;
|
||||
return peek((void *)a, buf, len);
|
||||
return peek((void *)a, buf, len) > 0 ? -1 : 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue