david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[console] Avoid timer wraparound problems in getchar_timeout()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2011-03-07 17:40:12 +00:00
parent 9e98e4b9b8
commit 2969a8567f
1 changed files with 2 additions and 2 deletions

View File

@ -39,9 +39,9 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @ret character Character read from console
*/
int getchar_timeout ( unsigned long timeout ) {
unsigned long expiry = ( currticks() + timeout );
unsigned long start = currticks();
while ( currticks() < expiry ) {
while ( ( currticks() - start ) < timeout ) {
step();
if ( iskey() )
return getchar();