Why IA 32 tasks are non-reentrant

127 views Asked by At

I have a question about IA32 tasks.

A TSS allows only one context to be saved for a task; therefore, once a task is called(dispatched), a recursive (or re-entrant) call to the task would cause the current state of the task to be lost.

I simply don't understand why tasks are non-reentrant in IA 32. If you have a task running and then you do a jmp far using the tss segment selector of the actual task, the current state of the task will be saved in the tss. Then it will search for the tss descriptor, and load the state that has been previously saved. So, the EIP woulb point to the next instruction,etc. What is wrong with this reasoning?

I understand how the busy bit works, but not the reason why they forbid calling the same task. I notice that if you have a chain of nested task, and then one calls itself, it will create a sort of loop because the previous task link of the tss will be itself.

1

There are 1 answers

0
atwww On

Recently, I have been reading the Intel IA-32 Developer Manual. My unserstanding about non recursive call of IA-32 tasks is:

  • A TSS can only save one status for one task.
  • Assuming that a task can be called recursively, this certain task should be divided into past-tense and present-tense.
  • During task switching, the past-tense task's status will be saved into TSS.
  • The present-tense task will also retrieve the state from the same TSS.
  • The present-tense task has been executed and the state of the CPU registers has been significantly changed.
  • After completing the present-tense task, according to the logic of task switching, the CPU should return to the execution state of the past-tense task through the back link in the TSS of the present-tense task.
  • However, since the past-tense and the present-tense tasks are the same task, their states exist in the same TSS.
  • Therefore, the TSS only saves the state of the present-tense task, making it impossible to return to the state of the past-tense task.
  • IA-32 blocks recursive calls to a certain task through the BUSY bit in the TSS descriptor.