Don't calculate NextElement twice.
Properly initialize the keyboard buffer head and tail.


svn path=/trunk/; revision=63302
This commit is contained in:
Aleksandar Andrejevic 2014-05-14 20:56:21 +00:00
parent 3ed2e2a095
commit 5f6ac9ac39

View file

@ -39,14 +39,7 @@ static BOOLEAN BiosKbdBufferPush(WORD Data)
/* Put the value in the queue */ /* Put the value in the queue */
*((LPWORD)((ULONG_PTR)Bda + Bda->KeybdBufferTail)) = Data; *((LPWORD)((ULONG_PTR)Bda + Bda->KeybdBufferTail)) = Data;
Bda->KeybdBufferTail += sizeof(WORD); Bda->KeybdBufferTail = NextElement;
/* Check if we are at, or have passed, the end of the buffer */
if (Bda->KeybdBufferTail >= Bda->KeybdBufferEnd)
{
/* Return it to the beginning */
Bda->KeybdBufferTail = Bda->KeybdBufferStart;
}
/* Return success */ /* Return success */
return TRUE; return TRUE;
@ -271,7 +264,7 @@ BOOLEAN KbdBios32Initialize(VOID)
/* Initialize the BDA */ /* Initialize the BDA */
Bda->KeybdBufferStart = FIELD_OFFSET(BIOS_DATA_AREA, KeybdBuffer); Bda->KeybdBufferStart = FIELD_OFFSET(BIOS_DATA_AREA, KeybdBuffer);
Bda->KeybdBufferEnd = Bda->KeybdBufferStart + BIOS_KBD_BUFFER_SIZE * sizeof(WORD); Bda->KeybdBufferEnd = Bda->KeybdBufferStart + BIOS_KBD_BUFFER_SIZE * sizeof(WORD);
Bda->KeybdBufferHead = Bda->KeybdBufferTail = 0; Bda->KeybdBufferHead = Bda->KeybdBufferTail = Bda->KeybdBufferStart;
// FIXME: Fill the keyboard buffer with invalid values, for diagnostic purposes... // FIXME: Fill the keyboard buffer with invalid values, for diagnostic purposes...
RtlFillMemory(((LPVOID)((ULONG_PTR)Bda + Bda->KeybdBufferStart)), BIOS_KBD_BUFFER_SIZE * sizeof(WORD), 'A'); RtlFillMemory(((LPVOID)((ULONG_PTR)Bda + Bda->KeybdBufferStart)), BIOS_KBD_BUFFER_SIZE * sizeof(WORD), 'A');