Changeset b808660 in mainline for kernel/arch/ia32/include/asm.h


Ignore:
Timestamp:
2010-07-08T20:03:52Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bee2d4c
Parents:
9097982f
Message:

Do not align ia32 int handlers on any pre-defined power-of-two boundary but
rather define each one as a separate procedure with its own global label. The
label is used to populate the IDT and it also helps to maintain consistency
between C and assembly.

The old way was very error-prone because one did not get a warning when a
handler exceeded the size limit given by the alignment, which usually resulted
in very weird crashes.

In principle, the old way was also rather wasteful as the handler had to be
aligned on a power-of-two address. With the int handler size around 160 bytes,
the bytes 160 - 255 in each handler were simply wasted. In practice, however,
the image.iso size did not change (I'd expect it to drop by around 8K).

The old way did not detect a mistmatch between the C code idea of how many IDT
entries there are and the assembly language code idea of the same thing. It was
possible to initialize an IDT entry to point to some garbage and nobody would
notice until the int occurred.

The new method was a bit tiresome to write as there was a lot of copy'n'paste.
But since it was a one-time effort, I lumped it. If you know of a way to write a
for-loop in C preprocessor or use GAS assmebler macros in a sensible way, I will
gladly use your improvement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/include/asm.h

    r9097982f rb808660  
    425425
    426426extern void paging_on(void);
    427 extern void interrupt_handlers(void);
    428427extern void enable_l_apic_in_msr(void);
    429428
     
    431430extern void asm_fake_loop(uint32_t);
    432431
     432extern uintptr_t int_0;
     433extern uintptr_t int_1;
     434extern uintptr_t int_2;
     435extern uintptr_t int_3;
     436extern uintptr_t int_4;
     437extern uintptr_t int_5;
     438extern uintptr_t int_6;
     439extern uintptr_t int_7;
     440extern uintptr_t int_8;
     441extern uintptr_t int_9;
     442extern uintptr_t int_10;
     443extern uintptr_t int_11;
     444extern uintptr_t int_12;
     445extern uintptr_t int_13;
     446extern uintptr_t int_14;
     447extern uintptr_t int_15;
     448extern uintptr_t int_16;
     449extern uintptr_t int_17;
     450extern uintptr_t int_18;
     451extern uintptr_t int_19;
     452extern uintptr_t int_20;
     453extern uintptr_t int_21;
     454extern uintptr_t int_22;
     455extern uintptr_t int_23;
     456extern uintptr_t int_24;
     457extern uintptr_t int_25;
     458extern uintptr_t int_26;
     459extern uintptr_t int_27;
     460extern uintptr_t int_28;
     461extern uintptr_t int_29;
     462extern uintptr_t int_30;
     463extern uintptr_t int_31;
     464extern uintptr_t int_32;
     465extern uintptr_t int_33;
     466extern uintptr_t int_34;
     467extern uintptr_t int_35;
     468extern uintptr_t int_36;
     469extern uintptr_t int_37;
     470extern uintptr_t int_38;
     471extern uintptr_t int_39;
     472extern uintptr_t int_40;
     473extern uintptr_t int_41;
     474extern uintptr_t int_42;
     475extern uintptr_t int_43;
     476extern uintptr_t int_44;
     477extern uintptr_t int_45;
     478extern uintptr_t int_46;
     479extern uintptr_t int_47;
     480extern uintptr_t int_48;
     481extern uintptr_t int_49;
     482extern uintptr_t int_50;
     483extern uintptr_t int_51;
     484extern uintptr_t int_52;
     485extern uintptr_t int_53;
     486extern uintptr_t int_54;
     487extern uintptr_t int_55;
     488extern uintptr_t int_56;
     489extern uintptr_t int_57;
     490extern uintptr_t int_58;
     491extern uintptr_t int_59;
     492extern uintptr_t int_60;
     493extern uintptr_t int_61;
     494extern uintptr_t int_62;
     495extern uintptr_t int_63;
     496
    433497#endif
    434498
Note: See TracChangeset for help on using the changeset viewer.