sm common code
sm modules are loaded to 0x80B000, then code from that addr is executed.
There is a lot of common code shared between sm: entry, cmd handler, cmd setup, etc
This is the first code executed in sm. It's located at 0x80B000. It does the following:
- Get random value (stack cookie?)
- syscall 1: Unload
- while(1) sleep()
These just call function pointers, basically libc_init_array.
It has a memory pool allocated on stack. It's filled with structures for command handlers. Then, it calls main_loop.
This uses syscall 4 (RegisterIrqHandler) to register a common handler for incoming commands. Then it loops while sm is "active". Then it sets handler for commands = null pointer.