Changeset 40043e8 in mainline


Ignore:
Timestamp:
2019-07-18T08:25:42Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
0116f21
Parents:
2cc569a3
Message:

Restructering halt/reboot files

The function halt() and reboot() used to be stored
in two different c files and two different header
files which were named differently than the c files.
This commit merges those two functions into the
same file and provides an unique header file (shutdown.h)
for accessing them.

Location:
kernel
Files:
1 deleted
9 edited
1 moved

Legend:

Unmodified
Added
Removed
  • kernel/Makefile

    r2cc569a3 r40043e8  
    179179        generic/src/interrupt/interrupt.c \
    180180        generic/src/log/log.c \
     181        generic/src/main/kinit.c \
    181182        generic/src/main/main.c \
    182         generic/src/main/kinit.c \
     183        generic/src/main/shutdown.c \
    183184        generic/src/main/uinit.c \
    184185        generic/src/main/version.c \
    185         generic/src/main/shutdown.c \
    186186        generic/src/proc/current.c \
    187187        generic/src/proc/program.c \
     
    203203        generic/src/mm/backend_user.c \
    204204        generic/src/mm/slab.c \
    205         generic/src/lib/halt.c \
    206205        generic/src/lib/mem.c \
    207206        generic/src/lib/memfnc.c \
  • kernel/arch/mips32/src/debugger.c

    r2cc569a3 r40043e8  
    4242#include <arch.h>
    4343#include <arch/cp0.h>
    44 #include <halt.h>
    4544#include <symtab.h>
    4645
  • kernel/arch/sparc64/src/smp/sun4v/smp.c

    r2cc569a3 r40043e8  
    4343#include <config.h>
    4444#include <macros.h>
    45 #include <halt.h>
    4645#include <stdbool.h>
    4746#include <stddef.h>
  • kernel/generic/include/arch.h

    r2cc569a3 r40043e8  
    3838#include <arch/asm.h>   /* get_stack_base() */
    3939#include <config.h>
     40#include <shutdown.h>
    4041
    4142/*
     
    9697extern void calibrate_delay_loop(void);
    9798
    98 extern void reboot(void);
    99 extern void arch_reboot(void);
    10099extern void *arch_construct_function(fncptr_t *, void *, void *);
    101100
  • kernel/generic/include/shutdown.h

    r2cc569a3 r40043e8  
    3333 */
    3434
    35 #ifndef KERN_HALT_H_
    36 #define KERN_HALT_H_
     35#ifndef KERN_SHUTDOWN_H_
     36#define KERN_SHUTDOWN_H_
    3737
    3838#include <atomic.h>
     
    4141
    4242extern void halt(void) __attribute__((noreturn));
     43extern void reboot(void);
     44extern void arch_reboot(void);
    4345
    4446#endif
  • kernel/generic/src/console/chardev.c

    r2cc569a3 r40043e8  
    3939#include <synch/spinlock.h>
    4040#include <stdio.h>
    41 #include <halt.h>
     41#include <shutdown.h>
    4242#include <cpu.h>
    4343
  • kernel/generic/src/console/cmd.c

    r2cc569a3 r40043e8  
    5252#include <arch.h>
    5353#include <config.h>
    54 #include <halt.h>
    5554#include <str.h>
    5655#include <macros.h>
  • kernel/generic/src/debug/panic.c

    r2cc569a3 r40043e8  
    3636#include <stdio.h>
    3737#include <stacktrace.h>
    38 #include <halt.h>
     38#include <shutdown.h>
    3939#include <typedefs.h>
    4040#include <mm/as.h>
  • kernel/generic/src/main/shutdown.c

    r2cc569a3 r40043e8  
    11/*
    22 * Copyright (c) 2007 Martin Decky
     3 * Copyright (c) 2001-2004 Jakub Jermar
    34 * All rights reserved.
    45 *
     
    3637 */
    3738
     39#include <shutdown.h>
     40#include <log.h>
     41#include <cpu.h>
     42#include <arch/asm.h>
    3843#include <arch.h>
     44#include <console/kconsole.h>
    3945#include <proc/task.h>
    40 #include <halt.h>
    41 #include <log.h>
     46
     47/** Halt flag */
     48atomic_t haltstate = 0;
     49
     50/** Halt wrapper
     51 *
     52 * Set halt flag and halt the CPU.
     53 *
     54 */
     55void halt(void)
     56{
     57#if (defined(CONFIG_DEBUG)) && (defined(CONFIG_KCONSOLE))
     58        bool rundebugger = false;
     59
     60        if (!atomic_load(&haltstate)) {
     61                atomic_store(&haltstate, 1);
     62                rundebugger = true;
     63        }
     64#else
     65        atomic_store(&haltstate, 1);
     66#endif
     67
     68        interrupts_disable();
     69
     70#if (defined(CONFIG_DEBUG)) && (defined(CONFIG_KCONSOLE))
     71        if ((rundebugger) && (kconsole_check_poll()))
     72                kconsole("panic", "\nLast resort kernel console ready.\n", false);
     73#endif
     74
     75        if (CPU)
     76                log(LF_OTHER, LVL_NOTE, "cpu%u: halted", CPU->id);
     77        else
     78                log(LF_OTHER, LVL_NOTE, "cpu: halted");
     79
     80        cpu_halt();
     81}
    4282
    4383void reboot(void)
  • kernel/generic/src/proc/scheduler.c

    r2cc569a3 r40043e8  
    5757#include <context.h>
    5858#include <fpu_context.h>
    59 #include <halt.h>
     59#include <shutdown.h>
    6060#include <arch.h>
    6161#include <adt/list.h>
Note: See TracChangeset for help on using the changeset viewer.