Rev 65 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 65 | Rev 106 | ||
---|---|---|---|
1 | # |
1 | # |
2 | # Copyright (C) 2001-2004 Jakub Jermar |
2 | # Copyright (C) 2001-2004 Jakub Jermar |
3 | # All rights reserved. |
3 | # All rights reserved. |
4 | # |
4 | # |
5 | # Redistribution and use in source and binary forms, with or without |
5 | # Redistribution and use in source and binary forms, with or without |
6 | # modification, are permitted provided that the following conditions |
6 | # modification, are permitted provided that the following conditions |
7 | # are met: |
7 | # are met: |
8 | # |
8 | # |
9 | # - Redistributions of source code must retain the above copyright |
9 | # - Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. |
10 | # notice, this list of conditions and the following disclaimer. |
11 | # - Redistributions in binary form must reproduce the above copyright |
11 | # - Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the |
12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. |
13 | # documentation and/or other materials provided with the distribution. |
14 | # - The name of the author may not be used to endorse or promote products |
14 | # - The name of the author may not be used to endorse or promote products |
15 | # derived from this software without specific prior written permission. |
15 | # derived from this software without specific prior written permission. |
16 | # |
16 | # |
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | # |
27 | # |
28 | 28 | ||
29 | ## very low and hardware-level functions |
29 | ## very low and hardware-level functions |
30 | 30 | ||
31 | .text |
31 | .text |
32 | 32 | ||
33 | .global cpu_priority_high |
33 | .global cpu_priority_high |
34 | .global cpu_priority_low |
34 | .global cpu_priority_low |
35 | .global cpu_priority_restore |
35 | .global cpu_priority_restore |
36 | .global cpu_priority_read |
36 | .global cpu_priority_read |
37 | .global cpu_halt |
37 | .global cpu_halt |
38 | .global cpu_sleep |
38 | .global cpu_sleep |
39 | .global paging_on |
39 | .global paging_on |
40 | .global cpu_read_dba |
40 | .global cpu_read_dba |
41 | .global cpu_write_dba |
41 | .global cpu_write_dba |
42 | .global cpu_read_cr2 |
42 | .global cpu_read_cr2 |
43 | .global enable_l_apic_in_msr |
43 | .global enable_l_apic_in_msr |
44 | .global interrupt_handlers |
44 | .global interrupt_handlers |
45 | .global inb |
45 | .global inb |
46 | .global inw |
46 | .global inw |
47 | .global inl |
47 | .global inl |
48 | .global outb |
48 | .global outb |
49 | .global outw |
49 | .global outw |
50 | .global outl |
50 | .global outl |
51 | .global memcopy |
51 | .global memcopy |
52 | .global memsetb |
52 | .global memsetb |
53 | .global memsetw |
53 | .global memsetw |
54 | .global memcmp |
54 | .global memcmp |
55 | 55 | ||
56 | 56 | ||
57 | ## Set priority level high |
57 | ## Set priority level high |
58 | # |
58 | # |
59 | # Disable interrupts and return previous |
59 | # Disable interrupts and return previous |
60 | # EFLAGS in EAX. |
60 | # EFLAGS in EAX. |
61 | # |
61 | # |
62 | cpu_priority_high: |
62 | cpu_priority_high: |
63 | pushf |
63 | pushf |
64 | pop %eax |
64 | pop %eax |
65 | cli |
65 | cli |
66 | ret |
66 | ret |
67 | 67 | ||
68 | 68 | ||
69 | ## Set priority level low |
69 | ## Set priority level low |
70 | # |
70 | # |
71 | # Enable interrupts and return previous |
71 | # Enable interrupts and return previous |
72 | # EFLAGS in EAX. |
72 | # EFLAGS in EAX. |
73 | # |
73 | # |
74 | cpu_priority_low: |
74 | cpu_priority_low: |
75 | pushf |
75 | pushf |
76 | pop %eax |
76 | pop %eax |
77 | sti |
77 | sti |
78 | ret |
78 | ret |
79 | 79 | ||
80 | 80 | ||
81 | ## Restore priority level |
81 | ## Restore priority level |
82 | # |
82 | # |
83 | # Restore EFLAGS. |
83 | # Restore EFLAGS. |
84 | # |
84 | # |
85 | cpu_priority_restore: |
85 | cpu_priority_restore: |
86 | push 4(%esp) |
86 | push 4(%esp) |
87 | popf |
87 | popf |
88 | ret |
88 | ret |
89 | 89 | ||
90 | ## Return raw priority level |
90 | ## Return raw priority level |
91 | # |
91 | # |
92 | # Return EFLAFS in EAX. |
92 | # Return EFLAFS in EAX. |
93 | # |
93 | # |
94 | cpu_priority_read: |
94 | cpu_priority_read: |
95 | pushf |
95 | pushf |
96 | pop %eax |
96 | pop %eax |
97 | ret |
97 | ret |
98 | 98 | ||
99 | 99 | ||
100 | ## Halt the CPU |
100 | ## Halt the CPU |
101 | # |
101 | # |
102 | # Halt the CPU using HLT. |
102 | # Halt the CPU using HLT. |
103 | # |
103 | # |
104 | cpu_halt: |
104 | cpu_halt: |
105 | cpu_sleep: |
105 | cpu_sleep: |
106 | hlt |
106 | hlt |
107 | ret |
107 | ret |
108 | 108 | ||
109 | 109 | ||
110 | ## Turn paging on |
110 | ## Turn paging on |
111 | # |
111 | # |
112 | # Enable paging and write-back caching in CR0. |
112 | # Enable paging and write-back caching in CR0. |
113 | # |
113 | # |
114 | paging_on: |
114 | paging_on: |
115 | pushl %eax |
115 | pushl %eax |
116 | movl %cr0,%eax |
116 | movl %cr0,%eax |
117 | orl $(1<<31),%eax # paging on |
117 | orl $(1<<31),%eax # paging on |
118 | andl $~((1<<30)|(1<<29)),%eax # clear Cache Disable and not Write Though |
118 | andl $~((1<<30)|(1<<29)),%eax # clear Cache Disable and not Write Though |
119 | movl %eax,%cr0 |
119 | movl %eax,%cr0 |
120 | jmp 0f |
120 | jmp 0f |
121 | 0: |
121 | 0: |
122 | popl %eax |
122 | popl %eax |
123 | ret |
123 | ret |
124 | 124 | ||
125 | 125 | ||
126 | ## Read CR3 |
126 | ## Read CR3 |
127 | # |
127 | # |
128 | # Store CR3 in EAX. |
128 | # Store CR3 in EAX. |
129 | # |
129 | # |
130 | cpu_read_dba: |
130 | cpu_read_dba: |
131 | movl %cr3,%eax |
131 | movl %cr3,%eax |
132 | ret |
132 | ret |
133 | 133 | ||
134 | 134 | ||
135 | ## Write CR3 |
135 | ## Write CR3 |
136 | # |
136 | # |
137 | # Set CR3. |
137 | # Set CR3. |
138 | # |
138 | # |
139 | cpu_write_dba: |
139 | cpu_write_dba: |
140 | pushl %eax |
140 | pushl %eax |
141 | movl 8(%esp),%eax |
141 | movl 8(%esp),%eax |
142 | movl %eax,%cr3 |
142 | movl %eax,%cr3 |
143 | popl %eax |
143 | popl %eax |
144 | ret |
144 | ret |
145 | 145 | ||
146 | 146 | ||
147 | ## Read CR2 |
147 | ## Read CR2 |
148 | # |
148 | # |
149 | # Store CR2 in EAX. |
149 | # Store CR2 in EAX. |
150 | # |
150 | # |
151 | cpu_read_cr2: |
151 | cpu_read_cr2: |
152 | movl %cr2,%eax |
152 | movl %cr2,%eax |
153 | ret |
153 | ret |
154 | 154 | ||
155 | 155 | ||
156 | ## Enable local APIC |
156 | ## Enable local APIC |
157 | # |
157 | # |
158 | # Enable local APIC in MSR. |
158 | # Enable local APIC in MSR. |
159 | # |
159 | # |
160 | enable_l_apic_in_msr: |
160 | enable_l_apic_in_msr: |
161 | pusha |
161 | pusha |
162 | 162 | ||
163 | movl $0x1b, %ecx |
163 | movl $0x1b, %ecx |
164 | rdmsr |
164 | rdmsr |
165 | orl $(1<<11),%eax |
165 | orl $(1<<11),%eax |
166 | orl $(0xfee00000),%eax |
166 | orl $(0xfee00000),%eax |
167 | wrmsr |
167 | wrmsr |
168 | 168 | ||
169 | popa |
169 | popa |
170 | ret |
170 | ret |
171 | 171 | ||
172 | 172 | ||
173 | ## Declare interrupt handlers |
173 | ## Declare interrupt handlers |
174 | # |
174 | # |
175 | # Declare interrupt handlers for n interrupt |
175 | # Declare interrupt handlers for n interrupt |
176 | # vectors starting at vector i. |
176 | # vectors starting at vector i. |
177 | # |
177 | # |
178 | # The handlers setup data segment registers |
178 | # The handlers setup data segment registers |
179 | # and call trap_dispatcher(). |
179 | # and call trap_dispatcher(). |
180 | # |
180 | # |
181 | .macro handler i n |
181 | .macro handler i n |
182 | push %ebp |
182 | push %ebp |
183 | movl %esp,%ebp |
183 | movl %esp,%ebp |
184 | pusha |
184 | pusha |
185 | 185 | ||
186 | push %ds |
186 | push %ds |
187 | push %es |
187 | push %es |
188 | 188 | ||
189 | # we must fill the data segment registers |
189 | # we must fill the data segment registers |
190 | movw $16,%ax |
190 | movw $16,%ax |
191 | movw %ax,%ds |
191 | movw %ax,%ds |
192 | movw %ax,%es |
192 | movw %ax,%es |
193 | 193 | ||
194 | movl $(\i),%edi |
194 | movl $(\i),%edi |
195 | pushl %ebp |
195 | pushl %ebp |
196 | addl $4,(%esp) |
196 | addl $4,(%esp) |
197 | pushl %edi |
197 | pushl %edi |
198 | call trap_dispatcher |
198 | call trap_dispatcher |
199 | addl $8,%esp |
199 | addl $8,%esp |
200 | 200 | ||
201 | pop %es |
201 | pop %es |
202 | pop %ds |
202 | pop %ds |
203 | 203 | ||
204 | popa |
204 | popa |
205 | pop %ebp |
205 | pop %ebp |
206 | 206 | ||
207 | iret |
207 | iret |
208 | 208 | ||
209 | .if (\n-\i)-1 |
209 | .if (\n-\i)-1 |
210 | handler "(\i+1)",\n |
210 | handler "(\i+1)",\n |
211 | .endif |
211 | .endif |
212 | .endm |
212 | .endm |
213 | 213 | ||
214 | # keep in sync with pm.h !!! |
214 | # keep in sync with pm.h !!! |
215 | IDT_ITEMS=64 |
215 | IDT_ITEMS=64 |
216 | interrupt_handlers: |
216 | interrupt_handlers: |
217 | h_start: |
217 | h_start: |
218 | handler 0 64 |
218 | handler 0 64 |
219 | # handler 64 128 |
219 | # handler 64 128 |
220 | # handler 128 192 |
220 | # handler 128 192 |
221 | # handler 192 256 |
221 | # handler 192 256 |
222 | h_end: |
222 | h_end: |
223 | 223 | ||
224 | 224 | ||
225 | ## I/O input (byte) |
225 | ## I/O input (byte) |
226 | # |
226 | # |
227 | # Get a byte from I/O port and store it AL. |
227 | # Get a byte from I/O port and store it AL. |
228 | # |
228 | # |
229 | inb: |
229 | inb: |
230 | push %edx |
230 | push %edx |
231 | xorl %eax,%eax |
231 | xorl %eax,%eax |
232 | movl 8(%esp),%edx |
232 | movl 8(%esp),%edx |
233 | inb %dx,%al |
233 | inb %dx,%al |
234 | pop %edx |
234 | pop %edx |
235 | ret |
235 | ret |
236 | 236 | ||
237 | 237 | ||
238 | ## I/O input (word) |
238 | ## I/O input (word) |
239 | # |
239 | # |
240 | # Get a word from I/O port and store it AX. |
240 | # Get a word from I/O port and store it AX. |
241 | # |
241 | # |
242 | inw: |
242 | inw: |
243 | push %edx |
243 | push %edx |
244 | xorl %eax,%eax |
244 | xorl %eax,%eax |
245 | movl 8(%esp),%edx |
245 | movl 8(%esp),%edx |
246 | inw %dx,%ax |
246 | inw %dx,%ax |
247 | pop %edx |
247 | pop %edx |
248 | ret |
248 | ret |
249 | 249 | ||
250 | 250 | ||
251 | ## I/O input (dword) |
251 | ## I/O input (dword) |
252 | # |
252 | # |
253 | # Get a dword from I/O port and store it EAX. |
253 | # Get a dword from I/O port and store it EAX. |
254 | # |
254 | # |
255 | inl: |
255 | inl: |
256 | push %edx |
256 | push %edx |
257 | xorl %eax,%eax |
257 | xorl %eax,%eax |
258 | movl 8(%esp),%edx |
258 | movl 8(%esp),%edx |
259 | inl %dx,%eax |
259 | inl %dx,%eax |
260 | pop %edx |
260 | pop %edx |
261 | ret |
261 | ret |
262 | 262 | ||
263 | 263 | ||
264 | ## I/O output (byte) |
264 | ## I/O output (byte) |
265 | # |
265 | # |
266 | # Send a byte to I/O port. |
266 | # Send a byte to I/O port. |
267 | # |
267 | # |
268 | outb: |
268 | outb: |
269 | push %ebp |
269 | push %ebp |
270 | movl %esp,%ebp |
270 | movl %esp,%ebp |
271 | pusha |
271 | pusha |
272 | 272 | ||
273 | movl 8(%ebp),%edx |
273 | movl 8(%ebp),%edx |
274 | movl 12(%ebp),%eax |
274 | movl 12(%ebp),%eax |
275 | outb %al,%dx |
275 | outb %al,%dx |
276 | 276 | ||
277 | popa |
277 | popa |
278 | pop %ebp |
278 | pop %ebp |
279 | ret |
279 | ret |
280 | 280 | ||
281 | 281 | ||
282 | ## I/O output (word) |
282 | ## I/O output (word) |
283 | # |
283 | # |
284 | # Send a word to I/O port. |
284 | # Send a word to I/O port. |
285 | # |
285 | # |
286 | outw: |
286 | outw: |
287 | push %ebp |
287 | push %ebp |
288 | movl %esp,%ebp |
288 | movl %esp,%ebp |
289 | pusha |
289 | pusha |
290 | 290 | ||
291 | movl 8(%ebp),%edx |
291 | movl 8(%ebp),%edx |
292 | movl 12(%ebp),%eax |
292 | movl 12(%ebp),%eax |
293 | outw %ax,%dx |
293 | outw %ax,%dx |
294 | 294 | ||
295 | popa |
295 | popa |
296 | pop %ebp |
296 | pop %ebp |
297 | ret |
297 | ret |
298 | 298 | ||
299 | 299 | ||
300 | ## I/O output (dword) |
300 | ## I/O output (dword) |
301 | # |
301 | # |
302 | # Send a dword to I/O port. |
302 | # Send a dword to I/O port. |
303 | # |
303 | # |
304 | outl: |
304 | outl: |
305 | push %ebp |
305 | push %ebp |
306 | movl %esp,%ebp |
306 | movl %esp,%ebp |
307 | pusha |
307 | pusha |
308 | 308 | ||
309 | movl 8(%ebp),%edx |
309 | movl 8(%ebp),%edx |
310 | movl 12(%ebp),%eax |
310 | movl 12(%ebp),%eax |
311 | outl %eax,%dx |
311 | outl %eax,%dx |
312 | 312 | ||
313 | popa |
313 | popa |
314 | pop %ebp |
314 | pop %ebp |
315 | ret |
315 | ret |
316 | 316 | ||
317 | 317 | ||
318 | ## Copy memory |
318 | ## Copy memory |
319 | # |
319 | # |
320 | # Copy a given number of bytes (3rd argument) |
320 | # Copy a given number of bytes (3rd argument) |
321 | # from the memory location defined by 1st argument |
321 | # from the memory location defined by 1st argument |
322 | # to the memory location defined by 2nd argument. |
322 | # to the memory location defined by 2nd argument. |
323 | # The memory areas cannot overlap. |
323 | # The memory areas cannot overlap. |
324 | # |
324 | # |
325 | SRC=8 |
325 | SRC=8 |
326 | DST=12 |
326 | DST=12 |
327 | CNT=16 |
327 | CNT=16 |
328 | memcopy: |
328 | memcopy: |
329 | push %ebp |
329 | push %ebp |
330 | movl %esp,%ebp |
330 | movl %esp,%ebp |
331 | pusha |
331 | pusha |
332 | 332 | ||
333 | cld |
333 | cld |
334 | movl CNT(%ebp),%ecx |
334 | movl CNT(%ebp),%ecx |
335 | movl DST(%ebp),%edi |
335 | movl DST(%ebp),%edi |
336 | movl SRC(%ebp),%esi |
336 | movl SRC(%ebp),%esi |
337 | 337 | ||
338 | rep movsb %ds:(%esi),%es:(%edi) |
338 | rep movsb %ds:(%esi),%es:(%edi) |
339 | 339 | ||
340 | popa |
340 | popa |
341 | pop %ebp |
341 | pop %ebp |
342 | ret |
342 | ret |
343 | 343 | ||
344 | 344 | ||
345 | ## Fill memory with bytes |
345 | ## Fill memory with bytes |
346 | # |
346 | # |
347 | # Fill a given number of bytes (2nd argument) |
347 | # Fill a given number of bytes (2nd argument) |
348 | # at memory defined by 1st argument with the |
348 | # at memory defined by 1st argument with the |
349 | # byte value defined by 3rd argument. |
349 | # byte value defined by 3rd argument. |
350 | # |
350 | # |
351 | DST=8 |
351 | DST=8 |
352 | CNT=12 |
352 | CNT=12 |
353 | X=16 |
353 | X=16 |
354 | memsetb: |
354 | memsetb: |
355 | push %ebp |
355 | push %ebp |
356 | movl %esp,%ebp |
356 | movl %esp,%ebp |
357 | pusha |
357 | pusha |
358 | 358 | ||
359 | cld |
359 | cld |
360 | movl CNT(%ebp),%ecx |
360 | movl CNT(%ebp),%ecx |
361 | movl DST(%ebp),%edi |
361 | movl DST(%ebp),%edi |
362 | movl X(%ebp),%eax |
362 | movl X(%ebp),%eax |
363 | 363 | ||
364 | rep stosb %al,%es:(%edi) |
364 | rep stosb %al,%es:(%edi) |
365 | 365 | ||
366 | popa |
366 | popa |
367 | pop %ebp |
367 | pop %ebp |
368 | ret |
368 | ret |
369 | 369 | ||
370 | 370 | ||
371 | ## Fill memory with words |
371 | ## Fill memory with words |
372 | # |
372 | # |
373 | # Fill a given number of words (2nd argument) |
373 | # Fill a given number of words (2nd argument) |
374 | # at memory defined by 1st argument with the |
374 | # at memory defined by 1st argument with the |
375 | # word value defined by 3rd argument. |
375 | # word value defined by 3rd argument. |
376 | # |
376 | # |
377 | DST=8 |
377 | DST=8 |
378 | CNT=12 |
378 | CNT=12 |
379 | X=16 |
379 | X=16 |
380 | memsetw: |
380 | memsetw: |
381 | push %ebp |
381 | push %ebp |
382 | movl %esp,%ebp |
382 | movl %esp,%ebp |
383 | pusha |
383 | pusha |
384 | 384 | ||
385 | cld |
385 | cld |
386 | movl CNT(%ebp),%ecx |
386 | movl CNT(%ebp),%ecx |
387 | movl DST(%ebp),%edi |
387 | movl DST(%ebp),%edi |
388 | movl X(%ebp),%eax |
388 | movl X(%ebp),%eax |
389 | 389 | ||
390 | rep stosw %ax,%es:(%edi) |
390 | rep stosw %ax,%es:(%edi) |
391 | 391 | ||
392 | popa |
392 | popa |
393 | pop %ebp |
393 | pop %ebp |
394 | ret |
394 | ret |
395 | 395 | ||
396 | 396 | ||
397 | ## Compare memory regions for equality |
397 | ## Compare memory regions for equality |
398 | # |
398 | # |
399 | # Compare a given number of bytes (3rd argument) |
399 | # Compare a given number of bytes (3rd argument) |
400 | # at memory locations defined by 1st and 2nd argument |
400 | # at memory locations defined by 1st and 2nd argument |
401 | # for equality. If the bytes are equal, EAX contains |
401 | # for equality. If the bytes are equal, EAX contains |
402 | # 0. |
402 | # 0. |
403 | # |
403 | # |
404 | SRC=12 |
404 | SRC=12 |
405 | DST=16 |
405 | DST=16 |
406 | CNT=20 |
406 | CNT=20 |
407 | memcmp: |
407 | memcmp: |
408 | push %ebp |
408 | push %ebp |
409 | subl $4,%esp |
409 | subl $4,%esp |
410 | movl %esp,%ebp |
410 | movl %esp,%ebp |
411 | 411 | ||
412 | pusha |
412 | pusha |
413 | 413 | ||
414 | cld |
414 | cld |
415 | movl CNT(%ebp),%ecx |
415 | movl CNT(%ebp),%ecx |
416 | movl DST(%ebp),%edi |
416 | movl DST(%ebp),%edi |
417 | movl SRC(%ebp),%esi |
417 | movl SRC(%ebp),%esi |
418 | 418 | ||
419 | repe cmpsb %es:(%edi),%ds:(%esi) |
419 | repe cmpsb %es:(%edi),%ds:(%esi) |
420 | movl %ecx,(%ebp) |
420 | movl %ecx,(%ebp) |
421 | 421 | ||
422 | popa |
422 | popa |
423 | 423 | ||
424 | movl (%ebp),%eax # return value => %eax (zero on success) |
424 | movl (%ebp),%eax # return value => %eax (zero on success) |
425 | addl $4,%esp |
425 | addl $4,%esp |
426 | pop %ebp |
426 | pop %ebp |
427 | 427 | ||
428 | ret |
428 | ret |
429 | 429 | ||
430 | 430 | ||
431 | # THIS IS USERSPACE CODE |
431 | # THIS IS USERSPACE CODE |
432 | .global utext |
432 | .global utext |
433 | utext: |
433 | utext: |
434 | 0: |
434 | 0: |
435 | # movl $0xdeadbeaf, %eax |
435 | # movl $0xdeadbeaf, %eax |
436 | int $48 |
436 | int $48 |
437 | jmp 0b |
437 | jmp 0b |
438 | # not reached |
438 | # not reached |
439 | utext_end: |
439 | utext_end: |
440 | 440 | ||
441 | .data |
441 | .data |
442 | .global utext_size |
442 | .global utext_size |
443 | utext_size: |
443 | utext_size: |
444 | .long utext_end - utext |
444 | .long utext_end - utext |
445 | 445 | ||
446 | 446 | ||
447 | .section K_DATA_START |
447 | #.section K_DATA_START |
448 | .global interrupt_handler_size |
448 | .global interrupt_handler_size |
449 | 449 | ||
450 | interrupt_handler_size: .long (h_end-h_start)/IDT_ITEMS |
450 | interrupt_handler_size: .long (h_end-h_start)/IDT_ITEMS |
451 | 451 |