|
|
1.1 root 1: /*
2: * Copyright (c) 1995 The University of Utah and
3: * the Computer Systems Laboratory at the University of Utah (CSL).
4: * All rights reserved.
5: *
6: * Permission to use, copy, modify and distribute this software is hereby
7: * granted provided that (1) source code retains these copyright, permission,
8: * and disclaimer notices, and (2) redistributions including binaries
9: * reproduce the notices in supporting documentation, and (3) all advertising
10: * materials mentioning features or use of this software display the following
11: * acknowledgement: ``This product includes software developed by the
12: * Computer Systems Laboratory at the University of Utah.''
13: *
14: * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
15: * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
16: * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17: *
18: * CSL requests users of this software to return to [email protected] any
19: * improvements that they make and grant CSL redistribution rights.
20: *
21: * Author: Bryan Ford, University of Utah CSL
22: */
23:
24: #include <mach/machine/asm.h>
25: #include <mach/machine/eflags.h>
26:
27: #include "trap.h"
28: #include "trap_asm.h"
29: #include "pc_asm.h"
30: #include "i386_asm.h"
31:
32: /*
33: * Define a set of interrupt handlers to reflect interrupts to v86 mode.
34: */
35:
36: .text
37:
38: #define master_base 0x08
39: #define slave_base 0x70
40:
41: #define irq(pic,picnum,irqnum) \
42: ENTRY(rv86_reflect_irq##irqnum) ;\
43: pushl $pic##_base+picnum ;\
44: pushl $0x80000000+irqnum /* (for debug) */ ;\
45: jmp allintrs
46:
47: #include "irq_list.h"
48:
49:
50: allintrs:
51: pusha
52: pushl %ds
53: pushl %es
54: pushl %fs
55: pushl %gs
56:
57: /* Load the normal kernel segment registers. */
58: movw %ss,%ax
59: movw %ax,%ds
60: movw %ax,%es
61:
62: /* See if we came from v86 mode. */
63: testl $EFL_VM,TR_EFLAGS(%esp)
64: jnz int_from_v86
65:
66: movl TR_ERR(%esp),%eax
67: pushl $dummy_rcd
68: pushl %eax
69: call EXT(rv86_real_int)
70: addl $2*4,%esp
71:
72: popl %gs
73: popl %fs
74: popl %es
75: popl %ds
76: popa
77: addl $2*4,%esp
78: iret
79:
80: int_from_v86:
81:
82: /* Save the v86 stack pointer before handling the interrupt.
83: We need this in order to handle recursive reflected interrupts
84: possibly interspersed with protected-mode interrupts. */
85: movl EXT(rv86_usp),%esi
86: movl EXT(rv86_usp)+4,%edi
87: movl EXT(real_tss)+TSS_ESP0,%ebx
88:
89: movl TR_ESP(%esp),%eax
90: subw $6,%ax /* allocate a real-mode interrupt stack frame. */
91: movl %eax,EXT(rv86_usp)
92: movl TR_SS(%esp),%eax
93: movw %ax,EXT(rv86_usp)+4
94:
95: movl TR_ERR(%esp),%eax
96: pushl $dummy_rcd
97: pushl %eax
98: call EXT(rv86_real_int)
99: addl $2*4,%esp
100:
101: movl %esi,EXT(rv86_usp)
102: movl %edi,EXT(rv86_usp)+4
103: movl %ebx,EXT(real_tss)+TSS_ESP0
104:
105: addl $4*4,%esp
106: popa
107: addl $2*4,%esp
108: iret
109:
110: /* Dummy real_call_data structure (always all zero)
111: to use when reflecting hardware interrupts. */
112: .comm dummy_rcd,RCD_SIZE
113:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.