mirror of
https://github.com/ipxe/ipxe
synced 2025-12-15 00:12:19 +03:00
[console] Avoid timer wraparound problems in getchar_timeout()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user