Subversion Repositories HelenOS-historic

Rev

Rev 1016 | Rev 1100 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1016 Rev 1021
Line 76... Line 76...
76
#
76
#
77
# The handlers setup data segment registers
77
# The handlers setup data segment registers
78
# and call exc_dispatch().
78
# and call exc_dispatch().
79
#
79
#
80
.macro handler i n
80
.macro handler i n
81
	push %eax
-
 
82
 
81
 
83
	/*
82
	/*
-
 
83
	 * This macro distinguishes between two versions of ia32 exceptions.
84
	 * Test if this is interrupt with error word or not.
84
	 * One version has error word and the other does not have it.
-
 
85
	 * The latter version fakes the error word on the stack so that the
85
	 * Be careful about width of the shift.
86
	 * handlers and istate_t can be the same for both types.
86
	 */
87
	 */
87
	.iflt \i-32
-
 
88
		movl $(1<<\i), %eax
-
 
89
	.else
-
 
90
		movl $0, %eax
-
 
91
	.endif
-
 
92
	andl $ERROR_WORD_INTERRUPT_LIST, %eax
-
 
93
	movl (%esp), %eax
-
 
94
 
88
 
-
 
89
	.iflt \i-32
-
 
90
		.if (1 << \i) & ERROR_WORD_INTERRUPT_LIST
95
	/*
91
			/*
96
	 * If this interrupt/exception stores error word,
-
 
97
	 * we need to pop EAX.
92
			 * Version with error word.
98
	 * If this interrupt doesn't store error word, we emulate it
-
 
99
	 * for the sake of consistent istate structure. In that case
-
 
100
	 * we merely leave the EAX on the stack.
93
			 * Just take space equal to subl $4, %esp.
101
	 */
94
			 */
102
	jz 0f
95
			nop
103
 
96
			nop
104
	/*
97
			nop
-
 
98
                .else
-
 
99
                        /*
105
	 * This exception stores error word.
100
                         * Version without error word,
106
	 * Remove EAX from the stack.
101
                         */
-
 
102
			subl $4, %esp
-
 
103
                .endif
107
	 */
104
        .else
-
 
105
                /*
-
 
106
                 * Version without error word,
-
 
107
                 */
108
	addl $4, %esp
108
		subl $4, %esp
-
 
109
        .endif
109
 
110
 
110
0:
-
 
111
	pusha
111
	pusha
112
	movl %esp, %ebp
112
	movl %esp, %ebp
113
	push %ds
113
	push %ds
114
	push %es
114
	push %es
115
	push %fs
115
	push %fs
Line 136... Line 136...
136
	and $0xffffbfff,%eax
136
	and $0xffffbfff,%eax
137
	push %eax
137
	push %eax
138
	popfl
138
	popfl
139
	
139
	
140
	popa
140
	popa
141
	addl $4,%esp	# Skip error word, whether real or fake.
141
	addl $4,%esp	# Skip error word, no matter whether real or fake.
142
	iret
142
	iret
143
 
143
 
144
	.if (\n-\i)-1
144
	.if (\n-\i)-1
145
	handler "(\i+1)",\n
145
	handler "(\i+1)",\n
146
	.endif
146
	.endif