Changeset b285860 in rtems


Ignore:
Timestamp:
Aug 31, 1998, 11:03:45 PM (21 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
d9d75fc
Parents:
de9edc4
Message:

Patch from Eric Valette <valette@…>:

Eric> NB : there is still a bug on PC386 serial line : exit does not
Eric> flush the remaining output queue. As this is not a bug in the
Eric> driver itself but somewhere in PC386 initialization/termios
Eric> relationship it will be part of another patch.

Eric> NB2 : As Emmanuel excerced the exception hanlder code, while
Eric> porting the SMC driver to the new BSD stack, we found a bug
Eric> in the exception handler : it shall not delete the current
Eric> thread in case we are running at interrupt level. This will
Eric> be part of another patch...

So here is the patch. This patch fixes the two problems mentionned above

+ it use vpath mechanism intead of copying the irq related files in

the right directory. This avoid to compile them each time and is
more homogenous with other Makefiles.

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/score/cpu/i386/cpu.c

    rde9edc4 rb285860  
    105105         ctx->faultCode);
    106106  printk("----------------------------------------------------------\n\n");
    107   printk(" ************ FAULTY THREAD WILL BE DELETED **************\n");
    108   /*
    109    * OK I could probably use a simplified version but at least this
    110    * should work.
    111    */
    112   rtems_task_delete(_Thread_Executing->Object.id);
     107  if (_ISR_Nest_level > 0) {
     108    /*
     109     * In this case we shall not delete the task interrupted as
     110     * it has nothing to do with the fault. We cannot return either
     111     * because the eip points to the faulty instruction so...
     112     */
     113    printk("Exception while executing ISR!!!. System locked\n");
     114    while(1);
     115  }
     116  else {
     117    /*
     118     * OK I could probably use a simplified version but at least this
     119     * should work.
     120     */
     121    printk(" ************ FAULTY THREAD WILL BE DELETED **************\n");
     122    rtems_task_delete(_Thread_Executing->Object.id);
     123  }
    113124}
    114125
  • c/src/lib/libbsp/i386/pc386/console/Makefile.in

    rde9edc4 rb285860  
    55@SET_MAKE@
    66srcdir = @srcdir@
    7 VPATH = @srcdir@
     7VPATH = @srcdir@:@srcdir@/../../shared/io
    88RTEMS_ROOT = @top_srcdir@
    99PROJECT_ROOT = @PROJECT_ROOT@
    1010
    1111PGM=${ARCH}/console.rel
    12 
    13 IMPORT_SRC=$(srcdir)/../../shared/io/printk.c
    1412
    1513# C source names, if any, go here -- minus the .c
     
    5351CLOBBER_ADDITIONS +=
    5452
    55 preinstall:
    56         ${CP} ${IMPORT_SRC} .
    57 
    5853${PGM}: ${SRCS} ${OBJS}
    5954        $(make-rel)
    6055
    61 all:    ${ARCH} preinstall $(SRCS) $(PGM)
     56all:    ${ARCH} $(SRCS) $(PGM)
    6257
    6358# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
  • c/src/lib/libbsp/i386/pc386/console/console.c

    rde9edc4 rb285860  
    5050 */
    5151
    52 int PC386ConsolePort = PC386_UART_COM2;
     52int PC386ConsolePort = PC386_CONSOLE_PORT_CONSOLE;
    5353
    5454static int conSetAttr(int minor, const struct termios *);
     
    9292   * assert can fail inside ISR too
    9393   */
     94  /*
     95   * Close console
     96   */
     97  __rtems_close(2);
     98  __rtems_close(1);
     99  __rtems_close(0);
     100
    94101  printk("\nassert failed: %s: ", file);
    95102  printk("%d: ", line);
     
    206213
    207214
     215static int console_open_count = 0;
     216
     217static void console_last_close()
     218{
     219  pc386_remove_rtems_irq_handler (&console_isr_data);
     220}
     221
    208222/*-------------------------------------------------------------------------+
    209223| Console device driver OPEN entry point
     
    218232  {
    219233    NULL,                     /* firstOpen */
    220     NULL,                     /* lastClose */
     234    console_last_close,       /* lastClose */
    221235    NULL,                     /* pollRead */
    222236    PC386_uart_termios_write_com1, /* write */
     
    229243  if(PC386ConsolePort == PC386_CONSOLE_PORT_CONSOLE)
    230244    {
     245      ++console_open_count;
    231246      return RTEMS_SUCCESSFUL;
    232247    }
     
    266281{
    267282  rtems_device_driver res = RTEMS_SUCCESSFUL;
    268  
     283
    269284  if(PC386ConsolePort != PC386_CONSOLE_PORT_CONSOLE)
    270285    {
    271286      res =  rtems_termios_close (arg);
    272287    }
    273   pc386_remove_rtems_irq_handler (&console_isr_data);
     288  else {
     289    if (--console_open_count == 0) {
     290      console_last_close();
     291    }
     292  }
    274293 
    275294  return res;
  • c/src/lib/libbsp/i386/pc386/startup/Makefile.in

    rde9edc4 rb285860  
    55@SET_MAKE@
    66srcdir = @srcdir@
    7 VPATH = @srcdir@:@srcdir@/../../../shared
     7VPATH = @srcdir@:@srcdir@/../../../shared:@srcdir@/../../shared/irq
    88RTEMS_ROOT = @top_srcdir@
    99PROJECT_ROOT = @PROJECT_ROOT@
     
    1111PGM=${ARCH}/startup.rel
    1212
    13 IMPORT_SRC=$(srcdir)/../../shared/irq/irq.c \
    14    $(srcdir)/../../shared/irq/irq_init.c $(srcdir)/../../shared/irq/irq_asm.s
    15 
    1613# C source names, if any, go here -- minus the .c
    17 C_PIECES=bspclean bsplibc bsppost bspstart exit irq irq_init main sbrk
     14C_PIECES=bsplibc bsppost bspstart exit irq irq_init main sbrk
    1815C_FILES=$(C_PIECES:%=%.c)
    1916C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
     
    5451CLOBBER_ADDITIONS +=
    5552
    56 preinstall:
    57         ${CP} ${IMPORT_SRC} .
    58 
    5953${PGM}: ${SRCS} ${OBJS}
    6054        $(make-rel)
    61 all:    ${ARCH} preinstall $(SRCS) $(PGM)
     55all:    ${ARCH} $(SRCS) $(PGM)
    6256        $(INSTALL) $(srcdir)/linkcmds ${PROJECT_RELEASE}/lib
    6357
  • c/src/lib/libbsp/i386/pc386/startup/exit.c

    rde9edc4 rb285860  
    3838#include <pc386uart.h>
    3939
    40 /*-------------------------------------------------------------------------+
    41  | Which console is in use: either (-1) which means normal console or
    42  | uart id if uart was used
    43  +-------------------------------------------------------------------------*/
    44 extern int PC386ConsolePort;
    45 
    46 /*-------------------------------------------------------------------------+
    47 | External Prototypes
    48 +--------------------------------------------------------------------------*/
    49 extern rtems_boolean _IBMPC_scankey(char *);  /* defined in 'inch.c' */
    50 
    51 /*-------------------------------------------------------------------------+
    52 |         Function: _exit
    53 |      Description: Shutdown the PC. Called from libc's 'exit'.
    54 | Global Variables: None.
    55 |        Arguments: status - exit status (ignored).
    56 |          Returns: Nothing.
    57 +--------------------------------------------------------------------------*/
    58 void _exit(int status)
     40void bsp_cleanup()
    5941{
    60   unsigned char ch, *cp;
     42  unsigned char ch;
    6143  static   char line[]="EXECUTIVE SHUTDOWN! Any key to reboot...";
    62 
    63   if(PC386ConsolePort == PC386_CONSOLE_PORT_CONSOLE)
    64     {
    65 
    66       printk("\n");
    67       printk(line);
    68       while(!_IBMPC_scankey(&ch))
    69         ;
    70       printk("\n\n");
    71     }
    72   else
    73     {
    74       /* Close console */
    75       __rtems_close(2);
    76       __rtems_close(1);
    77       __rtems_close(0);
    78 
    79       PC386_uart_intr_ctrl(PC386ConsolePort, PC386_UART_INTR_CTRL_DISABLE);
    80      
    81       PC386_uart_polled_write(PC386ConsolePort, '\r');
    82       PC386_uart_polled_write(PC386ConsolePort, '\n');
    83      
    84       for(cp=line; *cp != 0; cp++)
    85         {
    86           PC386_uart_polled_write(PC386ConsolePort, *cp);
    87         }
    88 
    89       PC386_uart_polled_read(PC386ConsolePort);
    90 
    91       PC386_uart_polled_write(PC386ConsolePort, '\r');
    92       PC386_uart_polled_write(PC386ConsolePort, '\n');
    93       PC386_uart_polled_write(PC386ConsolePort, '\r');
    94       PC386_uart_polled_write(PC386ConsolePort, '\n');
    95     }
    96 
     44  /*
     45   * AT this point, the console driver is disconnected => we must
     46   * use polled output/input. This is exactly what printk
     47   * does.
     48   */
     49  printk("\n");
     50  printk(line);
     51  ch = BSP_poll_char();
    9752  rtemsReboot();
    98 } /* _exit */
     53}
    9954
    10055
     
    10257
    10358
    104 
    105 
  • cpukit/score/cpu/i386/cpu.c

    rde9edc4 rb285860  
    105105         ctx->faultCode);
    106106  printk("----------------------------------------------------------\n\n");
    107   printk(" ************ FAULTY THREAD WILL BE DELETED **************\n");
    108   /*
    109    * OK I could probably use a simplified version but at least this
    110    * should work.
    111    */
    112   rtems_task_delete(_Thread_Executing->Object.id);
     107  if (_ISR_Nest_level > 0) {
     108    /*
     109     * In this case we shall not delete the task interrupted as
     110     * it has nothing to do with the fault. We cannot return either
     111     * because the eip points to the faulty instruction so...
     112     */
     113    printk("Exception while executing ISR!!!. System locked\n");
     114    while(1);
     115  }
     116  else {
     117    /*
     118     * OK I could probably use a simplified version but at least this
     119     * should work.
     120     */
     121    printk(" ************ FAULTY THREAD WILL BE DELETED **************\n");
     122    rtems_task_delete(_Thread_Executing->Object.id);
     123  }
    113124}
    114125
Note: See TracChangeset for help on using the changeset viewer.