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 3) and /hwcore/irq_wrappers.S (Article 5)


001 /* Copyright (C) 2004  The KOS Team               001 /* Copyright (C) 2004  The KOS Team
002    Copyright (C) 1999  Free Software Foundatio    002    Copyright (C) 1999  Free Software Foundation, Inc.
003                                                   003 
004    This program is free software; you can redi    004    This program is free software; you can redistribute it and/or
005    modify it under the terms of the GNU Genera    005    modify it under the terms of the GNU General Public License
006    as published by the Free Software Foundatio    006    as published by the Free Software Foundation; either version 2
007    of the License, or (at your option) any lat    007    of the License, or (at your option) any later version.
008                                                   008    
009    This program is distributed in the hope tha    009    This program is distributed in the hope that it will be useful,
010    but WITHOUT ANY WARRANTY; without even the     010    but WITHOUT ANY WARRANTY; without even the implied warranty of
011    MERCHANTABILITY or FITNESS FOR A PARTICULAR    011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012    GNU General Public License for more details    012    GNU General Public License for more details.
013                                                   013    
014    You should have received a copy of the GNU     014    You should have received a copy of the GNU General Public License
015    along with this program; if not, write to t    015    along with this program; if not, write to the Free Software
016    Foundation, Inc., 59 Temple Place - Suite 3    016    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
017    USA.                                           017    USA. 
018 */                                                018 */
019 #define ASM_SOURCE 1                              019 #define ASM_SOURCE 1
020                                                   020          
021 .file "irq_wrappers.S"                            021 .file "irq_wrappers.S"
022                                                   022 
023 .text                                             023 .text
024                                                   024 
025 /* The address of the table of handlers (defin    025 /* The address of the table of handlers (defined in irq.c) */
026 .extern sos_irq_handler_array                     026 .extern sos_irq_handler_array
027                                                   027 
028 /* The address of the table of wrappers (defin    028 /* The address of the table of wrappers (defined below, and shared
029    with irq.c */                                  029    with irq.c */
030 .globl sos_irq_wrapper_array                      030 .globl sos_irq_wrapper_array
031                                                   031 
032                                                   032 
033 /* These pre-handlers are for IRQ (Master PIC)    033 /* These pre-handlers are for IRQ (Master PIC) */
034 .irp id, 0,1,2,3,4,5,6,7                          034 .irp id, 0,1,2,3,4,5,6,7
035                                                   035 
036         .p2align 2, 0x90                          036         .p2align 2, 0x90
037                                                   037 
038         sos_irq_wrapper_\id:                      038         sos_irq_wrapper_\id:
039         .type sos_irq_wrapper_\id,@function       039         .type sos_irq_wrapper_\id,@function
040                                                   040 
041                 /*                                041                 /*
042                  * Backup the CPU context         042                  * Backup the CPU context
043                  */                               043                  */
044                                                   044 
045                 /* Fake error code */             045                 /* Fake error code */
046                 pushl $0                          046                 pushl $0
047                                                   047 
048                 /* Backup the actual context *    048                 /* Backup the actual context */
049                 pushl %ebp                        049                 pushl %ebp
050                 movl %esp, %ebp                   050                 movl %esp, %ebp
051                                                   051 
052                 pushl %edi                        052                 pushl %edi
053                 pushl %esi                        053                 pushl %esi
054                 pushl %edx                        054                 pushl %edx
055                 pushl %ecx                        055                 pushl %ecx
056                 pushl %ebx                        056                 pushl %ebx
057                 pushl %eax                        057                 pushl %eax
058                 subl  $2,%esp                     058                 subl  $2,%esp
059                 pushw %ss                         059                 pushw %ss
060                 pushw %ds                         060                 pushw %ds
061                 pushw %es                         061                 pushw %es
062                 pushw %fs                         062                 pushw %fs
063                 pushw %gs                         063                 pushw %gs
064                                                   064 
065                 /* Send EOI to PIC. See Intel     065                 /* Send EOI to PIC. See Intel 8259 datasheet
066                    available on Kos website */    066                    available on Kos website */  
067                 movb  $0x20, %al                  067                 movb  $0x20, %al
068                 outb  %al, $0x20                  068                 outb  %al, $0x20
069                                                   069         
070                 /*                                070                 /*
071                  * Call the handler with IRQ n    071                  * Call the handler with IRQ number as argument
072                  */                               072                  */
073                 pushl $\id                        073                 pushl $\id
074                 leal  sos_irq_handler_array,%e    074                 leal  sos_irq_handler_array,%edi
075                 call  *\id*4(%edi)                075                 call  *\id*4(%edi)
076                 addl  $4, %esp                    076                 addl  $4, %esp
077                                                   077 
078                 /* Restore the context */         078                 /* Restore the context */
079                 popw  %gs                         079                 popw  %gs
080                 popw  %fs                         080                 popw  %fs
081                 popw  %es                         081                 popw  %es
082                 popw  %ds                         082                 popw  %ds
083                 popw  %ss                         083                 popw  %ss
084                 addl  $2,%esp                     084                 addl  $2,%esp
085                 popl  %eax                        085                 popl  %eax
086                 popl  %ebx                        086                 popl  %ebx
087                 popl  %ecx                        087                 popl  %ecx
088                 popl  %edx                        088                 popl  %edx
089                 popl  %esi                        089                 popl  %esi
090                 popl  %edi                        090                 popl  %edi
091                 popl  %ebp                        091                 popl  %ebp
092                                                   092 
093                 /* Remove fake error code */      093                 /* Remove fake error code */
094                 addl  $4, %esp                    094                 addl  $4, %esp
095                                                   095 
096                 iret                              096                 iret
097         .endr                                     097         .endr
098                                                   098 
099                                                   099 
100 /* These pre-handlers are for IRQ (Slave PIC)     100 /* These pre-handlers are for IRQ (Slave PIC) */
101 .irp id, 8,9,10,11,12,13,14,15                    101 .irp id, 8,9,10,11,12,13,14,15
102                                                   102 
103         .p2align 2, 0x90                          103         .p2align 2, 0x90
104                                                   104 
105         sos_irq_wrapper_\id:                      105         sos_irq_wrapper_\id:
106         .type sos_irq_wrapper_\id,@function       106         .type sos_irq_wrapper_\id,@function
107                                                   107 
108                 /*                                108                 /*
109                  * Backup the CPU context         109                  * Backup the CPU context
110                  */                               110                  */
111                                                   111 
112                 /* Fake error code */             112                 /* Fake error code */
113                 pushl $0                          113                 pushl $0
114                                                   114 
115                 /* Backup the actual context *    115                 /* Backup the actual context */
116                 pushl %ebp                        116                 pushl %ebp
117                 movl %esp, %ebp                   117                 movl %esp, %ebp
118                                                   118 
119                 pushl %edi                        119                 pushl %edi
120                 pushl %esi                        120                 pushl %esi
121                 pushl %edx                        121                 pushl %edx
122                 pushl %ecx                        122                 pushl %ecx
123                 pushl %ebx                        123                 pushl %ebx
124                 pushl %eax                        124                 pushl %eax
125                 subl  $2,%esp                     125                 subl  $2,%esp
126                 pushw %ss                         126                 pushw %ss
127                 pushw %ds                         127                 pushw %ds
128                 pushw %es                         128                 pushw %es
129                 pushw %fs                         129                 pushw %fs
130                 pushw %gs                         130                 pushw %gs
131                                                   131 
132                 /* Send EOI to PIC. See Intel     132                 /* Send EOI to PIC. See Intel 8259 datasheet
133                    available on Kos website */    133                    available on Kos website */  
134                 movb  $0x20, %al                  134                 movb  $0x20, %al
135                 outb  %al, $0xa0                  135                 outb  %al, $0xa0
136                 outb  %al, $0x20                  136                 outb  %al, $0x20
137                                                   137 
138                 /*                                138                 /*
139                  * Call the handler with IRQ n    139                  * Call the handler with IRQ number as argument
140                  */                               140                  */
141                 pushl $\id                        141                 pushl $\id
142                 leal  sos_irq_handler_array,%e    142                 leal  sos_irq_handler_array,%edi
143                 call  *\id*4(%edi)                143                 call  *\id*4(%edi)
144                 addl  $4, %esp                    144                 addl  $4, %esp
145                                                   145 
146                 /* Restore the context */         146                 /* Restore the context */
147                 popw  %gs                         147                 popw  %gs
148                 popw  %fs                         148                 popw  %fs
149                 popw  %es                         149                 popw  %es
150                 popw  %ds                         150                 popw  %ds
151                 popw  %ss                         151                 popw  %ss
152                 addl  $2,%esp                     152                 addl  $2,%esp
153                 popl  %eax                        153                 popl  %eax
154                 popl  %ebx                        154                 popl  %ebx
155                 popl  %ecx                        155                 popl  %ecx
156                 popl  %edx                        156                 popl  %edx
157                 popl  %esi                        157                 popl  %esi
158                 popl  %edi                        158                 popl  %edi
159                 popl  %ebp                        159                 popl  %ebp
160                                                   160 
161                 /* Remove fake error code */      161                 /* Remove fake error code */
162                 addl  $4, %esp                    162                 addl  $4, %esp
163                                                   163 
164                 iret                              164                 iret
165         .endr                                     165         .endr
166                                                   166 
167 /* Build the sos_irq_wrapper_array, shared wit    167 /* Build the sos_irq_wrapper_array, shared with irq.c */
168 .section ".rodata"                                168 .section ".rodata"
169 .p2align 5, 0x0                                   169 .p2align 5, 0x0
170 sos_irq_wrapper_array:                            170 sos_irq_wrapper_array:
171         .irp id, 0,1,2,3,4,5,6,7,8,9,10,11,12,    171         .irp id, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
172                 .long (sos_irq_wrapper_\id)       172                 .long (sos_irq_wrapper_\id)
173         .endr                                     173         .endr
                                                      

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