Kernel: Use vector<array<Module*>> instead of flat array

This made it much easier to debug an overflow
Kernel: Add bounds checking in register_for_event

This seems like a no-brainer. There really shouldn't be any
performance-sensitive code calling this.
Kernel: Add bounds checks to call_event

This might be a bit more controversial although honestly an inequality
check should be dirt cheap in terms of clock cycles