Question

I’m in a strange situation I have coded myself into, trapped! I am taking an OS course where we are writing a non-preemptive scheduler, i am in a situation where I need to make some easy calculation about time measurement in a context switch.

For my average calculation I am in need for division with decimals, my code now calls a C function from assembler for the calculation and prints the result to screen, this C function uses double, later i realized that double division will cause changes to the x87 registers because the get_time(C function) function is called right before the context switching and right after. Is there a way to do decimal division avoiding changes to x87 registers? I sorely need some tips and help.

No correct solution

OTHER TIPS

I don't have much skills in asm and registers uses, but maybe :

  • what if you push your register and pop it at the end ?
  • You said that double division change to the x87 registers, what about float ?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top