TSS and context switch

hjl@lucon.org
Fri, 15 Jan 1999 11:28:56 -0600


------------------------------------------------------------------------------

This message was forwarded to you from Deja News by hjl@lucon.org.
Deja News, the discussion network, offers free web-based access to more than
50,000 high-quality discussion forums. Come and visit us on the web at
http://www.dejanews.com/=zzz_maf/

------------------------------------------------------------------------------

Join and get 4 bestselling audiobooks 1c
http://www.audiobookclub.com/micro/home.asp?AID=S036L004B009

------------------------------------------------------------------------------

(beginning of original message)

Subject: TSS and context switch
From: bf20761@binghamton.edu (zhihuizhang)
Date: 1999/01/15
Newsgroups: mailing.freebsd.hackers

Hi, I am a little surprised to see that the TSS mechanism is not used in
context switch done by FreeBSD. In cpu_switch(), we save the return
address (the one immediately follows the cpu_switch() call) of the current
process. We do not jump to a TSS selector (like in SCO UNIX) to do a
context switch. I am wondering why FreeBSD does not use the underlying
hardware feature which provides a clean separation between tasks
(processes) and does so in an efficient way (I assume that hardware is
always faster than software when doing the same job). Although we use the
same format (see tss.h) as that defined by hardware, we save and restore
registers "manually".

Also, please confirm my understanding: any process calling cpu_switch()
will resume execution *right after* the cpu_switch() call. We achieve
this by modifing the stack before the instruction ret:

movl PCB_EIP(%edx), %eax <-- at the end of cpu_switch()
movl %eax, (%esp)
....
ret

By the way, the only place I find the TSS mechanism is used in FreeBSD is
the double fault handling, where a task gate is put into the IDT.

Any help is appreciated.

--------------------------------------------------
| Zhihui Zhang, http://cs.binghamton.edu/~zzhang |
| Dept. of Computer Science, SUNY at Binghamton |
--------------------------------------------------

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message

(end of original message)
------------------------------------------------------------------------------

You can view this message and the related discussion by following this link:
http://www.dejanews.com/=zzz_maf/dnquery.xp?search=thread&svcclass=dnserver&recnum=%3c77ln96$1nl$1@FreeBSD.csie.NCTU.edu.tw%3e%231/1
We hope to see you soon at Deja News, the discussion network.
http://www.dejanews.com/=zzz_maf/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/