As I can find on the net int 0x80 is a system call in Linux on x86. Depending on what call you make it expects the correct parameters to be provided on the stack and in certain registers. I.e. for one type of call there should be 2 pushes and for another type of call there should be none.
I don't enough about this to tell you exactly why it segfaults but if you find out what call it is it should be obvious.
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan