Module Name: src Committed By: jmcneill Date: Thu Aug 25 11:06:29 UTC 2011
Modified Files: src/sys/arch/usermode/conf: Makefile.usermode files.usermode majors.usermode src/sys/arch/usermode/dev: mainbus.c src/sys/arch/usermode/include: mainbus.h thunk.h src/sys/arch/usermode/usermode: machdep.c thunk.c Log Message: - build thunk code with warnings - add option SDL which pulls in thunk_sdl code and links the kernel to libSDL - add an experimental framebuffer driver based on thunk_sdl, enable with: options SDL genfb* at mainbus? wsdisplay* at genfb? options WS_KERNEL_FG=WSCOL_GREEN options WSEMUL_VT100 - reserve a major # for wsdisplay - add thunk_getenv() To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/usermode/conf/Makefile.usermode cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/conf/files.usermode cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/conf/majors.usermode cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/dev/mainbus.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/include/mainbus.h cvs rdiff -u -r1.16 -r1.17 src/sys/arch/usermode/include/thunk.h cvs rdiff -u -r1.14 -r1.15 src/sys/arch/usermode/usermode/machdep.c cvs rdiff -u -r1.18 -r1.19 src/sys/arch/usermode/usermode/thunk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/usermode/conf/Makefile.usermode diff -u src/sys/arch/usermode/conf/Makefile.usermode:1.13 src/sys/arch/usermode/conf/Makefile.usermode:1.14 --- src/sys/arch/usermode/conf/Makefile.usermode:1.13 Mon Aug 22 21:45:38 2011 +++ src/sys/arch/usermode/conf/Makefile.usermode Thu Aug 25 11:06:29 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.usermode,v 1.13 2011/08/22 21:45:38 jmcneill Exp $ +# $NetBSD: Makefile.usermode,v 1.14 2011/08/25 11:06:29 jmcneill Exp $ MACHINE_ARCH= usermode USETOOLS?= no @@ -15,12 +15,22 @@ ## (2) compile settings ## USERMODE_LIBS= -lrt +USERMODE_CPPFLAGS=-U_KERNEL -I/usr/include +USERMODE_CPPFLAGS+=${CWARNFLAGS} ${NOGCCERROR:D:U-Werror} DEFCOPTS= -fno-omit-frame-pointer CPPFLAGS+= -Dusermode CPPFLAGS.init_main.c+= -Dmain=kernmain -CPPFLAGS.thunk.c+= -U_KERNEL -I/usr/include +OPT_SDL= %SDL% +.if !empty(OPT_SDL) +SDL_CFLAGS!= sdl-config --cflags +SDL_LIBS!= sdl-config --libs +USERMODE_LIBS+= -Wl,-Bdynamic ${SDL_LIBS} +.endif + +CPPFLAGS.thunk.c+= ${USERMODE_CPPFLAGS} +CPPFLAGS.thunk_sdl.c+= ${SDL_CFLAGS} ${USERMODE_CPPFLAGS} ## ## (3) libkern and compat @@ -33,6 +43,10 @@ ## MD_OBJS= thunk.o MD_CFILES= ${USERMODE}/usermode/thunk.c +.if !empty(OPT_SDL) +MD_OBJS+= thunk_sdl.o +MD_CFILES+= ${USERMODE}/usermode/thunk_sdl.c +.endif MD_SFILES= ## @@ -57,6 +71,9 @@ thunk.o: ${USERMODE}/usermode/thunk.c ${CC} ${CPPFLAGS.thunk.c} -c -o $@ ${USERMODE}/usermode/thunk.c +thunk_sdl.o: ${USERMODE}/usermode/thunk_sdl.c + ${CC} ${CPPFLAGS.thunk_sdl.c} -c -o $@ ${USERMODE}/usermode/thunk_sdl.c + ## ## (7) misc settings ## Index: src/sys/arch/usermode/conf/files.usermode diff -u src/sys/arch/usermode/conf/files.usermode:1.5 src/sys/arch/usermode/conf/files.usermode:1.6 --- src/sys/arch/usermode/conf/files.usermode:1.5 Wed Aug 24 10:59:10 2011 +++ src/sys/arch/usermode/conf/files.usermode Thu Aug 25 11:06:29 2011 @@ -1,9 +1,10 @@ -# $NetBSD: files.usermode,v 1.5 2011/08/24 10:59:10 jmcneill Exp $ +# $NetBSD: files.usermode,v 1.6 2011/08/25 11:06:29 jmcneill Exp $ maxpartitions 8 maxusers 8 16 64 defparam opt_memsize.h MEMSIZE +defflag opt_sdl.h SDL define thunkbus { } @@ -26,6 +27,9 @@ attach ld at thunkbus with ld_thunkbus file arch/usermode/dev/ld_thunkbus.c ld_thunkbus +attach genfb at thunkbus with genfb_thunkbus +file arch/usermode/dev/genfb_thunkbus.c genfb_thunkbus + file arch/usermode/usermode/copy.c file arch/usermode/usermode/machdep.c file arch/usermode/usermode/pmap.c Index: src/sys/arch/usermode/conf/majors.usermode diff -u src/sys/arch/usermode/conf/majors.usermode:1.2 src/sys/arch/usermode/conf/majors.usermode:1.3 --- src/sys/arch/usermode/conf/majors.usermode:1.2 Fri Aug 12 12:59:13 2011 +++ src/sys/arch/usermode/conf/majors.usermode Thu Aug 25 11:06:29 2011 @@ -1,4 +1,4 @@ -# $NetBSD: majors.usermode,v 1.2 2011/08/12 12:59:13 jmcneill Exp $ +# $NetBSD: majors.usermode,v 1.3 2011/08/25 11:06:29 jmcneill Exp $ device-major cons char 0 device-major ctty char 1 @@ -10,4 +10,5 @@ device-major log char 7 device-major com char 8 com device-major md char 24 block 17 md +device-major wsdisplay char 47 wsdisplay device-major ld char 69 block 19 ld Index: src/sys/arch/usermode/dev/mainbus.c diff -u src/sys/arch/usermode/dev/mainbus.c:1.4 src/sys/arch/usermode/dev/mainbus.c:1.5 --- src/sys/arch/usermode/dev/mainbus.c:1.4 Fri Aug 12 12:59:13 2011 +++ src/sys/arch/usermode/dev/mainbus.c Thu Aug 25 11:06:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.4 2011/08/12 12:59:13 jmcneill Exp $ */ +/* $NetBSD: mainbus.c,v 1.5 2011/08/25 11:06:29 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill <jmcne...@invisible.ca> @@ -26,8 +26,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef _KERNEL_OPT +#include "opt_sdl.h" +#endif + #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.4 2011/08/12 12:59:13 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.5 2011/08/25 11:06:29 jmcneill Exp $"); #include <sys/param.h> #include <sys/proc.h> @@ -72,8 +76,15 @@ taa.taa_type = THUNKBUS_TYPE_CPU; config_found_ia(self, "thunkbus", &taa, mainbus_print); + +#if defined(SDL) + taa.taa_type = THUNKBUS_TYPE_GENFB; + config_found_ia(self, "thunkbus", &taa, mainbus_print); +#endif + taa.taa_type = THUNKBUS_TYPE_CLOCK; config_found_ia(self, "thunkbus", &taa, mainbus_print); + taa.taa_type = THUNKBUS_TYPE_TTYCONS; config_found_ia(self, "thunkbus", &taa, mainbus_print); Index: src/sys/arch/usermode/include/mainbus.h diff -u src/sys/arch/usermode/include/mainbus.h:1.3 src/sys/arch/usermode/include/mainbus.h:1.4 --- src/sys/arch/usermode/include/mainbus.h:1.3 Fri Aug 12 12:59:13 2011 +++ src/sys/arch/usermode/include/mainbus.h Thu Aug 25 11:06:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.h,v 1.3 2011/08/12 12:59:13 jmcneill Exp $ */ +/* $NetBSD: mainbus.h,v 1.4 2011/08/25 11:06:29 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill <jmcne...@invisible.ca> @@ -35,6 +35,7 @@ #define THUNKBUS_TYPE_CLOCK 1 #define THUNKBUS_TYPE_TTYCONS 2 #define THUNKBUS_TYPE_DISKIMAGE 3 +#define THUNKBUS_TYPE_GENFB 4 union { struct { Index: src/sys/arch/usermode/include/thunk.h diff -u src/sys/arch/usermode/include/thunk.h:1.16 src/sys/arch/usermode/include/thunk.h:1.17 --- src/sys/arch/usermode/include/thunk.h:1.16 Wed Aug 24 10:56:45 2011 +++ src/sys/arch/usermode/include/thunk.h Thu Aug 25 11:06:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: thunk.h,v 1.16 2011/08/24 10:56:45 reinoud Exp $ */ +/* $NetBSD: thunk.h,v 1.17 2011/08/25 11:06:29 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill <jmcne...@invisible.ca> @@ -90,4 +90,10 @@ int thunk_munmap(void *addr, size_t len); int thunk_mprotect(void *addr, size_t len, int prot); +char * thunk_getenv(const char *); + +int thunk_sdl_init(unsigned int, unsigned int, unsigned short); +void * thunk_sdl_getfb(size_t); +int thunk_sdl_getchar(void); + #endif /* !_ARCH_USERMODE_INCLUDE_THUNK_H */ Index: src/sys/arch/usermode/usermode/machdep.c diff -u src/sys/arch/usermode/usermode/machdep.c:1.14 src/sys/arch/usermode/usermode/machdep.c:1.15 --- src/sys/arch/usermode/usermode/machdep.c:1.14 Tue Aug 23 17:00:36 2011 +++ src/sys/arch/usermode/usermode/machdep.c Thu Aug 25 11:06:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.14 2011/08/23 17:00:36 jmcneill Exp $ */ +/* $NetBSD: machdep.c,v 1.15 2011/08/25 11:06:29 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill <jmcne...@invisible.ca> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.14 2011/08/23 17:00:36 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.15 2011/08/25 11:06:29 jmcneill Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -44,6 +44,7 @@ #include <machine/thunk.h> #include "opt_memsize.h" +#include "opt_sdl.h" char machine[] = "usermode"; char machine_arch[] = "usermode"; @@ -61,6 +62,9 @@ void main(int argc, char *argv[]) { +#if defined(SDL) + extern int genfb_thunkbus_cnattach(void); +#endif extern void ttycons_consinit(void); extern void pmap_bootstrap(void); extern void kernmain(void); @@ -68,7 +72,10 @@ saved_argv = argv; - ttycons_consinit(); +#if defined(SDL) + if (genfb_thunkbus_cnattach() == 0) +#endif + ttycons_consinit(); for (i = 1; i < argc; i++) { if (argv[i][0] != '-') { Index: src/sys/arch/usermode/usermode/thunk.c diff -u src/sys/arch/usermode/usermode/thunk.c:1.18 src/sys/arch/usermode/usermode/thunk.c:1.19 --- src/sys/arch/usermode/usermode/thunk.c:1.18 Wed Aug 24 10:56:44 2011 +++ src/sys/arch/usermode/usermode/thunk.c Thu Aug 25 11:06:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: thunk.c,v 1.18 2011/08/24 10:56:44 reinoud Exp $ */ +/* $NetBSD: thunk.c,v 1.19 2011/08/25 11:06:29 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill <jmcne...@invisible.ca> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: thunk.c,v 1.18 2011/08/24 10:56:44 reinoud Exp $"); +__RCSID("$NetBSD: thunk.c,v 1.19 2011/08/25 11:06:29 jmcneill Exp $"); #include <sys/types.h> #include <sys/ansi.h> @@ -165,7 +165,7 @@ } void -thunk_makecontext(ucontext_t *ucp, void (*func)(), int argc, +thunk_makecontext(ucontext_t *ucp, void (*func)(void), int argc, void (*arg1)(void *), void *arg2) { assert(argc == 2); @@ -324,3 +324,8 @@ return mprotect(addr, len, prot); } +char * +thunk_getenv(const char *name) +{ + return getenv(name); +}