i386 switch_to() question...

Michael Nelson (mikenel@netcom.com)
Sat, 22 Jul 1995 20:58:01 -0700 (PDT)


(I will be looking for 386 books tomorrow<g>)

[snip]

#define switch_to(tsk) do { \
__asm__("cli\n\t" \
"xchgl %%ecx,_current\n\t" \
"ljmp %0\n\t" \
"sti\n\t" \
"cmpl %%ecx,_last_task_used_math\n\t" \
"jne 1f\n\t" \
"clts\n" \
"1:" \
: /* no output */ \
:"m" (*(((char *)&tsk->tss.tr)-4)), \
"c" (tsk) \
:"cx"); \

[etc...]

I am thrououghly confused as to why the kernel is "ljmp"ing to (tss.tr)-4
(if I am interpreting this correctly).

1) Where is it going?
2) What is "tr"? My first guess was "task register" -- but I am just
confused now.

I have been trying to compare Linux's switch to the 4.4BSD-Lite (BSDI)
switch to try to understand what is going on -- but they are radically
different (BSD's is a lot more involved).

-- Mike

--
Michael Nelson (mikenel@netcom.com) | Real programmers don't comment their
Rockville, Maryland                 | code. It was hard to write, it should
BSD/OS, WinNT, OLE2 Development     | be hard to understand.