Date: Fri, 22 Aug 1997 10:01:57 +1100 From: Bill Currie Subject: Re: Function Sizes (how to in asm?) In-reply-to: To: Shawn Hargreaves , djgpp AT delorie DOT com Message-id: <199708212206.KAA25797@teleng1.tait.co.nz gatekeeper.tait.co.nz> Organization: Tait Electronics Limited MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Comments: Authenticated sender is Precedence: bulk On 21 Aug 97 at 18:55, Shawn Hargreaves wrote: > The functions in src/libc/go32/gopint.c > (_go32_dpmi_allocate_iret_wrapper() and friends), allocate a custom > stack for the interrupt handler, which is locked. So it doesn't > matter however much data the compiler decides to put on the stack, > as long as it doesn't overflow the stack size (the default seems to > be just under 32k, and I can't imagine an interrupt handler ever > using more than that!). Nor can I, but you never know. > > As far as I can see the only problems with C code are needing the > dummy marker functions (seems to work at present but could break > with future versions of the compiler), and the possibility that the Or even the present using -O3 as things get inlined out of existence. However, this might not be an issue as I believe gcc leaves a copy of an inlined function if its address is taken or it is non static. And since all functions called by the interrupt must be locked, the inlined copies are locked as well and thus won't cause any problems. > generated code might use external helper functions or global data > (eg. floating point constants, jump tables for a switch statement Jump tables are either inlined in the function's code. eg: #first part of function jmp jump_table(,%eax,4) jump_table .long case_1 .long case_2 case_1: #code for case 1 jmp switch_end case_2: #code for case 2 jmp switch_end switch_end: #rest of function or don't exist at all as a binary search (?? something like it anyway) using cmp and jae/be/e/ne for small (and/or sparse?) switch statements, > or helper functions for working with the "long long" data type). As Could be a problem. I guess that for interrupt routines, inline asm should be used for `long long's. > long as you are careful in how you lay things out, though, C > interrupt handlers can be quite reliable, and it's certainly a lot > easier than doing everything in asm! Most definitly! It was a tad easier writing my ide driver in C than my serial port driver was in asm. Mind you, getting all those volatiles right was a problem. Bill -- Leave others their otherness.