Might help to see all your code. Do you send an EOI, do you properly save and restore the required registers when your interrupts run. Do you have the exact same output every time you run it or does it differ each time? I also have a potential concern about this
Code:
cmdchar(kbdus[scancode]);
. It suggests you are doing command processing inside an interrupt handler. You shouldn't do that. You could create a keyboard buffer that you populate with keystrokes and your kernel could sit in a HLT loop waiting for interrupts and processing keystrokes from the buffer. This keeps the main command processing out of the interrupt handler itself.