From owner-freebsd-current@FreeBSD.ORG Mon Jun 7 05:05:03 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A658416A4CE for ; Mon, 7 Jun 2004 05:05:03 +0000 (GMT) Received: from carver.gumbysoft.com (carver.gumbysoft.com [66.220.23.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9671C43D48 for ; Mon, 7 Jun 2004 05:05:03 +0000 (GMT) (envelope-from dwhite@gumbysoft.com) Received: by carver.gumbysoft.com (Postfix, from userid 1000) id 8893472DF2; Sun, 6 Jun 2004 22:05:03 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by carver.gumbysoft.com (Postfix) with ESMTP id 848B672DB5; Sun, 6 Jun 2004 22:05:03 -0700 (PDT) Date: Sun, 6 Jun 2004 22:05:03 -0700 (PDT) From: Doug White To: Phil Schulz In-Reply-To: <40C3960F.4080305@gmx.de> Message-ID: <20040606220342.W12662@carver.gumbysoft.com> References: <40C3960F.4080305@gmx.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-current@freebsd.org Subject: Re: Execute BIOS function X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2004 05:05:03 -0000 On Mon, 7 Jun 2004, Phil Schulz wrote: > Hello List! > > The radio transmitter of my new centrino laptop is turned on by a BIOS > function which resides at a certain location in memory. I know how to > find the adress of the function's start but I don't yet know how to tell > the OS that I do want to execute that memory region and make it let me > do so. When running the program I get "Bus error (core dumped)". So the > question is: Can I actually execute the BIOS code from userland or do I > have to do it from kernelspace? How do I tell the kernel that I want the > memory region to be executed and make it let me do so? You'll have to do it from the kernel. The BIOS call will probably want to poke memory and I/O ports you won't have access to. You'll also need to know if its 32-bit protected mode safe or not; if not you'll have to set up VM86() to make the call. Have you checked for an ACPI method that implements the same thing? > > Any help is appreciated. > > Thanks, > Phil. > > -- > > This is a part of the code (I hope it's not going to be wrapped). > bios_code_addr holds the BIOS function's start address and dev_mem is a > file-descriptor to /dev/mem. > > ptr = mmap( 0, BIOS_CODE_SIZE, PROT_EXEC, > 0, dev_mem, bios_code_addr ); > > __asm__ __volatile__ ( > "call *%3 \t\n" > : "=a"(eax) > : "a"(eax), "b"(ebx), "c"(ptr) > ); > > > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" > -- Doug White | FreeBSD: The Power to Serve dwhite@gumbysoft.com | www.FreeBSD.org