freebsd-dev/sys/i386/isa
Bruce Evans d5c90663b2 Don't use plain "ret" instructions at targets of jump instructions,
since the branch caches on at least Athlon XP through Athlon 64 CPU's
don't understand such instructions and guarantee a cache miss taking
at least 10 cycles.  Use the documented workaround "ret $0" instead
("nop; ret" also works, but "ret $0" is probably faster on old CPUs).

Normal code (even asm code) doesn't branch to "ret", since there is
usually some cleanup to do, but the __mcount, .mcount and .mexitcount
entry points were optimized too well to have the minimum number of
instructions (3 instructions each if profiling is not enabled) and
they did this.  I didn't see a significant number of cache misses for
.mexitcount, but for the shared "ret" for __mcount and .mcount I
observed cache misses costing 26 cycles each.  For a send(2) syscall
that makes about 70 function calls, the cost of these cache misses
alone increased the syscall time from about 4000 cycles to about 7000
cycles.  4000 is for a profiling (GUPROF) kernel with profiling disabled;
after this fix, configuring profiling only costs about 600 cycles in the
4000, which is consistent with almost perfect branch prediction in the
mcounting calls.
2007-11-29 02:01:21 +00:00
..
atpic_vector.s Evidently FreeBSD has long relied on the compiler to treat structures 2006-12-17 05:07:01 +00:00
atpic.c Minor fixes and tweaks to the x86 interrupt code: 2007-05-08 21:29:14 +00:00
ccbque.h /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 22:18:23 +00:00
clock.c Split /dev/nvram driver out of isa/clock.c for i386 and amd64. I have not 2007-10-26 03:23:54 +00:00
elcr.c Tweak the ELCR support slightly. Explicitly probe the ELCR during boot 2005-01-18 20:24:47 +00:00
elink.c /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 22:18:23 +00:00
elink.h /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 22:18:23 +00:00
icu.h Evidently FreeBSD has long relied on the compiler to treat structures 2006-12-17 05:07:01 +00:00
isa_dma.c - Move bus dependent defines to {isa,cbus}_dmareg.h. 2005-05-14 10:14:56 +00:00
isa.c Fix a kernel panic due to a NULL pointer access on pc98. 2007-09-01 12:18:28 +00:00
isa.h - Move bus dependent defines to {isa,cbus}_dmareg.h. 2005-05-14 10:14:56 +00:00
nmi.c Remove advertising clause from University of California Regent's 2004-04-07 20:46:16 +00:00
npx.c Commit 14/14 of sched_lock decomposition. 2007-06-05 00:00:57 +00:00
pmtimer.c First part of a little cleanup in the calendar/timezone/RTC handling. 2006-10-02 12:59:59 +00:00
prof_machdep.c Don't use plain "ret" instructions at targets of jump instructions, 2007-11-29 02:01:21 +00:00
spic.c Since DELAY() was moved, most <machine/clock.h> #includes have been 2006-05-16 14:37:58 +00:00
spicreg.h /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 22:18:23 +00:00
vesa.c Fix -Wundef warnings found when compiling i386 LINT, GENERIC and 2005-12-05 11:58:35 +00:00