Changeset 0132630 in mainline


Ignore:
Timestamp:
2006-01-03T21:55:31Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b524c5e0
Parents:
93e90c7
Message:

Add 'version' and 'cpus' kconsole commands.
Remove leading p from names of p* commands.

Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r93e90c7 r0132630  
    107107        generic/src/main/kinit.c \
    108108        generic/src/main/uinit.c \
     109        generic/src/main/version.c \
    109110        generic/src/proc/scheduler.c \
    110111        generic/src/proc/thread.c \
  • arch/mips32/src/debugger.c

    r93e90c7 r0132630  
    4242
    4343static int cmd_print_breakpoints(cmd_arg_t *argv);
    44 static cmd_info_t pbkpt_info = {
    45         .name = "pbkpt",
     44static cmd_info_t bkpts_info = {
     45        .name = "bkpts",
    4646        .description = "Print breakpoint table.",
    4747        .func = cmd_print_breakpoints,
     
    265265                breakpoints[i].address = NULL;
    266266       
    267         cmd_initialize(&pbkpt_info);
    268         if (!cmd_register(&pbkpt_info))
    269                 panic("could not register command %s\n", pbkpt_info.name);
     267        cmd_initialize(&bkpts_info);
     268        if (!cmd_register(&bkpts_info))
     269                panic("could not register command %s\n", bkpts_info.name);
    270270
    271271        cmd_initialize(&delbkpt_info);
  • generic/include/cpu.h

    r93e90c7 r0132630  
    7575
    7676extern void cpu_init(void);
     77extern void cpu_list(void);
    7778
    7879extern void cpu_arch_init(void);
  • generic/src/console/cmd.c

    r93e90c7 r0132630  
    4646#include <debug.h>
    4747#include <symtab.h>
    48 
     48#include <cpu.h>
    4949#include <mm/tlb.h>
    5050#include <arch/mm/tlb.h>
    5151#include <mm/frame.h>
     52#include <main/version.h>
    5253
    5354/** Data and methods for 'help' command. */
     
    119120        .argv = set4_argv
    120121};
    121 
    122 
    123122
    124123/** Data and methods for 'call0' command. */
     
    233232};
    234233
    235 /** Data and methods for 'ptlb' command. */
    236 static int cmd_ptlb(cmd_arg_t *argv);
    237 cmd_info_t ptlb_info = {
    238         .name = "ptlb",
     234/** Data and methods for 'tlb' command. */
     235static int cmd_tlb(cmd_arg_t *argv);
     236cmd_info_t tlb_info = {
     237        .name = "tlb",
    239238        .description = "Print TLB of current processor.",
    240239        .help = NULL,
    241         .func = cmd_ptlb,
     240        .func = cmd_tlb,
    242241        .argc = 0,
    243242        .argv = NULL
     
    263262};
    264263
    265 
    266264static cmd_info_t zone_info = {
    267265        .name = "zone",
     
    272270};
    273271
     272/** Data and methods for 'cpus' command. */
     273static int cmd_cpus(cmd_arg_t *argv);
     274cmd_info_t cpus_info = {
     275        .name = "cpus",
     276        .description = "List all processors.",
     277        .help = NULL,
     278        .func = cmd_cpus,
     279        .argc = 0,
     280        .argv = NULL
     281};
     282
     283/** Data and methods for 'version' command. */
     284static int cmd_version(cmd_arg_t *argv);
     285cmd_info_t version_info = {
     286        .name = "version",
     287        .description = "Print version information.",
     288        .help = NULL,
     289        .func = cmd_version,
     290        .argc = 0,
     291        .argv = NULL
     292};
     293
     294
    274295
    275296
     
    328349                panic("could not register command %s\n", halt_info.name);
    329350
    330         cmd_initialize(&ptlb_info);
    331         if (!cmd_register(&ptlb_info))
    332                 panic("could not register command %s\n", ptlb_info.name);
     351        cmd_initialize(&tlb_info);
     352        if (!cmd_register(&tlb_info))
     353                panic("could not register command %s\n", tlb_info.name);
    333354
    334355        cmd_initialize(&zones_info);
     
    340361                panic("could not register command %s\n", zone_info.name);
    341362
     363        cmd_initialize(&cpus_info);
     364        if (!cmd_register(&cpus_info))
     365                panic("could not register command %s\n", cpus_info.name);
     366               
     367        cmd_initialize(&version_info);
     368        if (!cmd_register(&version_info))
     369                panic("could not register command %s\n", version_info.name);
     370               
     371               
    342372
    343373}
     
    539569 * @return Always returns 1.
    540570 */
    541 int cmd_ptlb(cmd_arg_t *argv)
     571int cmd_tlb(cmd_arg_t *argv)
    542572{
    543573        tlb_print();
     
    577607}
    578608
    579 
    580609int cmd_zones(cmd_arg_t * argv) {
    581610        printf("Zones listing not implemented\n");
    582611        return 1;
    583612}
     613
    584614int cmd_zone(cmd_arg_t * argv) {
    585615        printf("Zone details not implemented\n");
     
    587617}
    588618
     619/** Command for listing processors.
     620 *
     621 * @param argv Ignored.
     622 *
     623 * return Always 1.
     624 */
     625int cmd_cpus(cmd_arg_t *argv)
     626{
     627        cpu_list();
     628        return 1;
     629}
     630
     631/** Command for printing kernel version.
     632 *
     633 * @param argv Ignored.
     634 *
     635 * return Always 1.
     636 */
     637int cmd_version(cmd_arg_t *argv)
     638{
     639        version_print();
     640        return 1;
     641}
  • generic/src/cpu/cpu.c

    r93e90c7 r0132630  
    3939#include <memstr.h>
    4040#include <list.h>
     41#include <print.h>
    4142
    4243cpu_t *cpus;
     
    8990        cpu_arch_init();
    9091}
     92
     93/** List all processors. */
     94void cpu_list(void)
     95{
     96        int i;
     97
     98        for (i = 0; i < config.cpu_count; i++) {
     99                if (cpus[i].active)
     100                        cpu_print_report(&cpus[i]);
     101                else
     102                        printf("cpu%d: not active\n", i);
     103        }
     104}
  • generic/src/interrupt/interrupt.c

    r93e90c7 r0132630  
    3232#include <console/console.h>
    3333#include <console/chardev.h>
     34#include <console/cmd.h>
    3435#include <panic.h>
    3536#include <print.h>
     
    112113
    113114static cmd_info_t exc_info = {
    114         .name = "pexc",
     115        .name = "exc",
    115116        .description = "Print exception table.",
    116117        .func = exc_print_cmd,
     
    128129                exc_register(i, "undef", exc_undef);
    129130
    130         spinlock_initialize(&exc_info.lock, "kconsole_excinfo");
    131         link_initialize(&exc_info.link);
     131        cmd_initialize(&exc_info);
    132132        if (!cmd_register(&exc_info))
    133133                panic("could not register command %s\n", exc_info.name);
  • generic/src/main/kinit.c

    r93e90c7 r0132630  
    7070{
    7171        thread_t *t;
    72         int i;
    7372#ifdef CONFIG_USERSPACE
    7473        vm_t *m;
     
    101100         * Now that all CPUs are up, we can report what we've found.
    102101         */
    103         for (i = 0; i < config.cpu_count; i++) {
    104                 if (cpus[i].active)
    105                         cpu_print_report(&cpus[i]);
    106                 else
    107                         printf("cpu%d: not active\n", i);
    108         }
     102        cpu_list();
    109103
    110104#ifdef CONFIG_SMP
    111105        if (config.cpu_count > 1) {
     106                int i;
     107               
    112108                /*
    113109                 * For each CPU, create its load balancing thread.
  • generic/src/main/main.c

    r93e90c7 r0132630  
    4242#include <align.h>
    4343#include <interrupt.h>
     44#include <main/version.h>
    4445
    4546#ifdef CONFIG_SMP
     
    6566#include <typedefs.h>
    6667
    67 char *project = "SPARTAN kernel";
    68 char *copyright = "Copyright (C) 2001-2006 HelenOS project";
    69 char *release = RELEASE;
    70 char *name = NAME;
    71 char *arch = ARCH;
    72 
    73 #ifdef REVISION
    74         char *revision = ", revision " REVISION;
    75 #else
    76         char *revision = "";
    77 #endif
    78 
    79 #ifdef TIMESTAMP
    80         char *timestamp = " on " TIMESTAMP;
    81 #else
    82         char *timestamp = "";
    83 #endif
    84 
    8568config_t config;
    8669context_t ctx;
     
    168151
    169152        /* Exception handler initialization, before architecture
    170          * starts adding it's own handlers
     153         * starts adding its own handlers
    171154         */
    172155        exc_init();
     
    178161        tlb_init();
    179162        arch_post_mm_init();
    180        
    181         printf("%s, release %s (%s)%s\nBuilt%s for %s\n%s\n", project, release, name, revision, timestamp, arch, copyright);
     163
     164        version_print();
     165
    182166        printf("%P: hardcoded_ktext_size=%dK, hardcoded_kdata_size=%dK\n",
    183167                config.base, hardcoded_ktext_size/1024, hardcoded_kdata_size/1024);
Note: See TracChangeset for help on using the changeset viewer.