Changeset 80bff342 in mainline


Ignore:
Timestamp:
2005-12-30T15:39:00Z (19 years ago)
Author:
Sergey Bondari <bondari@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
65fb232
Parents:
feb5915
Message:

Zones related commands infrastructure for console. Also fixed small bug that caused infinite loop during command parsing

Location:
generic/src/console
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • generic/src/console/cmd.c

    rfeb5915 r80bff342  
    4949#include <mm/tlb.h>
    5050#include <arch/mm/tlb.h>
     51#include <mm/frame.h>
    5152
    5253/** Data and methods for 'help' command. */
     
    118119        .argv = set4_argv
    119120};
     121
    120122
    121123
     
    242244};
    243245
     246
     247/** Data and methods for 'zones' command */
     248static int cmd_zones(cmd_arg_t *argv);
     249static cmd_info_t zones_info = {
     250        .name = "zones",
     251        .description = "List of memory zones.",
     252        .func = cmd_zones,
     253        .argc = 0
     254};
     255
     256/** Data and methods for 'zone' command */
     257static int cmd_zone(cmd_arg_t *argv);
     258static char zone_buf[MAX_CMDLINE+1];
     259static cmd_arg_t zone_argv = {
     260        .type = ARG_TYPE_INT,
     261        .buffer = zone_buf,
     262        .len = sizeof(zone_buf)
     263};
     264
     265
     266static cmd_info_t zone_info = {
     267        .name = "zone",
     268        .description = "Show memory zone structure.",
     269        .func = cmd_zone,
     270        .argc = 1,
     271        .argv = &zone_argv
     272};
     273
     274
     275
    244276/** Initialize command info structure.
    245277 *
     
    299331        if (!cmd_register(&ptlb_info))
    300332                panic("could not register command %s\n", ptlb_info.name);
     333
     334        cmd_initialize(&zones_info);
     335        if (!cmd_register(&zones_info))
     336                panic("could not register command %s\n", zones_info.name);
     337
     338        cmd_initialize(&zone_info);
     339        if (!cmd_register(&zone_info))
     340                panic("could not register command %s\n", zone_info.name);
     341
     342
    301343}
    302344
     
    534576        return 1;
    535577}
     578
     579
     580int cmd_zones(cmd_arg_t * argv) {
     581        printf("Zones listing not implemented\n");
     582        return 1;
     583}
     584int cmd_zone(cmd_arg_t * argv) {
     585        printf("Zone details not implemented\n");
     586        return 1;
     587}
     588
  • generic/src/console/kconsole.c

    rfeb5915 r80bff342  
    472472        link_t *cur;
    473473        int i;
     474        int error = 0;
    474475       
    475476        if (!parse_argument(cmdline, len, &start, &end)) {
     
    521522                }
    522523               
     524                error = 0;
    523525                switch (cmd->argv[i].type) {
    524526                case ARG_TYPE_STRING:
     
    530532                        if (parse_int_arg(cmdline+start, end-start+1,
    531533                                          &cmd->argv[i].intval))
    532                                 return NULL;
     534                                error = 1;
    533535                        break;
    534536                case ARG_TYPE_VAR:
     
    545547                        else {
    546548                                printf("Unrecognized variable argument.\n");
    547                                 return NULL;
     549                                error = 1;
    548550                        }
    549551                        break;
     
    551553                default:
    552554                        printf("invalid argument type\n");
    553                         return NULL;
     555                        error = 1;
    554556                        break;
    555557                }
     558        }
     559       
     560        if (error) {
     561                spinlock_unlock(&cmd->lock);
     562                return NULL;
    556563        }
    557564       
Note: See TracChangeset for help on using the changeset viewer.