Subversion Repositories HelenOS-historic

Rev

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

Rev 952 Rev 958
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 %ebp
81
	push %eax
-
 
82
 
-
 
83
	# Test if this is interrupt with error word or not
82
	movl %esp,%ebp
84
	movl $(1<<\i), %eax
-
 
85
	andl $ERROR_WORD_INTERRUPT_LIST,%eax
-
 
86
 
-
 
87
	/*
-
 
88
	 * If this interrupt/exception  stores error word,
-
 
89
	 * we need to pop EAX.
-
 
90
	 * If this interrupt doesn't store error word, we emulate it
-
 
91
	 * for the sake of consistent pstate structure. In that case
-
 
92
	 * we merely leave the EAX on the stack.
-
 
93
	 */
83
	pusha
94
	jz 0f
-
 
95
 
-
 
96
	/*
-
 
97
	 * This exception stores error word.
-
 
98
	 */
-
 
99
	pop %eax
-
 
100
	jmp 1f
-
 
101
 
-
 
102
0:
-
 
103
	/*
-
 
104
	 * This interrupt doesn't store error word.
-
 
105
	 * Just restore EAX without doing POP.
-
 
106
	 */
-
 
107
	movl (%esp), %eax
84
 
108
 
-
 
109
1:
-
 
110
	pusha
-
 
111
	movl %esp, %ebp
85
	push %ds
112
	push %ds
86
	push %es
113
	push %es
87
 
114
 
88
	# we must fill the data segment registers
115
	# we must fill the data segment registers
89
	movw $16,%ax
116
	movw $16,%ax
90
	movw %ax,%ds
117
	movw %ax,%ds
91
	movw %ax,%es
118
	movw %ax,%es
92
 
119
 
93
	movl $(\i),%edi
120
	movl $(\i),%edi
94
	pushl %ebp
121
	pushl %ebp
95
	addl $4,(%esp)
-
 
96
	pushl %edi
122
	pushl %edi
97
	call exc_dispatch
123
	call exc_dispatch
98
	addl $8,%esp
124
	addl $8,%esp
99
 
125
 
100
	pop %es
126
	pop %es
101
	pop %ds
127
	pop %ds
102
 
128
 
103
 
-
 
104
# CLNT
129
# Clear Nested Task flag.
105
	pushfl
130
	pushfl
106
	pop %eax
131
	pop %eax
107
	and $0xFFFFBFFF,%eax
132
	and $0xFFFFBFFF,%eax
108
	push %eax
133
	push %eax
109
	popfl
134
	popfl
110
	
135
	
111
 
-
 
112
 
-
 
113
# Test if this is interrupt with error word or not
-
 
114
	mov $\i,%cl
-
 
115
	movl $1,%eax
-
 
116
	test $0xe0,%cl
-
 
117
	jnz 0f
-
 
118
	and $0x1f,%cl
-
 
119
	shl %cl,%eax
-
 
120
	and $ERROR_WORD_INTERRUPT_LIST,%eax
-
 
121
	jz 0f
-
 
122
 
-
 
123
 
-
 
124
# Return with error word
-
 
125
	popa
-
 
126
	pop %ebp
-
 
127
	add $4,%esp	# Skip error word
-
 
128
	iret
-
 
129
 
-
 
130
0:
-
 
131
# Return with no error word
-
 
132
	popa
136
	popa
133
	pop %ebp
137
	add $4,%esp	# Skip error word, whether real or fake.
134
	iret
138
	iret
135
 
139
 
136
	.if (\n-\i)-1
140
	.if (\n-\i)-1
137
	handler "(\i+1)",\n
141
	handler "(\i+1)",\n
138
	.endif
142
	.endif