Changeset 36e7ee98 in mainline


Ignore:
Timestamp:
2005-12-15T21:32:12Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cddc1639
Parents:
49b6d32
Message:

Fixed cpu halting in debug panic mode.

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/include/atomic.h

    r49b6d32 r36e7ee98  
    3232#include <arch/types.h>
    3333
    34 typedef struct { volatile __u32 count; } atomic_t;
     34typedef struct { volatile __u64 count; } atomic_t;
    3535
    36 static inline void atomic_set(atomic_t *val, __u32 i)
     36static inline void atomic_set(atomic_t *val, __u64 i)
    3737{
    3838        val->count = i;
    3939}
    4040
    41 static inline __u32 atomic_get(atomic_t *val)
     41static inline __u64 atomic_get(atomic_t *val)
    4242{
    4343        return val->count;
     
    8080                "movl $-1, %0\n"
    8181                "lock xaddl %0, %1\n"
    82                 : "=r" (r), "=m" (*val)
     82                : "=r" (r), "=m" (val->count)
    8383        );
    8484       
  • arch/mips32/src/debugger.c

    r49b6d32 r36e7ee98  
    257257        printf("***Type 'exit' to exit kconsole.\n");
    258258        /* Umm..we should rather set some 'debugstate' here */
    259         haltstate = 1;
     259        atomic_set(&haltstate,1);
    260260        kconsole("debug");
    261         haltstate = 0;
    262 }
     261        atomic_set(&haltstate,0);
     262}
  • generic/include/func.h

    r49b6d32 r36e7ee98  
    3232#include <arch/types.h>
    3333#include <typedefs.h>
     34#include <arch/atomic.h>
    3435
    35 extern volatile __u32 haltstate;
     36extern atomic_t haltstate;
    3637
    3738extern void halt(void);
  • generic/src/console/console.c

    r49b6d32 r36e7ee98  
    3737#include <func.h>
    3838#include <print.h>
     39#include <arch/atomic.h>
    3940
    4041/** Standard input character device. */
     
    5354        ipl_t ipl;
    5455
    55         if (haltstate) {
     56        if (atomic_get(&haltstate)) {
    5657                /* If we are here, we are hopefully on the processor, that
    5758                 * issued the 'halt' command, so proceed to read the character
     
    6162                        return chardev->op->read(chardev);
    6263                /* no other way of interacting with user, halt */
    63                 printf("cpu: halted - no kconsole\n");
     64                if (CPU)
     65                        printf("cpu%d: ", CPU->id);
     66                else
     67                        printf("cpu: ");
     68                printf("halted - no kconsole\n");
    6469                cpu_halt();
    6570        }
  • generic/src/lib/func.c

    r49b6d32 r36e7ee98  
    3535#include <console/kconsole.h>
    3636
    37 __u32 volatile haltstate = 0; /**< Halt flag */
     37atomic_t haltstate = {0}; /**< Halt flag */
    3838
    3939
     
    4343 *
    4444 */
    45 void halt(void)
     45void halt()
    4646{
    47         haltstate = 1;
     47#ifdef CONFIG_DEBUG
     48        bool rundebugger;
     49
     50//      TODO test_and_set not defined on all arches
     51//      if (!test_and_set(&haltstate))
     52        if (!atomic_get(&haltstate)) {
     53                atomic_set(&haltstate, 1);
     54                rundebugger = true;
     55        }
     56#else
     57        atomic_set(haltstate, 1);
     58#endif
     59
    4860        interrupts_disable();
    4961#ifdef CONFIG_DEBUG
    50         printf("\n");
    51         kconsole("panic"); /* Run kconsole as a last resort to user */
     62        if (rundebugger) {
     63                printf("\n");
     64                kconsole("panic"); /* Run kconsole as a last resort to user */
     65        }
    5266#endif     
    53 
    5467        if (CPU)
    5568                printf("cpu%d: halted\n", CPU->id);
  • generic/src/proc/scheduler.c

    r49b6d32 r36e7ee98  
    407407        ipl = interrupts_disable();
    408408
    409         if (haltstate)
     409        if (atomic_get(&haltstate))
    410410                halt();
    411411
Note: See TracChangeset for help on using the changeset viewer.