From owner-freebsd-hackers Sun Jan 27 16:28: 1 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from acl.lanl.gov (acl.lanl.gov [128.165.147.1]) by hub.freebsd.org (Postfix) with SMTP id F04EB37B41B for ; Sun, 27 Jan 2002 16:27:50 -0800 (PST) Received: (qmail 665567 invoked from network); 27 Jan 2002 17:27:47 -0700 Received: from snaresland.acl.lanl.gov (128.165.147.113) by acl.lanl.gov with SMTP; 27 Jan 2002 17:27:47 -0700 Received: (qmail 13369 invoked by uid 3499); 27 Jan 2002 17:27:47 -0700 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 27 Jan 2002 17:27:47 -0700 Date: Sun, 27 Jan 2002 17:27:47 -0700 (MST) From: Ronald G Minnich X-X-Sender: To: Matthew Emmerton Cc: Subject: Re: Reading BIOS from userland In-Reply-To: <004a01c1a704$974dca50$1200a8c0@gsicomp.on.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG A stupid little program you can use to dump the bios and hunt for version strings etc. default is to mmap the last 1MB of the 32-bit space and write it to fildes 1. optional arg 1 is the base (it gets << 16 thanks to a strtol bug that may no longer be there); optional arg 2 is the size. Tested on just about everything linux, I don't see any obvious gotchas for freebsd. ron #include #include #include #include main(int argc, char *argv[]) { int i; volatile unsigned char *cp; int fd; volatile void *v; off_t nvram = 0xfff00000; /* avoid linux mmap bug */ size_t length = 0x100000 /*- 0x1000*/; if (argc > 1) nvram = (strtol(argv[1], 0, 0)) << 16; if (argc > 2) length = (strtol(argv[2], 0, 0)) ; if((fd = open("/dev/mem",O_RDWR)) != -1) { v = mmap(0, length, PROT_READ | PROT_WRITE, MAP_SHARED,fd,nvram); fprintf(stderr, "mmap returns %p\n", v); if ( (int)v == -1) { perror("mmap"); exit(1); } } else { perror("open /dev/mem"); exit(1); } write(1, v, length); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message