- 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()
This commit is contained in:
parent
0a0e59605c
commit
e753c7b915
@ -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 @@ GENASSYM_CONF= ${USERMODE}/usermode/genassym.cf
|
||||
## (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 @@ COMPAT_AS= obj
|
||||
##
|
||||
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 @@ NVFLAGS= -n
|
||||
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
|
||||
##
|
||||
|
@ -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 @@ file arch/usermode/dev/ttycons.c ttycons
|
||||
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
|
||||
|
@ -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 ptc char 6 pty
|
||||
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
|
||||
|
@ -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 <jmcneill@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 @@ mainbus_attach(device_t parent, device_t self, void *opaque)
|
||||
|
||||
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);
|
||||
|
||||
|
@ -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 <jmcneill@invisible.ca>
|
||||
@ -35,6 +35,7 @@ struct thunkbus_attach_args {
|
||||
#define THUNKBUS_TYPE_CLOCK 1
|
||||
#define THUNKBUS_TYPE_TTYCONS 2
|
||||
#define THUNKBUS_TYPE_DISKIMAGE 3
|
||||
#define THUNKBUS_TYPE_GENFB 4
|
||||
|
||||
union {
|
||||
struct {
|
||||
|
@ -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 <jmcneill@invisible.ca>
|
||||
@ -90,4 +90,10 @@ void * thunk_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off
|
||||
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 */
|
||||
|
@ -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 <jmcneill@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 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.14 2011/08/23 17:00:36 jmcneill Exp $"
|
||||
#include <machine/thunk.h>
|
||||
|
||||
#include "opt_memsize.h"
|
||||
#include "opt_sdl.h"
|
||||
|
||||
char machine[] = "usermode";
|
||||
char machine_arch[] = "usermode";
|
||||
@ -61,6 +62,9 @@ void usermode_reboot(void);
|
||||
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 @@ main(int argc, char *argv[])
|
||||
|
||||
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] != '-') {
|
||||
|
@ -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 <jmcneill@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 @@ thunk_setcontext(const ucontext_t *ucp)
|
||||
}
|
||||
|
||||
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 @@ thunk_mprotect(void *addr, size_t len, int prot)
|
||||
return mprotect(addr, len, prot);
|
||||
}
|
||||
|
||||
char *
|
||||
thunk_getenv(const char *name)
|
||||
{
|
||||
return getenv(name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user