1
0
Эх сурвалжийг харах

tty在多核下卡死问题修复

linzhenxing 4 жил өмнө
parent
commit
3c305857b1

+ 3 - 3
components/drivers/tty/n_tty.c

@@ -791,7 +791,8 @@ static size_t __process_echoes(struct tty_struct *tty)
     size_t tail = 0;
     unsigned char c = 0;
     char ch = 0;
-
+    unsigned char num_chars = 0, num_bs = 0;
+    
     tail = ldata->echo_tail;
     while (ldata->echo_commit != tail)
     {
@@ -809,8 +810,6 @@ static size_t __process_echoes(struct tty_struct *tty)
 
             switch (op)
             {
-                unsigned char num_chars = 0, num_bs = 0;
-
             case ECHO_OP_ERASE_TAB:
                 num_chars = echo_buf(ldata, tail + 2);
 
@@ -1846,6 +1845,7 @@ static int n_tty_read(struct dfs_fd *fd, void *buf, size_t count)
     c = job_control(tty);
     if (c < 0)
     {
+        rt_hw_interrupt_enable(level);
         return c;
     }
 

+ 1 - 2
components/drivers/tty/pty.c

@@ -308,8 +308,7 @@ static int ptmx_register(void)
 
     level = rt_hw_interrupt_disable();
     RT_ASSERT(ptm_drv->init_flag == TTY_INIT_FLAG_NONE);
-
-    level = rt_hw_interrupt_disable();
+    
     device = &(ptm_drv->parent);
 
     device->type = RT_Device_Class_Char;

+ 2 - 0
components/drivers/tty/tty.c

@@ -79,11 +79,13 @@ int __tty_check_change(struct tty_struct *tty, int sig)
     level = rt_hw_interrupt_disable();
     if (current == RT_NULL)
     {
+        rt_hw_interrupt_enable(level);
         return 0;
     }
 
     if (current->tty != tty)
     {
+        rt_hw_interrupt_enable(level);
         return 0;
     }