debuggers.hg

view xen/common/kernel.c @ 3705:4294cfa9fad3

bitkeeper revision 1.1159.212.95 (4204aa0ee0re5Xx1zWrJ9ejxzgRs3w)

Various cleanups. Remove PDB pending simpler GDB stub and/or NetBSD debugger.
Force emacs mode to appropriate tabbing in various files.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Sat Feb 05 11:12:14 2005 +0000 (2005-02-05)
parents 597555bad4b5
children 88957a238191
line source
1 /* -*- Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
2 /******************************************************************************
3 * kernel.c
4 *
5 * This file should contain architecture-independent bootstrap and low-level
6 * help routines. It's a bit x86/PC specific right now!
7 *
8 * Copyright (c) 2002-2003 K A Fraser
9 */
11 #include <xen/config.h>
12 #include <xen/init.h>
13 #include <xen/lib.h>
14 #include <xen/errno.h>
15 #include <xen/compile.h>
16 #include <xen/sched.h>
18 void cmdline_parse(char *cmdline)
19 {
20 unsigned char *opt_end, *opt;
21 struct kernel_param *param;
23 if ( cmdline == NULL )
24 return;
26 while ( *cmdline == ' ' )
27 cmdline++;
28 cmdline = strchr(cmdline, ' '); /* skip the image name */
29 while ( cmdline != NULL )
30 {
31 while ( *cmdline == ' ' )
32 cmdline++;
33 if ( *cmdline == '\0' )
34 break;
35 opt_end = strchr(cmdline, ' ');
36 if ( opt_end != NULL )
37 *opt_end++ = '\0';
38 opt = strchr(cmdline, '=');
39 if ( opt != NULL )
40 *opt++ = '\0';
41 for ( param = &__setup_start; param != &__setup_end; param++ )
42 {
43 if ( strcmp(param->name, cmdline ) != 0 )
44 continue;
45 switch ( param->type )
46 {
47 case OPT_STR:
48 if ( opt != NULL )
49 {
50 strncpy(param->var, opt, param->len);
51 ((char *)param->var)[param->len-1] = '\0';
52 }
53 break;
54 case OPT_UINT:
55 if ( opt != NULL )
56 *(unsigned int *)param->var =
57 simple_strtol(opt, (char **)&opt, 0);
58 break;
59 case OPT_BOOL:
60 *(int *)param->var = 1;
61 break;
62 }
63 }
64 cmdline = opt_end;
65 }
66 }
68 /*
69 * Simple hypercalls.
70 */
72 long do_xen_version(int cmd)
73 {
74 if ( cmd != 0 )
75 return -ENOSYS;
76 return (XEN_VERSION<<16) | (XEN_SUBVERSION);
77 }
79 vm_assist_info_t vm_assist_info[MAX_VMASST_TYPE + 1];
80 long do_vm_assist(unsigned int cmd, unsigned int type)
81 {
82 return vm_assist(current->domain, cmd, type);
83 }
85 long do_ni_hypercall(void)
86 {
87 /* No-op hypercall. */
88 return -ENOSYS;
89 }