Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Somehow, calling memmove to scroll the terminal ends up dereferencing some value in the first page of memory, which I deliberately leave unpaged. A page fault occurs.
The multiplication operator has higher precedence than the subtraction operator. You need parentheses to perform the subtraction before the multiplication.
I didn't see that, thanks. Still, the problem occurs in the memmove. Looking at the stack trace in GDB, the parameters are clearly trashed. Perhaps improperly returning from the page fault handler messed up the stack.