User Mode Syscall

I’ve got a rough idea on how to implement a syscall for using while in user mode, but I’m not 100% sure.
I plan on using a public function syscall() which will do…

1.  save all of the cpu registers by pushing them onto the stack
2. load any parameters I want to use in my trap handler into a0-a7
3.ECALL
`Trap Handler()`
4. Handle syscall in m-mode
5. pop cpu registers off of stack and restore
6. increment pc by 4 to jump pass the original ECALL
7.set MEPC
8. MRET

Does that make sense, am I missing anything?
One of my goals is to use this to print something over UART from u-mode via a syscall.

Acutally, instead of pushing to a stack, I think I will save the cpu registers in a structure. Also, I think my order of operations is wrong. I shouldn’t save the the cpu regs until after the ecall? @alistair23