From owner-freebsd-hackers Sun Dec 13 13:52:11 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA13727 for freebsd-hackers-outgoing; Sun, 13 Dec 1998 13:52:11 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA13722 for ; Sun, 13 Dec 1998 13:52:09 -0800 (PST) (envelope-from des@flood.ping.uio.no) Received: (from des@localhost) by flood.ping.uio.no (8.9.1/8.9.1) id WAA03268; Sun, 13 Dec 1998 22:52:04 +0100 (CET) (envelope-from des) To: hackers@FreeBSD.ORG Subject: Screensaver KLDs From: Dag-Erling Smorgrav Date: 13 Dec 1998 22:52:04 +0100 Message-ID: Lines: 129 X-Mailer: Gnus v5.5/Emacs 19.34 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Well, I got itchy fingers again and tried to write a graphical screensaver KLD. I used one of the existing screensaver modules as a template; it compiles fine, and I'm pretty sure that the code is mostly correct, but kldload refuses to load it: root@niobe /sys/modules/syscons/vga# make Warning: Object directory not changed from original /usr/src/sys/modules/syscons/vga @ -> /usr/src/sys machine -> /usr/src/sys/i386/include cc -O -pipe -I/usr/src/sys/modules/syscons/vga/.. -DKERNEL -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wuninitialized -Wformat -fformat-extensions -ansi -DKLD_MODULE -nostdinc -I- -I/usr/src/sys/modules/syscons/vga/.. -I/usr/src/sys/modules/syscons/vga -I/usr/src/sys/modules/syscons/vga/@ -c vga_saver.c vga_saver.c:102: warning: initialization from incompatible pointer type gensetdefs vga_saver.o cc -O -pipe -I/usr/src/sys/modules/syscons/vga/.. -DKERNEL -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wuninitialized -Wformat -fformat-extensions -ansi -DKLD_MODULE -nostdinc -I- -I/usr/src/sys/modules/syscons/vga/.. -I/usr/src/sys/modules/syscons/vga -I/usr/src/sys/modules/syscons/vga/@ -c setdef0.c cc -O -pipe -I/usr/src/sys/modules/syscons/vga/.. -DKERNEL -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wuninitialized -Wformat -fformat-extensions -ansi -DKLD_MODULE -nostdinc -I- -I/usr/src/sys/modules/syscons/vga/.. -I/usr/src/sys/modules/syscons/vga -I/usr/src/sys/modules/syscons/vga/@ -c setdef1.c ld -Bshareable -o vga_saver_mod.ko setdef0.o vga_saver.o setdef1.o root@niobe /sys/modules/syscons/vga# kldload vga_saver kldload: can't load vga_saver: Exec format error The other screensaver KLDs work fine (and they all produce the same warning when compiling). I'm running a bleeding-edge 3.0 Elf kernel. Here's the source: /*- * Copyright (c) 1998 Dag-Erling Coïdan Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $Id$ */ #include #include #include #include #include #include static int saved_mode; static u_char *vid; static int counter; static void vga_saver(int blank) { scr_stat *scp = cur_console; /* foo! */ if (!vid) return; if (blank) { /* switch to graphics mode */ if (scrn_blanked <= 0) { scp->status |= SAVER_RUNNING; saved_mode = scp->mode; if (sc_set_graphics_mode(scp, NULL, SW_VGA_CG320)) { scp->status &= ~SAVER_RUNNING; saved_mode = 0; return; } fillw(1, vid, 320); } /* update display */ vid[counter++] = 1; if (counter >= 320) counter = 0; vid[counter] = 15; } else { /* return to previous video mode */ if (scrn_blanked > 0) { if (saved_mode) sc_set_graphics_mode(scp, NULL, saved_mode); scrn_blanked = 0; scp->status &= ~SAVER_RUNNING; saved_mode = 0; } } } static int vga_saver_load(void) { video_info_t info; /* check that the console is capable of running in 320x200x256 */ if ((*biosvidsw.get_info)(cur_console->adp, SW_VGA_CG320, &info)) return ENODEV; vid = (u_char *)info.vi_window; return add_scrn_saver(vga_saver); } static int vga_saver_unload(void) { return remove_scrn_saver(vga_saver); } SAVER_MODULE(vga_saver); DES -- Dag-Erling Smorgrav - des@flood.ping.uio.no To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message