Here is another technical question about the Linux kernel. Context
switching in particular.
I have examined the task switch macro 'switch_to' in sched.h and have some
difficulty comprehending what exactly is happening. Part of my problem is
deciphering the assembler syntax and how operands are being used (GNU RTL
syntax).
I believe, that after checking that the requested task is not the current
one, the code makes a far jump to the TASK STATE SEGMENT of the desired
process. (Jumping/calling a task state segment or gate should result
in a task switch.) My lack of understanding, partly due to syntax , is
figuring out what is in operand %0 (is it the the contents of __tmp with
the upper 32 bits (__tmp.b) set to _TSS(n), the lower 16bits of which will
select a task state segment descriptor in the GDT ?)
Also, how does the line with '_last_task_used_math' ever get executed ?
I assume it has to do with checking for which process last executed
instructions with the floating point coprocessor (387) ?
Below is the actual GNU C define macro in case anyone wishes to explain
how it works:
#define switch_to(n) {\
struct {long a,b;} __tmp;\
__asm__("cmpl %%ecx,_current\n\t"\
"je 1f\n\t
"movw %%dx, %1\n\t"\
"xchgl %%ecx,_current\n\t"\
"ljmp %0\n\t"\
"cmpl %%ecx,_last_task_used_math\n\t"\
"jne 1f\n\t"\
"clts\n"\
"1:"\
"::"m" (*&__tmp.a),"m" (*&__tmp.b), \
"d" (_TSS(n)), "c" ((long) task[n]) \
:"cx");\
}
Thank you very appreciatively!
Ron Prediger.
| Linus Torvalds | Linux 2.6.27-rc8 |
| Jared Hulbert | [PATCH 00/10] AXFS: Advanced XIP filesystem |
| Eric Paris | Re: [malware-list] [RFC 0/5] [TALPA] Intro to a linux interface for on access scan... |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
git: | |
| Jakub Narebski | Re: VCS comparison table |
| Junio C Hamano | Re: [PATCH 0/2] Making "git commit" to mean "git commit -a". |
| Toby White | Using Filemerge.app as a git-diff viewer |
| Ismail | Re: [ANNOUNCE] GIT 1.5.3-rc4 |
| Leon Dippenaar | New tcp stack attack |
| Richard Stallman | Real men don't attack straw men |
| Predrag Punosevac | Skype on the OpenBSD |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Hugh Dickins | Re: [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Jon Smirl | e1000 tcp checksum incorrect, x86 64b |
| David Miller | [GIT]: Networking |
