Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/asm.S

    rb8230b9 r8fb47ec0  
    198198#define INTERRUPT_ALIGN 64
    199199.macro handler i n
    200        
    201         .ifeq \i - 0x30     # Syscall handler
    202                 pushl %ds
    203                 pushl %es
    204                 pushl %fs
    205                 pushl %gs
    206                
    207                 #
    208                 # Push syscall arguments onto the stack
    209                 #
    210                 # NOTE: The idea behind the order of arguments passed in registers is to
    211                 #       use all scratch registers first and preserved registers next.
    212                 #       An optimized libc syscall wrapper can make use of this setup.
    213                 #
    214                 pushl %eax
    215                 pushl %ebp
    216                 pushl %edi
    217                 pushl %esi
    218                 pushl %ebx
    219                 pushl %ecx
    220                 pushl %edx
    221                
    222                 # we must fill the data segment registers
    223                 movw $16, %ax
    224                 movw %ax, %ds
    225                 movw %ax, %es
    226                
    227                 cld
    228                 sti
    229                 # syscall_handler(edx, ecx, ebx, esi, edi, ebp, eax)
    230                 call syscall_handler
    231                 cli
    232                 addl $28, %esp         # clean-up of parameters
    233                
    234                 popl %gs
    235                 popl %fs
    236                 popl %es
    237                 popl %ds
    238                
    239                 CLEAR_NT_FLAG
    240                 iret
    241         .else
    242                 /*
    243                  * This macro distinguishes between two versions of ia32 exceptions.
    244                  * One version has error word and the other does not have it.
    245                  * The latter version fakes the error word on the stack so that the
    246                  * handlers and istate_t can be the same for both types.
    247                  */
    248                 .iflt \i - 32
    249                         .if (1 << \i) & ERROR_WORD_INTERRUPT_LIST
    250                                 /*
    251                                  * With error word, do nothing
    252                                  */
    253                         .else
    254                                 /*
    255                                  * Version without error word
    256                                  */
    257                                 subl $4, %esp
    258                         .endif
    259                 .else
    260                         /*
    261                          * Version without error word
     200
     201.ifeq \i - 0x30     # Syscall handler
     202        pushl %ds
     203        pushl %es
     204        pushl %fs
     205        pushl %gs
     206
     207        #
     208        # Push syscall arguments onto the stack
     209        #
     210        # NOTE: The idea behind the order of arguments passed in registers is to
     211        #       use all scratch registers first and preserved registers next.
     212        #       An optimized libc syscall wrapper can make use of this setup.
     213        #
     214        pushl %eax
     215        pushl %ebp
     216        pushl %edi
     217        pushl %esi
     218        pushl %ebx
     219        pushl %ecx
     220        pushl %edx
     221       
     222        # we must fill the data segment registers
     223        movw $16, %ax
     224        movw %ax, %ds
     225        movw %ax, %es
     226       
     227        cld
     228        sti
     229        # syscall_handler(edx, ecx, ebx, esi, edi, ebp, eax)
     230        call syscall_handler   
     231        cli
     232        addl $28, %esp         # clean-up of parameters
     233       
     234        popl %gs
     235        popl %fs
     236        popl %es
     237        popl %ds
     238       
     239        CLEAR_NT_FLAG
     240        iret
     241.else   
     242        /*
     243         * This macro distinguishes between two versions of ia32 exceptions.
     244         * One version has error word and the other does not have it.
     245         * The latter version fakes the error word on the stack so that the
     246         * handlers and istate_t can be the same for both types.
     247         */
     248        .iflt \i - 32
     249                .if (1 << \i) & ERROR_WORD_INTERRUPT_LIST
     250                        /*
     251                         * With error word, do nothing
    262252                         */
     253                .else
     254                        /*
     255                         * Version without error word,
     256                         */
    263257                        subl $4, %esp
    264                 .endif
    265                
    266                 pushl %ds
    267                 pushl %es
    268                 pushl %fs
    269                 pushl %gs
    270                
    271                 pushl %ebp
    272                 pushl %edx
    273                 pushl %ecx
    274                 pushl %eax
    275                
    276                 # we must fill the data segment registers
    277                
    278                 movw $16, %ax
    279                 movw %ax, %ds
    280                 movw %ax, %es
    281                
    282                 # stop stack traces here
    283                 xorl %ebp, %ebp
    284                
    285                 pushl %esp          # *istate
    286                 pushl $(\i)         # intnum
    287                 call exc_dispatch   # exc_dispatch(intnum, *istate)
    288                 addl $8, %esp       # Clear arguments from stack
    289                
    290                 CLEAR_NT_FLAG # Modifies %ecx
    291                
    292                 popl %eax
    293                 popl %ecx
    294                 popl %edx
    295                 popl %ebp
    296                
    297                 popl %gs
    298                 popl %fs
    299                 popl %es
    300                 popl %ds
    301                
    302                 # skip error word, no matter whether real or fake
    303                 addl $4, %esp
    304                 iret
     258                .endif
     259        .else
     260                /*
     261                 * Version without error word,
     262                 */
     263                subl $4, %esp
    305264        .endif
    306265       
     266        pushl %ds
     267        pushl %es
     268        pushl %fs
     269        pushl %gs
     270
     271        pushl %ebp
     272        pushl %edx
     273        pushl %ecx
     274        pushl %eax
     275       
     276        # we must fill the data segment registers
     277        movw $16, %ax
     278        movw %ax, %ds
     279        movw %ax, %es
     280
     281        # stop stack traces here
     282        xorl %ebp, %ebp
     283
     284        pushl %esp          # *istate
     285        pushl $(\i)         # intnum
     286        call exc_dispatch   # excdispatch(intnum, *istate)
     287        addl $8, %esp       # Clear arguments from stack
     288
     289        CLEAR_NT_FLAG # Modifies %ecx
     290       
     291        popl %eax
     292        popl %ecx
     293        popl %edx
     294        popl %ebp
     295       
     296        popl %gs
     297        popl %fs
     298        popl %es
     299        popl %ds
     300
     301        addl $4, %esp   # Skip error word, no matter whether real or fake.
     302        iret
     303.endif
     304
    307305        .align INTERRUPT_ALIGN
    308306        .if (\n- \i) - 1
    309                 handler "(\i + 1)", \n
     307        handler "(\i + 1)", \n
    310308        .endif
    311309.endm
Note: See TracChangeset for help on using the changeset viewer.