Minios improvements for app development
PATCH 1/1 Minios improvements for app development
This patch series contains a set of patches making minios rather easier to use, from an application development point of view.
Overview of patches:
1 Command line argument parsing support, from Xen. 2 Weak console handler function. 3 Build system tweaks for application directories. 4 Trailing whitespace cleanup. (because it is very messy)
Patch 4 is likely to be more controversial than the others, so I am less fussed if it gets nacked, but would still appreciate the issue being fixed.
PATCH 1/1 minios/cmdline: Port Xen command line argument handling to minios
This is a direct port of the core command line functional, and some tweaking with the linker setup. It required adding some extra consts to some of the library functions to compile.
extras/mini-os/Makefile +1 -0
@@ -76,6 +76,7 @@ src-$(CONFIG_BLKFRONT) += blkfront.c src-$(CONFIG_TPMFRONT) += tpmfront.c src-$(CONFIG_TPM_TIS) += tpm_tis.c src-$(CONFIG_TPMBACK) += tpmback.c +src-y += cmdline.c src-y += daytime.c src-y += events.c src-$(CONFIG_FBFRONT) += fbfront.c
extras/mini-os/arch/x86/minios-x86_32.lds +3 -0
@@ -45,6 +45,9 @@ SECTIONS .data : { /* Data */ *(.data) + __setup_start = .; + *(.initsetup) + __setup_end = .; } _edata = .; /* End of data section */
extras/mini-os/arch/x86/minios-x86_64.lds +3 -0
@@ -45,6 +45,9 @@ SECTIONS .data : { /* Data */ *(.data) + __setup_start = .; + *(.initsetup) + __setup_end = .; } _edata = .; /* End of data section */
extras/mini-os/cmdline.c new file +165 -0
165 lines not on this page · raw message
extras/mini-os/include/cmdline.h new file +63 -0
63 lines not on this page · raw message
extras/mini-os/include/lib-gpl.h +4 -4
@@ -33,10 +33,10 @@#ifndef HAVE_LIBC /* printing */ -extern unsigned long simple_strtoul (const char *,char **,unsigned int ); -extern long simple_strtol (const char *,char **,unsigned int ); -extern unsigned long long simple_strtoull (const char *,char **,unsigned int ); -extern long long simple_strtoll (const char *,char **,unsigned int ); +extern unsigned long simple_strtoul (const char *,const char **,unsigned int ); +extern long simple_strtol (const char *,const char **,unsigned int ); +extern unsigned long long simple_strtoull (const char *,const char **,unsigned int ); +extern long long simple_strtoll (const char *,const char **,unsigned int );extern int sprintf (char * buf,const char * fmt, ...) __attribute__ ((format (printf,2 ,3 )));
extras/mini-os/kernel.c +5 -0
@@ -42,6 +42,7 @@#include <mini-os/fbfront.h> #include <mini-os/pcifront.h> #include <mini-os/xmalloc.h> +#include <mini-os/cmdline.h> #include <fcntl.h> #include <xen/features.h> #include <xen/version.h>
@@ -117,6 +118,10 @@ void start_kernel(start_info_t *si)/* Init the console driver. */ init_console (); +/* Parse the command line options. */ +if ( si->cmd_line ) +cmdline_parse ((char *)si->cmd_line); +/* Init grant tables */ init_gnttab ();
extras/mini-os/lib/printf.c +5 -5
@@ -63,7 +63,7 @@* @endp: A pointer to the end of the parsed string will be placed here * @base: The number base to use */ -unsigned long simple_strtoul (const char *cp,char **endp,unsigned int base) +unsigned long simple_strtoul (const char *cp,const char **endp,unsigned int base) {unsigned long result =0 ,value;
@@ -94,7 +94,7 @@ unsigned long simple_strtoul(const char* @endp: A pointer to the end of the parsed string will be placed here * @base: The number base to use */ -long simple_strtol (const char *cp,char **endp,unsigned int base) +long simple_strtol (const char *cp,const char **endp,unsigned int base) {if (*cp=='-' )return -simple_strtoul (cp+1 ,endp,base);
@@ -107,7 +107,7 @@ long simple_strtol(const char *cp,char ** @endp: A pointer to the end of the parsed string will be placed here * @base: The number base to use */ -unsigned long long simple_strtoull (const char *cp,char **endp,unsigned int base) +unsigned long long simple_strtoull (const char *cp,const char **endp,unsigned int base) {unsigned long long result =0 ,value;
@@ -138,7 +138,7 @@ unsigned long long simple_strtoull(const* @endp: A pointer to the end of the parsed string will be placed here * @base: The number base to use */ -long long simple_strtoll (const char *cp,char **endp,unsigned int base) +long long simple_strtoll (const char *cp,const char **endp,unsigned int base) {if (*cp=='-' )return -simple_strtoull (cp+1 ,endp,base);
@@ -559,7 +559,7 @@ int sprintf(char * buf, const char *fmt,int vsscanf (const char * buf,const char * fmt,va_list args) {const char *str = buf; -char *next; +const char *next;char digit;int num =0 ;int qualifier;
Re: [PATCH 1 of 4] minios/cmdline: Port Xen command line argument handling to minios
Quoted 1 line · Andrew Cooper
This is a direct port of the core command line functional,
Careful: Xen is GPL while mini-os is BSD.
You would need to track down all the contributors to the relevant bits of Xen if you want to relicense it (this may be trival-ish in practice, I doubt many people touch this area).
If you don't want to relicense then it needs to be conditionally compiled and the statement about GPL submodules in extras/mini-os/COPYING needs to be extended to include it.
Ian.
PATCH 1/1 minios/console: console_input() weak reference
In reply to Andrew CooperIn exactly the same style as app_main() in kernel.c, create a weak reference console_input() function for applications to override to quickly gain access to the console.
extras/mini-os/console/console.c +7 -3
@@ -54,9 +54,7 @@NOTE: you need to enable verbose in xen/Rules.mk for it to work. */ static int console_initialised =0 ; - -#ifndef HAVE_LIBC -void xencons_rx (char *buf,unsigned len,struct pt_regs *regs) +__attribute__((weak))void console_input (char * buf,unsigned len) {if (len >0 ) {
@@ -69,6 +67,12 @@ void xencons_rx(char *buf, unsigned len, } } +#ifndef HAVE_LIBC +void xencons_rx (char *buf,unsigned len,struct pt_regs *regs) +{ +console_input (buf, len); +} +void xencons_tx (void ) {/* Do nothing, handled by _rx */
Re: [PATCH 2 of 4] minios/console: console_input() weak reference
Quoted 5 lines · Andrew Cooper, le Mon 26 Nov 2012 16:24:10 +0000, a écrit :
In exactly the same style as
app_main()inkernel.c, create a weak referenceconsole_input()function for applications to override to quickly gain access to the console.Signed-off-by Andrew Cooper <[email protected]>
Quoted 33 lines
diff -r 505992114832 -r
29138c27eb72extras/mini-os/console/console.cextras/mini-os/console/console.c +7
-3@@ -54,9 +54,7 @@NOTE: you need to enable verbose in xen/Rules.mk for it to work. */ static int console_initialised =0 ; - -#ifndef HAVE_LIBC -void xencons_rx (char *buf,unsigned len,struct pt_regs *regs) +__attribute__((weak))void console_input (char * buf,unsigned len) {if (len >0 ) {@@ -69,6 +67,12 @@ void xencons_rx(char *buf, unsigned len, } } +#ifndef HAVE_LIBC +void xencons_rx (char *buf,unsigned len,struct pt_regs *regs) +{ +console_input (buf, len); +} +void xencons_tx (void ) {/* Do nothing, handled by _rx */ _______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 2 of 4] minios/console: console_input() weak reference
Quoted 8 lines · Samuel Thibault
Quoted 5 lines · Andrew Cooper, le Mon 26 Nov 2012 16:24:10 +0000, a écrit :
In exactly the same style as
app_main()inkernel.c, create a weak referenceconsole_input()function for applications to override to quickly gain access to the console.Signed-off-by Andrew Cooper <[email protected]>Acked-by Samuel Thibault <[email protected]>
Any reason not to make xencons_rx itself the weak function? And by extension I suppose xencons_tx too, for parity if nothing else.
The existing console_input function (previously xencons_rx) is pretty odd, it relies on something reusing a tx buffer for rx?
Ian.
Quoted 29 lines
Quoted 29 lines
diff -r 505992114832 -r
29138c27eb72extras/mini-os/console/console.cextras/mini-os/console/console.c +7
-3@@ -54,9 +54,7 @@NOTE: you need to enable verbose in xen/Rules.mk for it to work. */ static int console_initialised =0 ; - -#ifndef HAVE_LIBC -void xencons_rx (char *buf,unsigned len,struct pt_regs *regs) +__attribute__((weak))void console_input (char * buf,unsigned len) {if (len >0 ) {@@ -69,6 +67,12 @@ void xencons_rx(char *buf, unsigned len, } } +#ifndef HAVE_LIBC +void xencons_rx (char *buf,unsigned len,struct pt_regs *regs) +{ +console_input (buf, len); +} +void xencons_tx (void ) {/* Do nothing, handled by _rx */
Quoted 10 lines
Quoted 5 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 2 of 4] minios/console: console_input() weak reference
Quoted 11 lines · Ian Campbell, le Tue 27 Nov 2012 11:34:39 +0000, a écrit :
Quoted 8 lines · Samuel Thibault
Quoted 5 lines · Andrew Cooper, le Mon 26 Nov 2012 16:24:10 +0000, a écrit :
In exactly the same style as
app_main()inkernel.c, create a weak referenceconsole_input()function for applications to override to quickly gain access to the console.Signed-off-by Andrew Cooper <[email protected]>Acked-by Samuel Thibault <[email protected]>Any reason not to make
xencons_rxitself the weak function?
I'd avoid exposing the pt_regs structure. Maybe we could drop the parameter from the xencons_rx function itself indeed, it has no use.
Quoted 1 line
And by extension I suppose
xencons_txtoo, for parity if nothing else.
I actually wonder what the purpose of xencons_tx is.
Quoted 2 lines
The existing
console_inputfunction (previouslyxencons_rx) is pretty odd, it relies on something reusing a tx buffer for rx?
? I don't see what you are referring to.
Samuel
Re: [PATCH 2 of 4] minios/console: console_input() weak reference
Quoted 7 lines · Samuel Thibault
Quoted 6 lines · Ian Campbell, le Tue 27 Nov 2012 11:34:39 +0000, a écrit :
Quoted 5 lines · Samuel Thibault
Quoted 4 lines · Andrew Cooper, le Mon 26 Nov 2012 16:24:10 +0000, a écrit :
In exactly the same style as
app_main()inkernel.c, create a weak referenceconsole_input()function for applications to override to quickly gain access to the console.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Andrew Cooper <[email protected]>Acked-by Samuel Thibault <[email protected]>Any reason not to make
xencons_rxitself the weak function?I'd avoid exposing the
pt_regsstructure. Maybe we could drop the parameter from thexencons_rxfunction itself indeed, it has no use.
Sounds like a good idea to me.
Quoted 3 lines
Quoted 1 line
And by extension I suppose
xencons_txtoo, for parity if nothing else.I actually wonder what the purpose of
xencons_txis.
I suppose if you had a shared ring serial console you could accept input? Less useful if you are using HYPERVISOR_console_io from a domU I suspect...
Quoted 4 lines
Quoted 2 lines
The existing
console_inputfunction (previouslyxencons_rx) is pretty odd, it relies on something reusing a tx buffer for rx?? I don't see what you are referring to.
xencons_rx says /* Just repeat what's written */ and prints the contents of the buffer (this is rx remember, so buffer ought to be an output buffer, not input) while xencons_tx just says /* Do nothing, handled by _rx */.
Quoted 2 lines
Samuel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 2 of 4] minios/console: console_input() weak reference
Quoted 6 lines · Ian Campbell, le Tue 27 Nov 2012 11:46:41 +0000, a écrit :
Quoted 3 lines
Quoted 1 line
And by extension I suppose
xencons_txtoo, for parity if nothing else.I actually wonder what the purpose of
xencons_txis.I suppose if you had a shared ring serial console you could accept input?
I'm afraid I still don't understand :)
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
The existing
console_inputfunction (previouslyxencons_rx) is pretty odd, it relies on something reusing a tx buffer for rx?? I don't see what you are referring to.
xencons_rxsays /* Just repeat what's written */ and prints the contents of the buffer
Yes, it echoes what was typed on the console by the user.
Quoted 2 lines
(this is rx remember, so buffer ought to be an output buffer, not input)
Really? It's not what I understand from console_handle_input, which just consumes data from the ring and gives it to xencons_rx, without emiting any.
Samuel
Re: [PATCH 2 of 4] minios/console: console_input() weak reference
Quoted 9 lines · Samuel Thibault
Quoted 6 lines · Ian Campbell, le Tue 27 Nov 2012 11:46:41 +0000, a écrit :
Quoted 3 lines
Quoted 1 line
And by extension I suppose
xencons_txtoo, for parity if nothing else.I actually wonder what the purpose of
xencons_txis.I suppose if you had a shared ring serial console you could accept input?
I'm afraid I still don't understand :)
Oops, I confused my tx and my rx here ;-)
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
The existing
console_inputfunction (previouslyxencons_rx) is pretty odd, it relies on something reusing a tx buffer for rx?? I don't see what you are referring to.
xencons_rxsays /* Just repeat what's written */ and prints the contents of the buffer
Quoted 8 lines
Yes, it echoes what was typed on the console by the user.
Quoted 2 lines
(this is rx remember, so buffer ought to be an output buffer, not input)
Really? It's not what I understand from
console_handle_input, which just consumes data from the ring and gives it toxencons_rx, without emiting any.
Oh, xencons_rx is the function called when data is received on the console, as opposed to a function which is expected to receive data from the console itself (which is the other possible reading of the name). Sorry, my confusion, plus being too lazy to run cscope in order to find the caller.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 1/1 minios/build: Introduce application directories
In reply to Andrew CooperAllow for separate application subdirectories when developing with minios.
The new system allows a developer to run:
make XEN_TARGET_ARCH=<arch> APP=<foo>
While maintaining separate apps in apps/<foo>/
There is now a requirement to have apps/<foo>/app.mk which lists the source files, and can provide application specific configuration of settings.
The default application, daytime, has been moved to use this system, and remains the default if no APP is provided to the invocation of make.
extras/mini-os/Config.mk +4 -0
@@ -2,6 +2,10 @@ MINI-OS_ROOT=$(XEN_ROOT)/extras/mini-os export MINI-OS_ROOT +# Default to the daytime app +MINIOS_APP_DIR := apps +APP ?= daytime + libc = $(stubdom) XEN_INTERFACE_VERSION := 0x00030205
extras/mini-os/Makefile +8 -4
@@ -15,6 +15,9 @@ EXTRA_DEPS += $(MINIOS_CONFIG) include $(MINIOS_CONFIG) endif +EXTRA_DEPS += $(MINIOS_APP_DIR)/$(APP)/app.mk +include $(MINIOS_APP_DIR)/$(APP)/app.mk + # Configuration defaults CONFIG_START_NETWORK ?= y CONFIG_SPARSE_BSS ?= y
@@ -77,7 +80,6 @@ src-$(CONFIG_TPMFRONT) += tpmfront.c src-$(CONFIG_TPM_TIS) += tpm_tis.c src-$(CONFIG_TPMBACK) += tpmback.c src-y += cmdline.c -src-y += daytime.c src-y += events.c src-$(CONFIG_FBFRONT) += fbfront.c src-y += gntmap.c
@@ -108,7 +110,6 @@ src-y += console/xencons_ring.c src-$(CONFIG_CONSFRONT) += console/xenbus.c # The common mini-os objects to build. -APP_OBJS := OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(src-y)) .PHONY: default
@@ -181,12 +182,15 @@ endif $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) [email protected] $(EXTRA_OBJS) -o $@ gzip -f -9 -c $@ >[email protected] -.PHONY: clean arch_clean +.PHONY: clean arch_clean apps_clean arch_clean: $(MAKE) --directory=$(TARGET_ARCH_DIR) OBJ_DIR=$(OBJ_DIR)/$(TARGET_ARCH_DIR) clean || exit 1; -clean: arch_clean +apps_clean: + find $(OBJ_DIR)/$(MINIOS_APP_DIR) -name '*.o' | xargs rm -f + +clean: arch_clean apps_clean for dir in $(addprefix $(OBJ_DIR)/,$(SUBDIRS)); do \ rm -f $$dir/*.o; \ done
extras/mini-os/apps/daytime/app.mk new file +1 -0
@@ -0,0 +1,1 @@ +src-y += $(MINIOS_APP_DIR)/$(APP)/daytime.c
extras/mini-os/apps/daytime/daytime.c new file +67 -0
67 lines not on this page · raw message
extras/mini-os/daytime.c deleted +0 -67
67 lines not on this page · raw message
Re: [PATCH 3 of 4] minios/build: Introduce application directories
Quoted 5 lines · Andrew Cooper
Allow for separate application subdirectories when developing with minios.
The new system allows a developer to run:
Quoted 7 lines
make XEN_TARGET_ARCH=<arch> APP=<foo>
While maintaining separate apps in apps/<foo>/
There is now a requirement to have apps/<foo>/app.mk which lists the source files, and can provide application specific configuration of settings.
How does this affect building stub domains?
Quoted 218 lines
The default application, daytime, has been moved to use this system, and remains the default if no APP is provided to the invocation of make.
Signed-off-by Andrew Cooper <[email protected]>diff -r
29138c27eb72-r121ae49aabcbextras/mini-os/Config.mkextras/mini-os/Config.mk +4
-0@@ -2,6 +2,10 @@ MINI-OS_ROOT=$(XEN_ROOT)/extras/mini-os export MINI-OS_ROOT +# Default to the daytime app +MINIOS_APP_DIR := apps +APP ?= daytime + libc = $(stubdom) XEN_INTERFACE_VERSION := 0x00030205diff -r
29138c27eb72-r121ae49aabcbextras/mini-os/Makefileextras/mini-os/Makefile +8
-4@@ -15,6 +15,9 @@ EXTRA_DEPS += $(MINIOS_CONFIG) include $(MINIOS_CONFIG) endif +EXTRA_DEPS += $(MINIOS_APP_DIR)/$(APP)/app.mk +include $(MINIOS_APP_DIR)/$(APP)/app.mk + # Configuration defaults CONFIG_START_NETWORK ?= y CONFIG_SPARSE_BSS ?= y@@ -77,7 +80,6 @@ src-$(CONFIG_TPMFRONT) += tpmfront.c src-$(CONFIG_TPM_TIS) += tpm_tis.c src-$(CONFIG_TPMBACK) += tpmback.c src-y += cmdline.c -src-y += daytime.c src-y += events.c src-$(CONFIG_FBFRONT) += fbfront.c src-y += gntmap.c@@ -108,7 +110,6 @@ src-y += console/xencons_ring.c src-$(CONFIG_CONSFRONT) += console/xenbus.c # The common mini-os objects to build. -APP_OBJS := OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(src-y)) .PHONY: default@@ -181,12 +182,15 @@ endif $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) [email protected] $(EXTRA_OBJS) -o $@ gzip -f -9 -c $@ >[email protected] -.PHONY: clean arch_clean +.PHONY: clean arch_clean apps_clean arch_clean: $(MAKE) --directory=$(TARGET_ARCH_DIR) OBJ_DIR=$(OBJ_DIR)/$(TARGET_ARCH_DIR) clean || exit 1; -clean: arch_clean +apps_clean: + find $(OBJ_DIR)/$(MINIOS_APP_DIR) -name '*.o' | xargs rm -f + +clean: arch_clean apps_clean for dir in $(addprefix $(OBJ_DIR)/,$(SUBDIRS)); do \ rm -f $$dir/*.o; \ donediff -r
29138c27eb72-r121ae49aabcbextras/mini-os/apps/daytime/app.mkextras/mini-os/apps/daytime/app.mk new file +1
-0@@ -0,0 +1,1 @@ +src-y += $(MINIOS_APP_DIR)/$(APP)/daytime.cdiff -r
29138c27eb72-r121ae49aabcbextras/mini-os/apps/daytime/daytime.cextras/mini-os/apps/daytime/daytime.c new file +67
-0@@ -0,0 +1,67 @@ +/* +* daytime.c: a simple network service based on lwIP and mini-os +* +* Tim Deegan <[email protected]>, July 2007 +*/ + +#include <os.h> +#include <xmalloc.h> +#include <console.h> +#include <netfront.h> +#include <lwip/api.h> + +static char message[29 ]; + +void run_server (void *p) +{ +struct ip_addr listenaddr = {0 }; +struct netconn *listener; +struct netconn *session; +struct timeval tv; +err_t rc; + +start_networking (); + +if (0 ) { +struct ip_addr ipaddr = {htonl (0x0a000001 ) }; +struct ip_addr netmask = {htonl (0xff000000 ) }; +struct ip_addr gw = {0 }; +networking_set_addr (&ipaddr, &netmask, &gw); + } + +tprintk ("Opening connection\n" ); + + listener =netconn_new (NETCONN_TCP ); +tprintk ("Connection at %p\n" , listener); + + rc =netconn_bind (listener, &listenaddr,13 ); +if (rc !=ERR_OK ) { +tprintk ("Failed to bind connection: %i\n" , rc); +return ; + } + + rc =netconn_listen (listener); +if (rc !=ERR_OK ) { +tprintk ("Failed to listen on connection: %i\n" , rc); +return ; + } + +while (1 ) { + session =netconn_accept (listener); +if (session ==NULL ) +continue ; + +gettimeofday (&tv,NULL ); +sprintf (message,"%20lu.%6.6lu\n" , tv.tv_sec, tv.tv_usec); + (void )netconn_write (session, message,strlen (message),NETCONN_COPY ); + (void )netconn_disconnect (session); + (void )netconn_delete (session); + } +} + + +int app_main (start_info_t *si) +{ +create_thread ("server" , run_server,NULL ); +return 0 ; +}diff -r
29138c27eb72-r121ae49aabcbextras/mini-os/daytime.cextras/mini-os/daytime.c deleted +0
-67@@ -1,67 +0,0 @@ -/* -* daytime.c: a simple network service based on lwIP and mini-os -* -* Tim Deegan <[email protected]>, July 2007 -*/ - -#include <os.h> -#include <xmalloc.h> -#include <console.h> -#include <netfront.h> -#include <lwip/api.h> - -static char message[29 ]; - -void run_server (void *p) -{ -struct ip_addr listenaddr = {0 }; -struct netconn *listener; -struct netconn *session; -struct timeval tv; -err_t rc; - -start_networking (); - -if (0 ) { -struct ip_addr ipaddr = {htonl (0x0a000001 ) }; -struct ip_addr netmask = {htonl (0xff000000 ) }; -struct ip_addr gw = {0 }; -networking_set_addr (&ipaddr, &netmask, &gw); - } - -tprintk ("Opening connection\n" ); - - listener =netconn_new (NETCONN_TCP ); -tprintk ("Connection at %p\n" , listener); - - rc =netconn_bind (listener, &listenaddr,13 ); -if (rc !=ERR_OK ) { -tprintk ("Failed to bind connection: %i\n" , rc); -return ; - } - - rc =netconn_listen (listener); -if (rc !=ERR_OK ) { -tprintk ("Failed to listen on connection: %i\n" , rc); -return ; - } - -while (1 ) { - session =netconn_accept (listener); -if (session ==NULL ) -continue ; - -gettimeofday (&tv,NULL ); -sprintf (message,"%20lu.%6.6lu\n" , tv.tv_sec, tv.tv_usec); - (void )netconn_write (session, message,strlen (message),NETCONN_COPY ); - (void )netconn_disconnect (session); - (void )netconn_delete (session); - } -} - - -int app_main (start_info_t *si) -{ -create_thread ("server" , run_server,NULL ); -return 0 ; -}_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 1/1 minios/whitespace: Clean up trailing whitespace
In reply to Andrew CooperThis patch was generated using
find . -name "*.[hcS]" | xargs sed -e "s/[ ]\+$//g" -i
from the minios directory.
extras/mini-os/apps/daytime/daytime.c +3 -3
@@ -1,6 +1,6 @@ -/* +/* * daytime.c: a simple network service based on lwIP and mini-os -* +* * Tim Deegan <[email protected]>, July 2007 */
@@ -48,7 +48,7 @@ void run_server(void *p)while (1 ) { session =netconn_accept (listener); -if (session ==NULL ) +if (session ==NULL )continue ;gettimeofday (&tv,NULL );
extras/mini-os/arch/x86/ioremap.c +12 -12
@@ -1,22 +1,22 @@/* * Copyright (C) 2009, Netronome Systems, Inc. -* +* * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: -* +* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */
@@ -29,7 +29,7 @@/* Map a physical address range into virtual address space with provided * flags. Return a virtual address range it is mapped to. */ -static void *__do_ioremap (unsigned long phys_addr,unsigned long size, +static void *__do_ioremap (unsigned long phys_addr,unsigned long size,unsigned long prot) {unsigned long va;
@@ -41,7 +41,7 @@ static void *__do_ioremap(unsigned long num_pages = (offset + size +PAGE_SIZE -1 ) /PAGE_SIZE ; phys_addr &=PAGE_MASK ; mfns = mfn = phys_addr >>PAGE_SHIFT ; - + va = (unsigned long )map_frames_ex (&mfns, num_pages,0 ,1 ,1 ,DOMID_IO ,NULL , prot);return (void *)(va + offset);
@@ -60,7 +60,7 @@ void *ioremap_nocache(unsigned long phys/* Un-map the io-remapped region. Currently no list of existing mappings is * maintained, so the caller has to supply the size */ void iounmap (void *virt_addr,unsigned long size) -{ +{unsigned long num_pages;unsigned long va = (unsigned long )virt_addr;
extras/mini-os/arch/x86/mm.c +83 -83
443 lines not on this page · raw message
extras/mini-os/arch/x86/sched.c +27 -27
120 lines not on this page · raw message
extras/mini-os/arch/x86/setup.c +11 -11
@@ -1,27 +1,27 @@/****************************************************************************** * common.c -* +* * Common stuff special to x86 goes here. -* +* * Copyright (c) 2002-2003, K A Fraser & R Neugebauer * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge -* +* * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: -* +* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * */
extras/mini-os/arch/x86/time.c +13 -13
@@ -1,7 +1,7 @@/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*- **************************************************************************** * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge -* (C) 2002-2003 - Keir Fraser - University of Cambridge +* (C) 2002-2003 - Keir Fraser - University of Cambridge * (C) 2005 - Grzegorz Milos - Intel Research Cambridge * (C) 2006 - Robert Kaiser - FH Wiesbaden ****************************************************************************
@@ -18,16 +18,16 @@* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: -* +* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */
@@ -74,7 +74,7 @@ static struct shadow_time_info shadow;static inline int time_values_up_to_date (void ) { -struct vcpu_time_info *src = &HYPERVISOR_shared_info->vcpu_info[0 ].time; +struct vcpu_time_info *src = &HYPERVISOR_shared_info->vcpu_info[0 ].time;return (shadow.version == src->version); }
@@ -187,8 +187,8 @@ int gettimeofday(struct timeval *tv, voi {uint64_t nsec =monotonic_clock (); nsec += shadow_ts.tv_nsec; - - + + tv->tv_sec = shadow_ts.tv_sec; tv->tv_sec +=NSEC_TO_SEC (nsec); tv->tv_usec =NSEC_TO_USEC (nsec %1000000000UL );
@@ -212,7 +212,7 @@ void block_domain(s_time_t until)/* -* Just a dummy +* Just a dummy */ static void timer_handler (evtchn_port_t ev,struct pt_regs *regs,void *ign) {
extras/mini-os/arch/x86/traps.c +15 -15
@@ -33,7 +33,7 @@ void machine_check(void);void dump_regs (struct pt_regs *regs) {printk ("Thread: %s\n" , current->name); -#ifdef __i386__ +#ifdef __i386__printk ("EIP: %x, EFLAGS %x.\n" , regs->eip, regs->eflags);printk ("EBX: %08x ECX: %08x EDX: %08x\n" , regs->ebx, regs->ecx, regs->edx);
@@ -45,18 +45,18 @@ void dump_regs(struct pt_regs *regs) regs->xcs, regs->eflags, regs->esp, regs->xss);#else printk ("RIP: %04lx:[<%016lx>] " , regs->cs &0xffff , regs->rip); -printk ("\nRSP: %04lx:%016lx EFLAGS: %08lx\n" , +printk ("\nRSP: %04lx:%016lx EFLAGS: %08lx\n" , regs->ss, regs->rsp, regs->eflags);printk ("RAX: %016lx RBX: %016lx RCX: %016lx\n" , regs->rax, regs->rbx, regs->rcx);printk ("RDX: %016lx RSI: %016lx RDI: %016lx\n" , - regs->rdx, regs->rsi, regs->rdi); + regs->rdx, regs->rsi, regs->rdi);printk ("RBP: %016lx R08: %016lx R09: %016lx\n" , - regs->rbp, regs->r8, regs->r9); + regs->rbp, regs->r8, regs->r9);printk ("R10: %016lx R11: %016lx R12: %016lx\n" , - regs->r10, regs->r11, regs->r12); + regs->r10, regs->r11, regs->r12);printk ("R13: %016lx R14: %016lx R15: %016lx\n" , - regs->r13, regs->r14, regs->r15); + regs->r13, regs->r14, regs->r15);#endif }
@@ -98,7 +98,7 @@ void page_walk(unsigned long virt_addrespgentry_t *tab = (pgentry_t *)start_info.pt_base, page;unsigned long addr = virt_address;printk ("Pagetable walk from virt %lx, base %lx:\n" , virt_address, start_info.pt_base); - +#if defined(__x86_64__) page = tab[l4_table_offset (addr)]; tab =pte_to_virt (page);
@@ -110,7 +110,7 @@ void page_walk(unsigned long virt_addres page = tab[l2_table_offset (addr)]; tab =pte_to_virt (page);printk (" L2 = %" PRIpte" (%p) [offset = %lx]\n" , page, tab,l2_table_offset (addr)); - + page = tab[l1_table_offset (addr)];printk (" L1 = %" PRIpte" [offset = %lx]\n" , page,l1_table_offset (addr));
@@ -136,7 +136,7 @@ static int handle_cow(unsigned long addrif (!(page & _PAGE_PRESENT))return 0 ; tab =pte_to_virt (page); - + page = tab[l1_table_offset (addr)];if (!(page & _PAGE_PRESENT))return 0 ;
@@ -204,10 +204,10 @@ void do_page_fault(struct pt_regs *regs,/* If we are already handling a page fault, and got another one that means we faulted in pagetable walk. Continuing here would cause -a recursive fault */ -if (handling_pg_fault ==1 ) +a recursive fault */ +if (handling_pg_fault ==1 ) { -printk ("Page fault in pagetable walk (access to invalid memory?).\n" ); +printk ("Page fault in pagetable walk (access to invalid memory?).\n" );HYPERVISOR_sched_op (SCHEDOP_shutdown, &sched_shutdown); } handling_pg_fault++;
@@ -244,7 +244,7 @@ void do_general_protection(struct pt_regstruct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_crash };#ifdef __i386__printk ("GPF eip: %p, error_code=%lx\n" , regs->eip, error_code); -#else +#else printk ("GPF rip: %p, error_code=%lx\n" , regs->rip, error_code);#endif dump_regs (regs);
@@ -319,12 +319,12 @@ static trap_info_t trap_table[] = { { 19, 0, __KERNEL_CS, (unsigned long)simd_coprocessor_error }, { 0, 0, 0, 0 } }; - +void trap_init (void ) { -HYPERVISOR_set_trap_table (trap_table); +HYPERVISOR_set_trap_table (trap_table); }void trap_fini (void )
extras/mini-os/arch/x86/x86_32.S +12 -12
@@ -14,12 +14,12 @@ .text .globl _start, shared_info, hypercall_page - + _start: cld lss stack_start,%esp andl $(~(__STACK_SIZE-1)), %esp - push %esi + push %esi call start_kernel stack_start:
@@ -67,7 +67,7 @@ CS = 0x2C popl %ds; \ popl %es; \ addl $4,%esp; \ - iret; + iret; ENTRY(divide_error) pushl $0 # no error code
@@ -97,7 +97,7 @@ do_exception: pushl %eax call *%edi jmp ret_from_exception - + ret_from_exception: movb CS(%esp),%cl addl $8,%esp
@@ -145,7 +145,7 @@ ecrit: /**** END OF CRITICAL REGION *** # registers are in each frame. We do this quickly using the lookup table # 'critical_fixup_table'. For each byte offset in the critical region, it # provides the number of bytes which have already been popped from the -# interrupted stack frame. +# interrupted stack frame. critical_region_fixup: addl $critical_fixup_table-scrit,%eax movzbl (%eax),%eax # %eax contains num bytes popped
@@ -163,8 +163,8 @@ 15: subl $4,%esi # pre-decr loop 15b 16: movl %edi,%esp # final %edi is top of merged stack jmp 11b - -critical_fixup_table: + +critical_fixup_table: .byte 0x00,0x00,0x00 # testb $0xff,(%esi) .byte 0x00,0x00 # jne 14f .byte 0x00 # pop %ebx
@@ -180,7 +180,7 @@ critical_fixup_table: .byte 0x28 # iret .byte 0x00,0x00,0x00,0x00 # movb $1,1(%esi) .byte 0x00,0x00 # jmp 11b - + # Hypervisor uses this for application faults while it executes. ENTRY(failsafe_callback) pop %ds
@@ -188,7 +188,7 @@ ENTRY(failsafe_callback) pop %fs pop %gs iret - + ENTRY(coprocessor_error) pushl $0 pushl $do_coprocessor_error
@@ -262,7 +262,7 @@ ENTRY(alignment_check) ENTRY(page_fault) pushl $do_page_fault jmp do_exception - + ENTRY(machine_check) pushl $0 pushl $do_machine_check
@@ -283,8 +283,8 @@ ENTRY(thread_starter) xorl %ebp,%ebp pushl %eax call *%ebx - call exit_thread - + call exit_thread + ENTRY(__arch_switch_threads) movl 4(%esp), %ecx /* prev */ movl 8(%esp), %edx /* next */
extras/mini-os/arch/x86/x86_64.S +37 -37
183 lines not on this page · raw message
extras/mini-os/blkfront.c +4 -4
@@ -1,4 +1,4 @@ -/* Minimal block driver for Mini-OS. +/* Minimal block driver for Mini-OS. * Copyright (c) 2007-2008 Samuel Thibault. * Based on netfront.c. */
@@ -111,7 +111,7 @@ struct blkfront_dev *init_blkfront(char#endif snprintf (path,sizeof (path),"%s/backend-id" , nodename); - dev->dom =xenbus_read_integer (path); + dev->dom =xenbus_read_integer (path);evtchn_alloc_unbound (dev->dom, blkfront_handler, dev, &dev->evtchn); s = (struct blkif_sring *)alloc_page ();
@@ -587,7 +587,7 @@ int blkfront_posix_rwop(int fd, uint8_t*/* Write mode checks */ if (write) {/*Make sure we have write permission */ -if (dev->info.info &VDISK_READONLY +if (dev->info.info &VDISK_READONLY || (dev->info.mode !=O_RDWR && dev->info.mode !=O_WRONLY )) { errno =EACCES ;return -1 ;
@@ -651,7 +651,7 @@ int blkfront_posix_rwop(int fd, uint8_t* }/* For an aligned R/W we can read up to the maximum transfer size */ - bytes = count > (BLKIF_MAX_SEGMENTS_PER_REQUEST -not_page_aligned)*PAGE_SIZE + bytes = count > (BLKIF_MAX_SEGMENTS_PER_REQUEST -not_page_aligned)*PAGE_SIZE ? (BLKIF_MAX_SEGMENTS_PER_REQUEST -not_page_aligned)*PAGE_SIZE : count & ~(blocksize -1 ); aiocb.aio_nbytes = bytes;
extras/mini-os/console/console.c +24 -24
115 lines not on this page · raw message
extras/mini-os/console/xenbus.c +2 -2
@@ -84,7 +84,7 @@ struct consfront_dev *init_consfront(cha#endif snprintf (path,sizeof (path),"%s/backend-id" , nodename); -if ((res =xenbus_read_integer (path)) <0 ) +if ((res =xenbus_read_integer (path)) <0 )return NULL ;else dev->dom = res;
@@ -166,7 +166,7 @@ done:XenbusState state;char path[strlen (dev->backend) +1 +19 +1 ];snprintf (path,sizeof (path),"%s/state" , dev->backend); - +xenbus_watch_path_token (XBT_NIL , path, path, &dev->events); msg =NULL ; state =xenbus_read_integer (path);
extras/mini-os/console/xencons_ring.c +5 -5
@@ -30,10 +30,10 @@ static inline struct xencons_interface *return mfn_to_virt (start_info.console.domU.mfn); else return NULL; -} - +} +int xencons_ring_send_no_notify (struct consfront_dev *dev,const char *data,unsigned len) -{ +{int sent =0 ;struct xencons_interface *intf;XENCONS_RING_IDX cons, prod;
@@ -55,7 +55,7 @@ int xencons_ring_send_no_notify(struct cwmb (); intf->out_prod = prod; - +return sent; }
@@ -67,7 +67,7 @@ int xencons_ring_send(struct consfront_dnotify_daemon (dev);return sent; -} +}
extras/mini-os/events.c +3 -3
@@ -7,9 +7,9 @@* File: events.c * Author: Rolf Neugebauer ([email protected]) * Changes: Grzegorz Milos ([email protected]) -* +* * Date: Jul 2003, changes Jun 2005 -* +* * Environment: Xen Minimal OS * Description: Deals with events recieved on event channels *
@@ -125,7 +125,7 @@ void unbind_evtchn(evtchn_port_t port ) rc =HYPERVISOR_event_channel_op (EVTCHNOP_close, &close);if ( rc )printk ("WARN: close_port %s failed rc=%d. ignored\n" , port, rc); - + }evtchn_port_t bind_virq (uint32_t virq,evtchn_handler_t handler,void *data)
extras/mini-os/fbfront.c +3 -3
@@ -1,5 +1,5 @@/* -* Frame Buffer + Keyboard driver for Mini-OS. +* Frame Buffer + Keyboard driver for Mini-OS. * Samuel Thibault <[email protected]>, 2008 * Based on blkfront.c. */
@@ -87,7 +87,7 @@ struct kbdfront_dev *init_kbdfront(char#endif snprintf (path,sizeof (path),"%s/backend-id" , nodename); - dev->dom =xenbus_read_integer (path); + dev->dom =xenbus_read_integer (path);evtchn_alloc_unbound (dev->dom, kbdfront_handler, dev, &dev->evtchn); dev->page = s = (struct xenkbd_page *)alloc_page ();
@@ -425,7 +425,7 @@ struct fbfront_dev *init_fbfront(char *_#endif snprintf (path,sizeof (path),"%s/backend-id" , nodename); - dev->dom =xenbus_read_integer (path); + dev->dom =xenbus_read_integer (path);evtchn_alloc_unbound (dev->dom, fbfront_handler, dev, &dev->evtchn); dev->page = s = (struct xenfb_page *)alloc_page ();
extras/mini-os/gntmap.c +8 -8
@@ -21,12 +21,12 @@* The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */
@@ -100,7 +100,7 @@ gntmap_set_max_grants(struct gntmap *map } static int -_gntmap_map_grant_ref(struct gntmap_entry *entry, +_gntmap_map_grant_ref(struct gntmap_entry *entry, unsigned long host_addr, uint32_t domid, uint32_t ref,
@@ -178,7 +178,7 @@ gntmap_munmap(struct gntmap *map, unsign }void * -gntmap_map_grant_refs(struct gntmap *map, +gntmap_map_grant_refs(struct gntmap *map, uint32_t count, uint32_t *domids, int domids_stride,
extras/mini-os/gnttab.c +4 -4
@@ -1,14 +1,14 @@ -/* +/* **************************************************************************** * (C) 2006 - Cambridge University **************************************************************************** * * File: gnttab.c -* Author: Steven Smith ([email protected]) +* Author: Steven Smith ([email protected]) * Changes: Grzegorz Milos ([email protected]) -* +* * Date: July 2006 -* +* * Environment: Xen Minimal OS * Description: Simple grant tables implementation. About as stupid as it's * possible to be and still work.
extras/mini-os/hypervisor.c +14 -14
@@ -1,27 +1,27 @@/****************************************************************************** * hypervisor.c -* +* * Communication to/from hypervisor. -* +* * Copyright (c) 2002-2003, K A Fraser * Copyright (c) 2005, Grzegorz Milos, [email protected],Intel Research Cambridge -* +* * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: -* +* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */
@@ -45,7 +45,7 @@ void do_hypervisor_callback(struct pt_revcpu_info_t *vcpu_info = &s->vcpu_info[cpu]; in_callback =1 ; - + vcpu_info->evtchn_upcall_pending =0 ;/* NB x86. No need for a barrier here -- XCHG is a barrier on x86. */ #if !defined(__i386__) && !defined(__x86_64__)
@@ -57,7 +57,7 @@ void do_hypervisor_callback(struct pt_re { l1i =__ffs (l1); l1 &= ~(1UL << l1i); - +while ( (l2 =active_evtchns (cpu, s, l1i)) !=0 ) { l2i =__ffs (l2);
@@ -105,7 +105,7 @@ inline void unmask_evtchn(uint32_t port)* The following is basically the equivalent of 'hw_resend_irq'. Just like * a real IO-APIC we 'lose the interrupt edge' if the channel is masked. */ -if (synch_test_bit (port, &s->evtchn_pending[0 ]) && +if (synch_test_bit (port, &s->evtchn_pending[0 ]) && !synch_test_and_set_bit (port / (sizeof (unsigned long ) *8 ), &vcpu_info->evtchn_pending_sel) ) {
extras/mini-os/include/arch/cc.h +3 -3
@@ -1,7 +1,7 @@ -/* +/* * lwip/arch/cc.h * -* Compiler-specific types and macros for lwIP running on mini-os +* Compiler-specific types and macros for lwIP running on mini-os * * Tim Deegan <[email protected]>, July 2007 */
@@ -28,7 +28,7 @@ typedef uint16_t u_short;/* Compiler hints for packing lwip's structures - */ #define PACK_STRUCT_FIELD (_x) _x#define PACK_STRUCT_STRUCT __attribute__ ((packed)) -#define PACK_STRUCT_BEGIN +#define PACK_STRUCT_BEGIN #define PACK_STRUCT_END /* Platform specific diagnostic output - */
extras/mini-os/include/arch/perf.h +2 -2
@@ -1,7 +1,7 @@ -/* +/* * lwip/arch/perf.h * -* Arch-specific performance measurement for lwIP running on mini-os +* Arch-specific performance measurement for lwIP running on mini-os * * Tim Deegan <[email protected]>, July 2007 */
extras/mini-os/include/arch/sys_arch.h +2 -2
@@ -1,7 +1,7 @@ -/* +/* * lwip/arch/sys_arch.h * -* Arch-specific semaphores and mailboxes for lwIP running on mini-os +* Arch-specific semaphores and mailboxes for lwIP running on mini-os * * Tim Deegan <[email protected]>, July 2007 */
extras/mini-os/include/console.h +13 -13
@@ -1,14 +1,14 @@ -/* +/* **************************************************************************** * (C) 2006 - Grzegorz Milos - Cambridge University **************************************************************************** * * File: console.h * Author: Grzegorz Milos -* Changes: -* +* Changes: +* * Date: Mar 2006 -* +* * Environment: Xen Minimal OS * Description: Console interface. *
@@ -21,16 +21,16 @@* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: -* +* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef _LIB_CONSOLE_H_
@@ -67,7 +67,7 @@ void print(int direct, const char *fmt,void printk (const char *fmt, ...);void xprintk (const char *fmt, ...); -#define tprintk(_fmt, _args...) printk("[%s] " _fmt, current->name, ##_args) +#define tprintk(_fmt, _args...) printk("[%s] " _fmt, current->name, ##_args)void xencons_rx (char *buf,unsigned len,struct pt_regs *regs);void xencons_tx (void );
extras/mini-os/include/events.h +2 -2
@@ -7,9 +7,9 @@* File: events.h * Author: Rolf Neugebauer ([email protected]) * Changes: Grzegorz Milos ([email protected]) -* +* * Date: Jul 2003, changes Jun 2005 -* +* * Environment: Xen Minimal OS * Description: Deals with events on the event channels *
extras/mini-os/include/gntmap.h +1 -1
@@ -19,7 +19,7 @@ int gntmap_munmap(struct gntmap *map, unsigned long start_address, int count);void * -gntmap_map_grant_refs(struct gntmap *map, +gntmap_map_grant_refs(struct gntmap *map, uint32_t count, uint32_t *domids, int domids_stride,
extras/mini-os/include/hypervisor.h +2 -2
@@ -1,8 +1,8 @@/****************************************************************************** * hypervisor.h -* +* * Hypervisor handling. -* +* * * Copyright (c) 2002, K A Fraser * Copyright (c) 2005, Grzegorz Milos
extras/mini-os/include/ioremap.h +8 -8
@@ -7,16 +7,16 @@* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: -* +* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */
extras/mini-os/include/lib-gpl.h +3 -3
@@ -5,10 +5,10 @@* * File: lib.h * Author: Rolf Neugebauer ([email protected]) -* Changes: -* +* Changes: +* * Date: Aug 2003 -* +* * Environment: Xen Minimal OS * Description: Random useful library functions, from Linux' * include/linux/kernel.h
extras/mini-os/include/lib.h +3 -3
@@ -5,10 +5,10 @@* * File: lib.h * Author: Rolf Neugebauer ([email protected]) -* Changes: -* +* Changes: +* * Date: Aug 2003 -* +* * Environment: Xen Minimal OS * Description: Random useful library functions, contains some freebsd stuff *
extras/mini-os/include/lwipopts.h +1 -1
@@ -1,7 +1,7 @@/* * lwipopts.h * -* Configuration for lwIP running on mini-os +* Configuration for lwIP running on mini-os * * Tim Deegan <[email protected]>, July 2007 */
extras/mini-os/include/mm.h +8 -8
@@ -9,16 +9,16 @@* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: -* +* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */
extras/mini-os/include/netfront.h +1 -1
@@ -15,7 +15,7 @@ extern struct wait_queue_head netfront_q#ifdef HAVE_LWIP /* Call this to bring up the netfront interface and the lwIP stack. -* N.B. _must_ be called from a thread; it's not safe to call this from +* N.B. _must_ be called from a thread; it's not safe to call this from * app_main(). */ void start_networking (void );void stop_networking (void );
extras/mini-os/include/posix/net/if.h +1 -1
@@ -1,5 +1,5 @@/* -* This code is mostly taken from NetBSD net/if.h +* This code is mostly taken from NetBSD net/if.h * Changes: Stefano Stabellini <[email protected]> * ******************************************************************************
extras/mini-os/include/posix/sys/poll.h +1 -1
@@ -1,5 +1,5 @@/* -* This code is mostly taken from FreeBSD sys/sys/poll.h +* This code is mostly taken from FreeBSD sys/sys/poll.h * Changes: Stefano Stabellini <[email protected]> * ****************************************************************************
extras/mini-os/include/sched.h +1 -1
@@ -33,7 +33,7 @@ void idle_thread_fn(void *unused);#define clear_runnable (_thread) (_thread->flags &= ~RUNNABLE_FLAG)#define switch_threads (prev, next) arch_switch_threads(prev, next) - +/* Architecture specific setup of thread creation. */ struct thread *arch_create_thread (char *name,void (*function)(void *),void *data);
extras/mini-os/include/semaphore.h +3 -3
@@ -5,7 +5,7 @@#include <mini-os/spinlock.h> /* -* Implementation of semaphore in Mini-os is simple, because +* Implementation of semaphore in Mini-os is simple, because * there are no preemptive threads, the atomicity is guaranteed. */
@@ -32,10 +32,10 @@ struct rw_semaphore {#define __MUTEX_INITIALIZER (name) \ __SEMAPHORE_INITIALIZER(name,1) - +#define __DECLARE_SEMAPHORE_GENERIC (name,count) \ struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) - +#define DECLARE_MUTEX (name) __DECLARE_SEMAPHORE_GENERIC(name,1)#define DECLARE_MUTEX_LOCKED (name) __DECLARE_SEMAPHORE_GENERIC(name,0)
extras/mini-os/include/sys/time.h +2 -2
@@ -8,9 +8,9 @@* Author: Rolf Neugebauer ([email protected]) * Changes: Grzegorz Milos ([email protected]) * Robert Kaiser ([email protected]) -* +* * Date: Jul 2003, changes: Jun 2005, Sep 2006 -* +* * Environment: Xen Minimal OS * Description: Time and timer functions *
extras/mini-os/include/time.h +3 -3
@@ -8,9 +8,9 @@* Author: Rolf Neugebauer ([email protected]) * Changes: Grzegorz Milos ([email protected]) * Robert Kaiser ([email protected]) -* +* * Date: Jul 2003, changes: Jun 2005, Sep 2006 -* +* * Environment: Xen Minimal OS * Description: Time and timer functions *
@@ -27,7 +27,7 @@* This value is adjusted by frequency drift. * NOW() returns the current time. * The other macros are for convenience to approximate short intervals -* of real time into system time +* of real time into system time */ typedef int64_t s_time_t ;#define NOW () ((s_time_t)monotonic_clock())
extras/mini-os/include/types.h +3 -3
@@ -5,10 +5,10 @@* * File: types.h * Author: Rolf Neugebauer ([email protected]) -* Changes: -* +* Changes: +* * Date: May 2003 -* +* * Environment: Xen Minimal OS * Description: a random collection of type definitions *
extras/mini-os/include/wait.h +2 -2
@@ -86,9 +86,9 @@ static inline void wake_up(struct wait_qwake (get_current ()); \remove_wait_queue (&wq, &__wait); \local_irq_restore (flags); \ -} while(0) +} while(0) -#define wait_event (wq, condition) wait_event_deadline(wq, condition, 0) +#define wait_event (wq, condition) wait_event_deadline(wq, condition, 0)
extras/mini-os/include/x86/arch_limits.h +1 -1
@@ -16,5 +16,5 @@#define __STACK_SIZE_PAGE_ORDER 4#define __STACK_SIZE (__PAGE_SIZE * (1 << __STACK_SIZE_PAGE_ORDER)) - +#endif /* __ARCH_LIMITS_H__ */
extras/mini-os/include/x86/arch_mm.h +8 -8
@@ -9,16 +9,16 @@* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: -* +* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */
extras/mini-os/include/x86/arch_sched.h +3 -3
@@ -7,11 +7,11 @@static inline struct thread *get_current (void ) {struct thread **current; -#ifdef __i386__ +#ifdef __i386__ registerunsigned long sp asm("esp" );#else registerunsigned long sp asm("rsp" ); -#endif +#endif current = (void *)(unsigned long )(sp & ~(__STACK_SIZE-1 ));return *current; }
@@ -21,5 +21,5 @@ extern void __arch_switch_threads(unsign#define arch_switch_threads (prev,next) __arch_switch_threads(&(prev)->sp, &(next)->sp) - +#endif /* __ARCH_SCHED_H__ */
extras/mini-os/include/x86/os.h +5 -5
@@ -1,6 +1,6 @@/****************************************************************************** * os.h -* +* * random collection of macros and definition */
@@ -72,7 +72,7 @@ void arch_fini(void); -/* +/* * The use of 'barrier' in the following reflects their use as local-lock * operations. Reentrancy must be prevented (e.g., __cli()) /before/ following * critical operations are executed. All critical operations must complete
@@ -347,7 +347,7 @@ static inline unsigned long __xchg(unsig* @nr: Bit to clear * @addr: Address to count from * -* This operation is atomic and cannot be reordered. +* This operation is atomic and cannot be reordered. * It also implies a memory barrier. */ static __inline__int test_and_clear_bit (int nr,volatile void * addr)
@@ -515,7 +515,7 @@ static inline unsigned long __synch_cmpxstatic __inline__void synch_set_bit (int nr,volatile void * addr) { - __asm__ __volatile__ ( + __asm__ __volatile__ ("lock btsl %1,%0" :"=m" (ADDR ) :"Ir" (nr) :"memory" ); }
@@ -547,7 +547,7 @@ static __inline__ int synch_test_and_clestatic __inline__int synch_const_test_bit (int nr,const volatile void * addr) { -return ((1UL << (nr &31 )) & +return ((1UL << (nr &31 )) & (((const volatile unsigned int *) addr)[nr >>5 ])) !=0 ; }
extras/mini-os/include/x86/traps.h +8 -8
@@ -1,13 +1,13 @@ -/* +/* **************************************************************************** * (C) 2005 - Grzegorz Milos - Intel Reseach Cambridge **************************************************************************** * * File: traps.h * Author: Grzegorz Milos ([email protected]) -* +* * Date: Jun 2005 -* +* * Environment: Xen Minimal OS * Description: Deals with traps *
@@ -46,7 +46,7 @@ struct pt_regs {unsigned long rbx;/* arguments: non interrupts/non tracing syscalls only save upto here*/ unsigned long r11; -unsigned long r10; +unsigned long r10;unsigned long r9;unsigned long r8;unsigned long rax;
@@ -55,14 +55,14 @@ struct pt_regs {unsigned long rsi;unsigned long rdi;unsigned long orig_rax; -/* end of arguments */ +/* end of arguments */ /* cpu exception frame or undefined */ unsigned long rip;unsigned long cs; -unsigned long eflags; -unsigned long rsp; +unsigned long eflags; +unsigned long rsp;unsigned long ss; -/* top of stack page */ +/* top of stack page */ };
extras/mini-os/include/x86/x86_32/hypercall-x86_32.h +6 -6
@@ -1,23 +1,23 @@/****************************************************************************** * hypercall-x86_32.h -* +* * Copied from XenLinux. -* +* * Copyright (c) 2002-2004, K A Fraser -* +* * This file may be distributed separately from the Linux kernel, or * incorporated into other software packages, subject to the following license: -* +* * Permission is hereby granted, free of charge, to any person obtaining a copy * of this source file (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to * the following conditions: -* +* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. -* +* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
extras/mini-os/include/x86/x86_64/hypercall-x86_64.h +8 -8
@@ -1,27 +1,27 @@/****************************************************************************** * hypercall-x86_64.h -* +* * Copied from XenLinux. -* +* * Copyright (c) 2002-2004, K A Fraser -* +* * 64-bit updates: * Benjamin Liu <[email protected]> * Jun Nakajima <[email protected]> -* +* * This file may be distributed separately from the Linux kernel, or * incorporated into other software packages, subject to the following license: -* +* * Permission is hereby granted, free of charge, to any person obtaining a copy * of this source file (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to * the following conditions: -* +* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. -* +* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -155,7 +155,7 @@ HYPERVISOR_stack_switch(static inline int HYPERVISOR_set_callbacks ( -unsigned long event_address,unsigned long failsafe_address, +unsigned long event_address,unsigned long failsafe_address,unsigned long syscall_address) { return _hypercall3(int, set_callbacks,
extras/mini-os/kernel.c +20 -20
@@ -1,29 +1,29 @@/****************************************************************************** * kernel.c -* +* * Assorted crap goes here, including the initial C entry point, jumped at * from head.S. -* +* * Copyright (c) 2002-2003, K A Fraser & R Neugebauer * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge * Copyright (c) 2006, Robert Kaiser, FH Wiesbaden -* +* * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: -* +* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */
@@ -54,12 +54,12 @@ void setup_xen_features(void)xen_feature_info_t fi;int i, j; -for (i =0 ; i <XENFEAT_NR_SUBMAPS ; i++) +for (i =0 ; i <XENFEAT_NR_SUBMAPS ; i++) { fi.submap_idx = i;if (HYPERVISOR_xen_version (XENVER_get_features, &fi) <0 )break ; - +for (j=0 ; j<32 ; j++) xen_features[i*32 +j] = !!(fi.submap &1 <<j); }
@@ -90,18 +90,18 @@ void start_kernel(start_info_t *si)printk (" start_info: %p(VA)\n" , si);printk (" nr_pages: 0x%lx\n" , si->nr_pages);printk (" shared_inf: 0x%08lx(MA)\n" , si->shared_info); -printk (" pt_base: %p(VA)\n" , (void *)si->pt_base); +printk (" pt_base: %p(VA)\n" , (void *)si->pt_base);printk ("nr_pt_frames: 0x%lx\n" , si->nr_pt_frames); -printk (" mfn_list: %p(VA)\n" , (void *)si->mfn_list); +printk (" mfn_list: %p(VA)\n" , (void *)si->mfn_list);printk (" mod_start: 0x%lx(VA)\n" , si->mod_start); -printk (" mod_len: %lu\n" , si->mod_len); +printk (" mod_len: %lu\n" , si->mod_len);printk (" flags: 0x%x\n" , (unsigned int )si->flags); -printk (" cmd_line: %s\n" , +printk (" cmd_line: %s\n" , si->cmd_line ? (const char *)si->cmd_line :"NULL" );/* Set up events. */ init_events (); - +/* ENABLE EVENT DELIVERY. This is disabled at start of day. */ __sti ();
@@ -124,10 +124,10 @@ void start_kernel(start_info_t *si)/* Init grant tables */ init_gnttab (); - +/* Init scheduler. */ init_sched (); - +/* Init XenBus */ init_xenbus ();
extras/mini-os/lib/math.c +3 -3
@@ -5,10 +5,10 @@* * File: math.c * Author: Rolf Neugebauer ([email protected]) -* Changes: -* +* Changes: +* * Date: Aug 2003 -* +* * Environment: Xen Minimal OS * Description: Library functions for 64bit arith and other * from freebsd, files in sys/libkern/ (qdivrem.c, etc)
extras/mini-os/lib/printf.c +4 -4
@@ -5,7 +5,7 @@* * File: printf.c * Author: Rolf Neugebauer ([email protected]) -* Changes: Grzegorz Milos ([email protected]) +* Changes: Grzegorz Milos ([email protected]) * * Date: Aug 2003, Aug 2005 *
@@ -199,7 +199,7 @@ static char * number(char * buf, char * i =0 ;if (num ==0 ) tmp[i++]='0' ; -else +else {/* XXX KAF: force unsigned mod and div. */ unsigned long long num2=(unsigned long long )num;
@@ -589,7 +589,7 @@ int vsscanf(const char * buf, const charif (!*fmt)break ; ++fmt; - +/* skip this conversion. * advance both strings to next white space */
@@ -678,7 +678,7 @@ int vsscanf(const char * buf, const charbreak ;case '%' :/* looking for '%' in str */ -if (*str++ !='%' ) +if (*str++ !='%' )return num;continue ;default :
extras/mini-os/lib/string.c +6 -6
@@ -5,10 +5,10 @@* * File: string.c * Author: Rolf Neugebauer ([email protected]) -* Changes: -* +* Changes: +* * Date: Aug 2003 -* +* * Environment: Xen Minimal OS * Description: Library function for string and memory manipulation * Origin unknown
@@ -151,12 +151,12 @@ size_t strnlen(const char * s, size_t cochar *strcat (char * dest,const char * src) {char *tmp = dest; - +while (*dest) dest++; - +while ((*dest++ = *src++) !='\0' ); - +return tmp; }
extras/mini-os/lib/sys.c +5 -5
@@ -529,8 +529,8 @@ int fstat(int fd, struct stat *buf) buf->st_uid =0 ; buf->st_gid =0 ; buf->st_size =0 ; - buf->st_atime = - buf->st_mtime = + buf->st_atime = + buf->st_mtime = buf->st_ctime =time (NULL );return 0 ; }
@@ -618,7 +618,7 @@ DIR *opendir(const char *name)struct dirent *readdir (DIR *dir) {return NULL ; -} +}int closedir (DIR *dir) {
@@ -1328,7 +1328,7 @@ unsupported_function_crash(umask);/* We could support that. */ unsupported_function_log (int, chdir,-1 ); -/* No dynamic library support. */ +/* No dynamic library support. */ unsupported_function_log(void *, dlopen, NULL); unsupported_function_log(void *, dlsym, NULL); unsupported_function_log(char *, dlerror, NULL);
@@ -1368,7 +1368,7 @@ unsupported_function_log(char *, if_inde unsupported_function_log(struct if_nameindex *, if_nameindex, (struct if_nameindex *) NULL);unsupported_function_crash (if_freenameindex); -/* Linuxish abi for the Caml runtime, don't support +/* Linuxish abi for the Caml runtime, don't support Log, and return an error code if possible. If it is not possible to inform the application of an error, then crash instead! */
extras/mini-os/lib/xmalloc.c +6 -6
@@ -1,4 +1,4 @@ -/* +/* **************************************************************************** * (C) 2005 - Grzegorz Milos - Intel Research Cambridge ****************************************************************************
@@ -6,11 +6,11 @@* File: xmaloc.c * Author: Grzegorz Milos ([email protected]) * Samuel Thibault ([email protected]) -* Changes: -* +* Changes: +* * Date: Aug 2005 * Jan 2008 -* +* * Environment: Xen Minimal OS * Description: simple memory allocator *
@@ -286,9 +286,9 @@ void *_realloc(void *ptr, size_t size)maybe_split (hdr, pad->hdr_size + size, hdr->size);return ptr; } - + new =_xmalloc (size,DEFAULT_ALIGN ); -if (new ==NULL ) +if (new ==NULL )return NULL ;memcpy (new, ptr, old_data_size);
extras/mini-os/lwip-arch.c +7 -7
@@ -1,7 +1,7 @@ -/* +/* * lwip-arch.c * -* Arch-specific semaphores and mailboxes for lwIP running on mini-os +* Arch-specific semaphores and mailboxes for lwIP running on mini-os * * Tim Deegan <[email protected]>, July 2007 */
@@ -44,7 +44,7 @@ void sys_sem_signal(sys_sem_t sem)* signaled. If the "timeout" argument is non-zero, the thread should * only be blocked for the specified time (measured in * milliseconds). -* +* * If the timeout argument is non-zero, the return value is the number of * milliseconds spent waiting for the semaphore to be signaled. If the * semaphore wasn't signaled within the specified time, the return value is
@@ -76,9 +76,9 @@ uint32_t sys_arch_sem_wait(sys_sem_t semif (sem->count >0 ) { sem->count--;sys_arch_unprotect (prot); -return NSEC_TO_MSEC (NOW () - then); +return NSEC_TO_MSEC (NOW () - then); } - +sys_arch_unprotect (prot);return SYS_ARCH_TIMEOUT ; }
@@ -215,12 +215,12 @@ uint32_t sys_arch_mbox_tryfetch(sys_mbox* each thread has a list of timeouts which is repressented as a linked * list of sys_timeout structures. The sys_timeouts structure holds a * pointer to a linked list of timeouts. This function is called by -* the lwIP timeout scheduler and must not return a NULL value. +* the lwIP timeout scheduler and must not return a NULL value. * * In a single threadd sys_arch implementation, this function will * simply return a pointer to a global sys_timeouts variable stored in * the sys_arch module. */ -struct sys_timeouts *sys_arch_timeouts (void ) +struct sys_timeouts *sys_arch_timeouts (void ) {static struct sys_timeouts timeout;return &timeout;
extras/mini-os/lwip-net.c +38 -38
185 lines not on this page · raw message
extras/mini-os/mm.c +38 -38
201 lines not on this page · raw message
extras/mini-os/netfront.c +8 -8
@@ -1,4 +1,4 @@ -/* Minimal network driver for Mini-OS. +/* Minimal network driver for Mini-OS. * Copyright (c) 2006-2007 Jacob Gorm Hansen, University of Copenhagen. * Based on netfront.c from Xen Linux. *
@@ -162,7 +162,7 @@ moretodo:void * page = buf->page;/* We are sure to have free gnttab entries since they got released above */ - buf->gref = req->gref = + buf->gref = req->gref =gnttab_grant_access (dev->dom,virt_to_mfn (page),0 ); req->id = id;
@@ -171,7 +171,7 @@ moretodo:wmb (); dev->rx.req_prod_pvt = req_prod + i; - +RING_PUSH_REQUESTS_AND_CHECK_NOTIFY (&dev->rx, notify);if (notify)notify_remote_via_evtchn (dev->evtchn);
@@ -189,7 +189,7 @@ void network_tx_buf_gc(struct netfront_d prod = dev->tx.sring->rsp_prod;rmb ();/* Ensure we see responses up to 'rp'. */ -for (cons = dev->tx.rsp_cons; cons != prod; cons++) +for (cons = dev->tx.rsp_cons; cons != prod; cons++) {struct netif_tx_response *txrsp;struct net_buffer *buf;
@@ -571,12 +571,12 @@ void init_rx_buffers(struct netfront_devint notify;/* Rebuild the RX buffer freelist and the RX ring itself. */ -for (requeue_idx =0 , i =0 ; i <NET_RX_RING_SIZE ; i++) +for (requeue_idx =0 , i =0 ; i <NET_RX_RING_SIZE ; i++) {struct net_buffer * buf = &dev->rx_buffers[requeue_idx]; req =RING_GET_REQUEST (&dev->rx, requeue_idx); - buf->gref = req->gref = + buf->gref = req->gref =gnttab_grant_access (dev->dom,virt_to_mfn (buf->page),0 ); req->id = requeue_idx;
@@ -588,7 +588,7 @@ void init_rx_buffers(struct netfront_devRING_PUSH_REQUESTS_AND_CHECK_NOTIFY (&dev->rx, notify); -if (notify) +if (notify)notify_remote_via_evtchn (dev->evtchn); dev->rx.sring->rsp_event = dev->rx.rsp_cons +1 ;
@@ -623,7 +623,7 @@ void netfront_xmit(struct netfront_dev *memcpy (page,data,len); - buf->gref = + buf->gref = tx->gref =gnttab_grant_access (dev->dom,virt_to_mfn (page),1 ); tx->offset=0 ;
extras/mini-os/pcifront.c +6 -6
@@ -1,4 +1,4 @@ -/* Minimal PCI driver for Mini-OS. +/* Minimal PCI driver for Mini-OS. * Copyright (c) 2007-2008 Samuel Thibault. * Based on blkfront.c. */
@@ -157,7 +157,7 @@ struct pcifront_dev *init_pcifront(charprintk ("******************* PCIFRONT for %s **********\n\n\n" , nodename);snprintf (path,sizeof (path),"%s/backend-id" , nodename); - dom =xenbus_read_integer (path); + dom =xenbus_read_integer (path);if (dom ==-1 ) {printk ("no backend\n" );return NULL ;
@@ -518,7 +518,7 @@ int pcifront_enable_msi(struct pcifront_ op.devfn =PCI_DEVFN (slot, fun);pcifront_op (dev, &op); - +if (op.err)return op.err;else
@@ -543,7 +543,7 @@ int pcifront_disable_msi(struct pcifront op.devfn =PCI_DEVFN (slot, fun);pcifront_op (dev, &op); - +return op.err; }
@@ -572,7 +572,7 @@ int pcifront_enable_msix(struct pcifrontmemcpy (op.msix_entries, entries, n *sizeof (*entries));pcifront_op (dev, &op); - +if (op.err)return op.err;
@@ -600,6 +600,6 @@ int pcifront_disable_msix(struct pcifron op.devfn =PCI_DEVFN (slot, fun);pcifront_op (dev, &op); - +return op.err; }
extras/mini-os/sched.c +19 -19
@@ -1,4 +1,4 @@ -/* +/* **************************************************************************** * (C) 2005 - Grzegorz Milos - Intel Research Cambridge ****************************************************************************
@@ -6,13 +6,13 @@* File: sched.c * Author: Grzegorz Milos * Changes: Robert Kaiser -* +* * Date: Aug 2005 -* +* * Environment: Xen Minimal OS * Description: simple scheduler for Mini-Os * -* The scheduler is non-preemptive (cooperative), and schedules according +* The scheduler is non-preemptive (cooperative), and schedules according * to Round Robin algorithm. * ****************************************************************************
@@ -22,16 +22,16 @@* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: -* +* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */
@@ -79,7 +79,7 @@ void schedule(void)unsigned long flags; prev = current; -local_irq_save (flags); +local_irq_save (flags);if (in_callback) {printk ("Must not call schedule() from a callback\n" );
@@ -106,7 +106,7 @@ void schedule(void)else if (thread->wakeup_time < min_wakeup_time) min_wakeup_time = thread->wakeup_time; } -if (is_runnable (thread)) +if (is_runnable (thread)) { next = thread;/* Put this thread on the end of the list */
@@ -255,17 +255,17 @@ void th_f1(void *data)schedule ();printk ("Thread \"%s\" releases the semaphore\n" , current->name);up (&mutex); - - + +gettimeofday (&tv1,NULL );for (;;) {gettimeofday (&tv2,NULL );if (tv2.tv_sec - tv1.tv_sec >2 )break ; } - - -schedule (); + + +schedule (); } }
extras/mini-os/test.c +11 -11
@@ -1,28 +1,28 @@/****************************************************************************** * test.c -* +* * Test code for all the various frontends; split from kernel.c -* +* * Copyright (c) 2002-2003, K A Fraser & R Neugebauer * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge * Copyright (c) 2006, Robert Kaiser, FH Wiesbaden -* +* * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: -* +* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */
extras/mini-os/xenbus/xenbus.c +18 -18
@@ -1,15 +1,15 @@ -/* +/* **************************************************************************** * (C) 2006 - Cambridge University **************************************************************************** * * File: xenbus.c -* Author: Steven Smith ([email protected]) +* Author: Steven Smith ([email protected]) * Changes: Grzegorz Milos ([email protected]) * Changes: John D. Ramsdell -* +* * Date: Jun 2006, chages Aug 2005 -* +* * Environment: Xen Minimal OS * Description: Minimal implementation of xenbus *
@@ -51,7 +51,7 @@ static struct watch {xenbus_event_queue *events;struct watch *next; } *watches; -struct xenbus_req_info +struct xenbus_req_info {int in_use:1 ;struct wait_queue_head waitq;
@@ -196,10 +196,10 @@ static void xenbus_thread_func(void *ignstruct xsd_sockmsg msg;unsigned prod = xenstore_buf->rsp_prod; -for (;;) +for (;;) {wait_event (xb_waitq, prod != xenstore_buf->rsp_prod); -while (1 ) +while (1 ) { prod = xenstore_buf->rsp_prod; DEBUG("Rsp_cons %d, rsp_prod %d.\n", xenstore_buf->rsp_cons,
@@ -298,7 +298,7 @@ static int allocate_xenbus_id(void)static int probe;int o_probe; -while (1 ) +while (1 ) {spin_lock (&req_lock);if (nr_live_reqs <NR_REQS )
@@ -308,7 +308,7 @@ static int allocate_xenbus_id(void) } o_probe = probe; -for (;;) +for (;;) {if (!req_info[o_probe].in_use)break ;
@@ -373,7 +373,7 @@ static void xb_write(int type, int req_i/* Wait for the ring to drain to the point where we can send the message. */ prod = xenstore_buf->req_prod; -if (prod + len - xenstore_buf->req_cons >XENSTORE_RING_SIZE ) +if (prod + len - xenstore_buf->req_cons >XENSTORE_RING_SIZE ) {/* Wait for there to be space on the ring */ DEBUG("prod %d, len %d, cons %d, size %d; waiting.\n",
@@ -389,7 +389,7 @@ static void xb_write(int type, int req_ioverflowing the ring. Do so. */ total_off =0 ; req_off =0 ; -while (total_off < len) +while (total_off < len) { this_chunk =min (cur_req->len - req_off,XENSTORE_RING_SIZE -MASK_XENSTORE_IDX (prod));
@@ -398,7 +398,7 @@ static void xb_write(int type, int req_i prod += this_chunk; req_off += this_chunk; total_off += this_chunk; -if (req_off == cur_req->len) +if (req_off == cur_req->len) { req_off =0 ;if (cur_req == &header_req)
@@ -465,7 +465,7 @@ static char *errmsg(struct xsd_sockmsg * res[rep->len] =0 ;free (rep);return res; -} +}/* Send a debug message to xenbus. Can block. */ static void xenbus_debug_msg (const char *msg)
@@ -535,7 +535,7 @@ char *xenbus_read(xenbus_transaction_t xchar *xenbus_write (xenbus_transaction_t xbt,const char *path,const char *value) { -struct write_req req[] = { +struct write_req req[] = { {path,strlen (path) +1 }, {value,strlen (value)}, };
@@ -552,7 +552,7 @@ char* xenbus_watch_path_token( xenbus_tr {struct xsd_sockmsg *rep; -struct write_req req[] = { +struct write_req req[] = { {path,strlen (path) +1 }, {token,strlen (token) +1 }, };
@@ -582,7 +582,7 @@ char* xenbus_unwatch_path_token( xenbus_ {struct xsd_sockmsg *rep; -struct write_req req[] = { +struct write_req req[] = { {path,strlen (path) +1 }, {token,strlen (token) +1 }, };
@@ -644,7 +644,7 @@ char *xenbus_get_perms(xenbus_transactiochar *xenbus_set_perms (xenbus_transaction_t xbt,const char *path,domid_t dom,char perm) {char value[PERM_MAX_SIZE ]; -struct write_req req[] = { +struct write_req req[] = { {path,strlen (path) +1 }, {value,0 }, };
@@ -786,7 +786,7 @@ static void do_ls_test(const char *pre)free (msg);return ; } -for (x =0 ; dirs[x]; x++) +for (x =0 ; dirs[x]; x++) {printk ("ls %s[%d] -> %s\n" , pre, x, dirs[x]);free (dirs[x]);
Quoted 5 lines · Andrew Cooper, le Mon 26 Nov 2012 16:24:08 +0000, a écrit :
4 Trailing whitespace cleanup. (because it is very messy)
Patch 4 is likely to be more controversial than the others, so I am less fussed if it gets nacked, but would still appreciate the issue being fixed.
Well, it does not actually bring any more readability, while it brings more difficult browsing of the history...
Samuel