[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
API modification request
- Date: Mon, 03 Feb 2003 16:56:57 -0800
- From: strauman at SLAC.Stanford.EDU (Till Straumann)
- Subject: API modification request
Valette Eric wrote:
> Till Straumann wrote:
>> 3/4) I claimed that table_entry->hdl(table_entry->arg) is only one
>> extra instruction on x86/PPC. If the hardware gives you just one
>> pointer, there are one more instructions needed. The worst case
>> is hardware jumping directly to some vector table entry. In this
>> case, you'd probably need in the order of 5 instructions.
> I still do not follow the one instruction argument (or is it C
> instrcutions) at least on PPC/ix86 : pushing table[vector].arg in C is
> more instructions in ASM. The push on Ix86 is already one and the
> computation is probably two and may leed to push a register to store
> intermediate result. On PPC, the computation to get the void* arg is
No, it is not - because the pointer to the 'handler' must be computed
anyways and accessing the 'arg' is just one instruction away.
> but you do not need to push the argument (except that r3 may be
> already used).
OK, I'll just answer this; The current code [written by yourself] (PPC)
does (disassembled C code):
lis r9, rtems_hdl_tbl at h
mulli r12, r30, 24 /* r12 = vector * sizeof(connect_data) */
lwz r5, rtems_hdl_tbl at l(r9) /* r5 = rtems_hdl_tbl */
add r10, r12, r5 /* r10 = &rtems_hdl_tbl[vector] */
lwz r8, 8(r10) /* r8 = rtems_hdl_tbl[vector].hdl */
/* HERE's MY EXTRA INSTRUCTION (no need to save r3) */
lwz r3, 20(r10) /* r3 = rtems_hdl_tbl[vector].arg */
/* END OF EXTRA CODE */
Note that the entire C_dispatch_irq_handler() instruction flow
taken normally is ~ 50 instructions.
As for X86: attached is the C code for two versions of a dispatcher
(with vs. without argument). If you compile '-O -fomit-frame-pointer'
and disassemble, you'll see that they differ by 1 instruction. I admit
that the real lowlevel handler may need to pop the argument after the
user handler returns...
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...