]> Zhao Yanbai Git Server - minix.git/commitdiff
added code to un-register tty's interrupt at exit time; fixed compiler
authorBen Gras <ben@minix3.org>
Thu, 12 May 2005 16:03:43 +0000 (16:03 +0000)
committerBen Gras <ben@minix3.org>
Thu, 12 May 2005 16:03:43 +0000 (16:03 +0000)
warnings

drivers/tty/keyboard.c
drivers/tty/pty.c
drivers/tty/tty.c
drivers/tty/tty.h

index a8bf03aa159b9500c864e8d4d02f63bad7beb89f..5aaacced711b2d068dd2a8742401d19f909a50cd 100644 (file)
@@ -18,6 +18,8 @@
 #include "../../kernel/kernel.h"
 #include "../../kernel/proc.h"
 
+int irq_hook_id = -1;
+
 /* Standard and AT keyboard.  (PS/2 MCA implies AT throughout.) */
 #define KEYBD          0x60    /* I/O port for keyboard data */
 
@@ -363,7 +365,6 @@ tty_t *tp;
 {
 /* Initialize the keyboard driver. */
   static int count = 0;
-  int irq_hook_id;
   int i;
 
   tp->tty_devread = kb_read;   /* input function */
@@ -381,7 +382,7 @@ tty_t *tp;
 
       /* Set interrupt handler and enable keyboard IRQ. */
       if ((i=sys_irqsetpolicy(KEYBOARD_IRQ, IRQ_REENABLE, &irq_hook_id)) != OK)
-          server_panic("TTY", "Couldn't set keyboard IRQ policy", i);
+          server_panic("TTY",  "Couldn't set keyboard IRQ policy", i);
       if ((i=sys_irqenable(&irq_hook_id)) != OK)
           server_panic("TTY", "Couldn't enable keyboard IRQs", i);
   }
index def5b145325043eaa5a0f27a415a2824da80478b..e5e74ef1cde7b27de6bd8021923e8cc6a1bf0a51 100644 (file)
@@ -100,7 +100,7 @@ message *m_ptr;
        if (numap_local(m_ptr->PROC_NR, (vir_bytes) m_ptr->ADDRESS,
                                                        m_ptr->COUNT) == 0) {
 #else
-       if ((r = sys_umap(m_ptr->PROC_NR, D, m_ptr->ADDRESS,
+       if ((r = sys_umap(m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
                m_ptr->COUNT, &p)) != OK) {
 #endif
                break;
@@ -142,7 +142,7 @@ message *m_ptr;
                                                        m_ptr->COUNT) == 0) {
                r = EFAULT;
 #else
-       if ((r = sys_umap(m_ptr->PROC_NR, D, m_ptr->ADDRESS,
+       if ((r = sys_umap(m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
                m_ptr->COUNT, &p)) != OK) {
 #endif
                break;
@@ -234,8 +234,8 @@ tty_t *tp;
        user_phys = proc_vir2phys(proc_addr(tp->tty_outproc), tp->tty_out_vir);
        phys_copy(user_phys, vir2phys(pp->ohead), (phys_bytes) count);
 #else
-       if((s = sys_vircopy(tp->tty_outproc, D, tp->tty_out_vir,
-               SELF, D, pp->ohead, (phys_bytes) count)) != OK) {
+       if((s = sys_vircopy(tp->tty_outproc, D, (vir_bytes) tp->tty_out_vir,
+               SELF, D, (vir_bytes) pp->ohead, (phys_bytes) count)) != OK) {
                printf("pty tty%d: copy failed (error %d)\n",  s);
                break;
        }
@@ -314,8 +314,8 @@ pty_t *pp;
        user_phys = proc_vir2phys(proc_addr(pp->rdproc), pp->rdvir);
        phys_copy(vir2phys(pp->otail), user_phys, (phys_bytes) count);
 #endif
-       if((s = sys_vircopy(SELF, D, pp->otail,
-               pp->rdproc, D, pp->rdvir, (phys_bytes) count)) != OK) {
+       if((s = sys_vircopy(SELF, D, (vir_bytes)pp->otail,
+               (vir_bytes) pp->rdproc, D, (vir_bytes) pp->rdvir, (phys_bytes) count)) != OK) {
                printf("pty tty%d: copy failed (error %d)\n",  s);
                break;
        }
@@ -376,8 +376,8 @@ tty_t *tp;
        user_phys = proc_vir2phys(proc_addr(pp->wrproc), pp->wrvir);
        phys_copy(user_phys, vir2phys(&c), 1L);
 #endif
-       if((s = sys_vircopy(pp->wrproc, D, pp->wrvir,
-               SELF, D, &c, (phys_bytes) 1)) != OK) {
+       if((s = sys_vircopy(pp->wrproc, D, (vir_bytes) pp->wrvir,
+               SELF, D, (vir_bytes) &c, (phys_bytes) 1)) != OK) {
                printf("pty: copy failed (error %d)\n", s);
                break;
        }
index 77ab6ad4e2610306220282ac3a39961ad5410f39..03b527077f5a378d9f98d68e2a7c159a1b0da55b 100644 (file)
@@ -66,6 +66,8 @@
 #endif
 #include "tty.h"
 
+extern int irq_hook_id;
+
 /* Address of a tty structure. */
 #define tty_addr(line) (&tty_table[line])
 
@@ -204,6 +206,11 @@ PUBLIC void main(void)
                if (! stop++) {
                        cons_stop();    /* first switch to primary console */
                } else {
+                       if(irq_hook_id != -1) {
+                               int r;
+                               r = sys_irqdisable(&irq_hook_id);
+                               r = sys_irqrmpolicy(KEYBOARD_IRQ, &irq_hook_id);
+                       }
                        printf("[DONE]\n");
                        printf("MINIX will now be shutdown.\n");
                        sys_exit(0);    /* then exit TTY */
index f28b4930e04ab8ae20caff0b8a3d4aa256a24c17..d931cb4fa32a4969ad9ca9726f9d8a6ab5f5c1ed 100644 (file)
@@ -75,6 +75,7 @@ typedef struct tty {
 /* Memory allocated in tty.c, so extern here. */
 extern tty_t tty_table[NR_CONS+NR_RS_LINES+NR_PTYS];
 extern int ccurrent;           /* currently visible console */
+extern int irq_hook_id;                /* hook id for keyboard irq */
 
 /* Values for the fields. */
 #define NOT_ESCAPED        0   /* previous character is not LNEXT (^V) */