failing like never before

25Jun/080

Make Me a Syscall

I was working on a assembly language project for my computer science class one night, and was having a devil of a time debugging it. The program was supposed to read data from a file using system calls (syscalls) (and then do some more stuff) but for some reason, my program refused to read data from file. I spent over an hour tracing through my code, trying to find the probably obvious bug. My code around the "bug" looked a little like this:

...
move   $a0,$s0
move   $a1,$s1
li          $v0,14
...

I realize its a little hard to understand out of context, but what happened was that I set up all the registers properly but never actually made a syscall!

The corrected code looked like this:

...
move $a0,$s0
move $a1,$s1
li $v0,14
syscall
...

Duuuh....

By this time I was feeling pretty sleepy, so I brushed my teeth and climbed into bed (and by "climb" I do mean climb, I really do hate bunk beds now). I had some problems falling asleep; my brain was buzzing with random thoughts and I couldn't seem to quash them. Eventually I started to feel my mind grow even dumber as I slipped into la-la-land, but then suddenly I was struck by a sudden epiphany. A little voice in my mind screamed "you can't go to sleep, because you forgot to make a syscall!" I awoke fully then, realized how stupid a thought that was, mumbled "syscall" outloud, and then promptly fell asleep.

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


Security Code:

Trackbacks are disabled.