NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/38580: x86 vector.o is too large



>Number:         38580
>Category:       kern
>Synopsis:       x86 vector.o is too large
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 04 10:30:00 +0000 2008
>Originator:     Andrew Doran
>Release:        4.99.62
>Organization:
The NetBSD Project
>Environment:
n/a
>Description:
x86 interrupt and trap handling stubs have a couple of problems that
lead to a large vector.o after assembly (120k on amd64, 64k on i386).

o Long code sequences in INTRFASTEXIT/INTRFASTENTRY use instructions that
  assemble up particularly badly and produce large code. In particular, 
  "movl register, 123(%esp)" hits a weak spot in Intel's instruction
  coding and makes for a large opcode.

o Large code sequences are replicated many times over with only minor
  changes to the generated code in each.

>How-To-Repeat:
Code inspection.
>Fix:
1. Introduce a trap table layered after the IDT and provide 256 stubs.
Always set tf_trapno to an accurate value.

#define ZTRAP(n) \
    push $0 \  /* tf_err = dummy error code */
    push $(n) \ /* tf_trapno */
    jmp  *%cs:traptable+(n*4)

#define TRAP(n) \
    push $(n) \ /* tf_trapno */
    jmp  *%cs:traptable+(n*4)

2. Make trap() smarter so we don't lie and set T_ASTFLT everywhere.

3. Remove difference between Xrecurse and Xresume by adjusting code
in Xspllower/Xdoreti.

4. Introduce generic interrupt stubs: ioapic level, ioapic edge, i8254.

5. On amd64 use push/pop, on i386 pusha/popa to fill frames if
appropriate.



Home | Main Index | Thread Index | Old Index