Xref: news-dnh.mv.net comp.os.msdos.djgpp:2689 Newsgroups: comp.os.msdos.djgpp Path: news-dnh.mv.net!mv!news.sprintlink.net!in1.uu.net!pipeline!psinntp!psinntp!psinntp!netrixgw.netrix.com!root From: ld AT jasmine DOT netrix DOT com (Long Doan) Subject: Re: Wrapper functions?? Lines: 45 Sender: root AT netrix DOT com Organization: Netrix Corporation References: <45mo1g$eth AT nic-nac DOT CSU DOT net> Date: Mon, 16 Oct 1995 17:15:24 GMT To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp In article <45mo1g$eth AT nic-nac DOT CSU DOT net> svincent AT zippy DOT sonoma DOT edu (Sam Vincent) writes: > Hi all, > > What exactly do the interrupt handling wrapper functions do... > I've been told they take a large chunk of runtime to process and > that I should write my own assembly functions.. Well Ive done that > and I save/restore eax, ebx, ecx, and edx and a iret at the end... [snip] The wrapper functions do the following: 1. When the ..._alocate_wrapper_... functions are called, they'll: a. Write necessary values (%ds, stack, etc) to the wrapper. b. (Future, v2.xxx+) lock some of your handler's code, stack, etc. 2. Save ALL registers (%e[abcd]x, %esi, %edi, [defg]s) 3. Switch to a (probably locked) new stack. 4. Set %[defg]s to known value. This value is taken from step 1. 5. Call the given function. 6. Restore all registers to their original values. 7. iret. If you want to write a handler that doesn't need a wrapper, you should: 1. Lock the function's code and possibly data. 2. (Optional) Alocate and lock a small stack. 3. In the handler itself, do the following: a. Save only the necessary registers. b. (Optional) Switch stack. b. If you need to access the program's data, set %ds to your program's %ds. ..... c. Restore the modified regiters. d. iret. Hope that helps, Long. -- ============================================================== Long Doan ld AT netrix DOT com Netrix Corporation ldoan1 AT osf1 DOT gmu DOT edu 13595 Dulles Technology Drive Herndon Va 22071 ==============================================================