SimpleOS

LXR

Navigation



Site hébergé par : enix

The LXR Cross Referencer for SOS

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Article:1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 6.5 ] [ 7 ] [ 7.5 ] [ 8 ] [ 9 ] [ 9.5 ]

Diff markup

Differences between /hwcore/irq_wrappers.S (Article 6.5) and /hwcore/irq_wrappers.S (Article 6)


001 /* Copyright (C) 2004  The KOS Team               001 /* Copyright (C) 2004  The KOS Team
                                                   >> 002    Copyright (C) 1999  Free Software Foundation, Inc.
002                                                   003 
003    This program is free software; you can redi    004    This program is free software; you can redistribute it and/or
004    modify it under the terms of the GNU Genera    005    modify it under the terms of the GNU General Public License
005    as published by the Free Software Foundatio    006    as published by the Free Software Foundation; either version 2
006    of the License, or (at your option) any lat    007    of the License, or (at your option) any later version.
007                                                   008    
008    This program is distributed in the hope tha    009    This program is distributed in the hope that it will be useful,
009    but WITHOUT ANY WARRANTY; without even the     010    but WITHOUT ANY WARRANTY; without even the implied warranty of
010    MERCHANTABILITY or FITNESS FOR A PARTICULAR    011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
011    GNU General Public License for more details    012    GNU General Public License for more details.
012                                                   013    
013    You should have received a copy of the GNU     014    You should have received a copy of the GNU General Public License
014    along with this program; if not, write to t    015    along with this program; if not, write to the Free Software
015    Foundation, Inc., 59 Temple Place - Suite 3    016    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
016    USA.                                           017    USA. 
017 */                                                018 */
                                                   >> 019 #define ASM_SOURCE 1
018                                                   020          
019 .file "irq_wrappers.S"                            021 .file "irq_wrappers.S"
020                                                   022 
021 .text                                             023 .text
022                                                   024 
023 /** The address of the table of handlers (defi    025 /** The address of the table of handlers (defined in irq.c) */
024 .extern sos_irq_handler_array                     026 .extern sos_irq_handler_array
025                                                   027 
026 /** The address of the table of wrappers (defi    028 /** The address of the table of wrappers (defined below, and shared
027    with irq.c */                                  029    with irq.c */
028 .globl sos_irq_wrapper_array                      030 .globl sos_irq_wrapper_array
029                                                   031 
030 /** The variable holding the nested level of t    032 /** The variable holding the nested level of the IRQ handlers */
031 .extern sos_irq_nested_level_counter              033 .extern sos_irq_nested_level_counter
032                                                   034 
033 /* These pre-handlers are for IRQ (Master PIC)    035 /* These pre-handlers are for IRQ (Master PIC) */
034 .irp id, 0,1,2,3,4,5,6,7                          036 .irp id, 0,1,2,3,4,5,6,7
035                                                   037 
036         .p2align 2, 0x90                          038         .p2align 2, 0x90
037                                                   039 
038         sos_irq_wrapper_\id:                      040         sos_irq_wrapper_\id:
039         .type sos_irq_wrapper_\id,@function       041         .type sos_irq_wrapper_\id,@function
040                                                   042 
041                 /*                                043                 /*
042                  * Backup the CPU context         044                  * Backup the CPU context
043                  */                               045                  */
044                                                   046 
045                 /* Fake error code */             047                 /* Fake error code */
046                 pushl $0                          048                 pushl $0
047                                                   049 
048                 /* Backup the actual context *    050                 /* Backup the actual context */
049                 pushl %ebp                        051                 pushl %ebp
050                 movl %esp, %ebp                   052                 movl %esp, %ebp
051                                                   053 
052                 pushl %edi                        054                 pushl %edi
053                 pushl %esi                        055                 pushl %esi
054                 pushl %edx                        056                 pushl %edx
055                 pushl %ecx                        057                 pushl %ecx
056                 pushl %ebx                        058                 pushl %ebx
057                 pushl %eax                        059                 pushl %eax
058                 subl  $2,%esp                     060                 subl  $2,%esp
059                 pushw %ss                         061                 pushw %ss
060                 pushw %ds                         062                 pushw %ds
061                 pushw %es                         063                 pushw %es
062                 pushw %fs                         064                 pushw %fs
063                 pushw %gs                         065                 pushw %gs
064                                                   066 
065                 /*                                067                 /*
066                  * Increment IRQ nested level     068                  * Increment IRQ nested level
067                  */                               069                  */
068                 incl sos_irq_nested_level_coun    070                 incl sos_irq_nested_level_counter
069                                                   071 
070                 /* Send EOI to PIC. See Intel     072                 /* Send EOI to PIC. See Intel 8259 datasheet
071                    available on Kos website */    073                    available on Kos website */  
072                 movb  $0x20, %al                  074                 movb  $0x20, %al
073                 outb  %al, $0x20                  075                 outb  %al, $0x20
074                                                   076         
075                 /*                                077                 /*
076                  * Call the handler with IRQ n !! 078                  * Call the handler with the IRQ number and the
                                                   >> 079                  * address of the stored CPU context as arguments
077                  */                               080                  */
                                                   >> 081                 pushl %esp
078                 pushl $\id                        082                 pushl $\id
079                 leal  sos_irq_handler_array,%e    083                 leal  sos_irq_handler_array,%edi
080                 call  *\id*4(%edi)                084                 call  *\id*4(%edi)
081                 addl  $4, %esp                 !! 085                 /* Unallocate the arguments passed to the handler */
                                                   >> 086                 addl  $8, %esp
082                                                   087         
083                 /*                                088                 /*
084                  * Decrement IRQ nested level     089                  * Decrement IRQ nested level
085                  */                               090                  */
086                 cli  /* Just in case we messed    091                 cli  /* Just in case we messed up everything in the handler */
087                 subl $1, sos_irq_nested_level_    092                 subl $1, sos_irq_nested_level_counter
088                                                   093 
089                 /* sos_irq_nested_level_counte    094                 /* sos_irq_nested_level_counter went below 0 ?! */
090                 jnc 2f                            095                 jnc 2f
091                                                   096         
092         1:      /* Yes: Print fatal error mess    097         1:      /* Yes: Print fatal error message */
093                 pushl $msg_nested_level_overfl    098                 pushl $msg_nested_level_overflow
094                 call sos_display_fatal_error      099                 call sos_display_fatal_error
095                 addl $4, %esp ; jmp 1b            100                 addl $4, %esp ; jmp 1b
096                 /* Never returns */               101                 /* Never returns */
097                                                   102 
098         2:      /* No:   all right ! */           103         2:      /* No:   all right ! */
099                                                   104 
100                 /* Restore the context */         105                 /* Restore the context */
101                 popw  %gs                         106                 popw  %gs
102                 popw  %fs                         107                 popw  %fs
103                 popw  %es                         108                 popw  %es
104                 popw  %ds                         109                 popw  %ds
105                 popw  %ss                         110                 popw  %ss
106                 addl  $2,%esp                     111                 addl  $2,%esp
107                 popl  %eax                        112                 popl  %eax
108                 popl  %ebx                        113                 popl  %ebx
109                 popl  %ecx                        114                 popl  %ecx
110                 popl  %edx                        115                 popl  %edx
111                 popl  %esi                        116                 popl  %esi
112                 popl  %edi                        117                 popl  %edi
113                 popl  %ebp                        118                 popl  %ebp
114                                                   119 
115                 /* Remove fake error code */      120                 /* Remove fake error code */
116                 addl  $4, %esp                    121                 addl  $4, %esp
117                                                   122 
118                 iret                              123                 iret
119         .endr                                     124         .endr
120                                                   125 
121                                                   126 
122 /* These pre-handlers are for IRQ (Slave PIC)     127 /* These pre-handlers are for IRQ (Slave PIC) */
123 .irp id, 8,9,10,11,12,13,14,15                    128 .irp id, 8,9,10,11,12,13,14,15
124                                                   129 
125         .p2align 2, 0x90                          130         .p2align 2, 0x90
126                                                   131 
127         sos_irq_wrapper_\id:                      132         sos_irq_wrapper_\id:
128         .type sos_irq_wrapper_\id,@function       133         .type sos_irq_wrapper_\id,@function
129                                                   134 
130                 /*                                135                 /*
131                  * Backup the CPU context         136                  * Backup the CPU context
132                  */                               137                  */
133                                                   138 
134                 /* Fake error code */             139                 /* Fake error code */
135                 pushl $0                          140                 pushl $0
136                                                   141 
137                 /* Backup the actual context *    142                 /* Backup the actual context */
138                 pushl %ebp                        143                 pushl %ebp
139                 movl %esp, %ebp                   144                 movl %esp, %ebp
140                                                   145 
141                 pushl %edi                        146                 pushl %edi
142                 pushl %esi                        147                 pushl %esi
143                 pushl %edx                        148                 pushl %edx
144                 pushl %ecx                        149                 pushl %ecx
145                 pushl %ebx                        150                 pushl %ebx
146                 pushl %eax                        151                 pushl %eax
147                 subl  $2,%esp                     152                 subl  $2,%esp
148                 pushw %ss                         153                 pushw %ss
149                 pushw %ds                         154                 pushw %ds
150                 pushw %es                         155                 pushw %es
151                 pushw %fs                         156                 pushw %fs
152                 pushw %gs                         157                 pushw %gs
153                                                   158 
154                 /*                                159                 /*
155                  * Increment IRQ nested level     160                  * Increment IRQ nested level
156                  */                               161                  */
157                 incl sos_irq_nested_level_coun    162                 incl sos_irq_nested_level_counter
158                                                   163 
159                 /* Send EOI to PIC. See Intel     164                 /* Send EOI to PIC. See Intel 8259 datasheet
160                    available on Kos website */    165                    available on Kos website */  
161                 movb  $0x20, %al                  166                 movb  $0x20, %al
162                 outb  %al, $0xa0                  167                 outb  %al, $0xa0
163                 outb  %al, $0x20                  168                 outb  %al, $0x20
164                                                   169 
165                 /*                                170                 /*
166                  * Call the handler with IRQ n !! 171                  * Call the handler with the IRQ number and the
                                                   >> 172                  * address of the stored CPU context as arguments
167                  */                               173                  */
                                                   >> 174                 pushl %esp
168                 pushl $\id                        175                 pushl $\id
169                 leal  sos_irq_handler_array,%e    176                 leal  sos_irq_handler_array,%edi
170                 call  *\id*4(%edi)                177                 call  *\id*4(%edi)
171                 addl  $4, %esp                 !! 178                 /* Unallocate the arguments passed to the handler */
                                                   >> 179                 addl  $8, %esp
172                                                   180 
173                 /*                                181                 /*
174                  * Decrement IRQ nested level     182                  * Decrement IRQ nested level
175                  */                               183                  */
176                 cli  /* Just in case we messed    184                 cli  /* Just in case we messed up everything in the handler */
177                 subl $1, sos_irq_nested_level_    185                 subl $1, sos_irq_nested_level_counter
178                                                   186 
179                 /* sos_irq_nested_level_counte    187                 /* sos_irq_nested_level_counter went below 0 ?! */
180                 jnc 2f                            188                 jnc 2f
181                                                   189                 
182         1:      /* Yes: Print fatal error mess    190         1:      /* Yes: Print fatal error message */
183                 pushl $msg_nested_level_overfl    191                 pushl $msg_nested_level_overflow
184                 call sos_display_fatal_error      192                 call sos_display_fatal_error
185                 addl $4, %esp ; jmp 1b            193                 addl $4, %esp ; jmp 1b
186                 /* Never returns */               194                 /* Never returns */
187                                                   195 
188         2:      /* No:   all right ! */           196         2:      /* No:   all right ! */
189                                                   197 
190                 /* Restore the context */         198                 /* Restore the context */
191                 popw  %gs                         199                 popw  %gs
192                 popw  %fs                         200                 popw  %fs
193                 popw  %es                         201                 popw  %es
194                 popw  %ds                         202                 popw  %ds
195                 popw  %ss                         203                 popw  %ss
196                 addl  $2,%esp                     204                 addl  $2,%esp
197                 popl  %eax                        205                 popl  %eax
198                 popl  %ebx                        206                 popl  %ebx
199                 popl  %ecx                        207                 popl  %ecx
200                 popl  %edx                        208                 popl  %edx
201                 popl  %esi                        209                 popl  %esi
202                 popl  %edi                        210                 popl  %edi
203                 popl  %ebp                        211                 popl  %ebp
204                                                   212 
205                 /* Remove fake error code */      213                 /* Remove fake error code */
206                 addl  $4, %esp                    214                 addl  $4, %esp
207                                                   215 
208                 iret                              216                 iret
209         .endr                                     217         .endr
210                                                   218 
211 .section ".rodata"                                219 .section ".rodata"
212 msg_nested_level_overflow:                        220 msg_nested_level_overflow:
213         .string "irq_wrappers.S: IRQ Nested le    221         .string "irq_wrappers.S: IRQ Nested level overflow ! System halted."
214                                                   222 
215 /* Build the sos_irq_wrapper_array, shared wit    223 /* Build the sos_irq_wrapper_array, shared with irq.c */
216 .p2align 5, 0x0                                   224 .p2align 5, 0x0
217 sos_irq_wrapper_array:                            225 sos_irq_wrapper_array:
218         .irp id, 0,1,2,3,4,5,6,7,8,9,10,11,12,    226         .irp id, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
219                 .long (sos_irq_wrapper_\id)       227                 .long (sos_irq_wrapper_\id)
220         .endr                                     228         .endr
                                                      

source navigation ] diff markup ] identifier search ] general search ]