From owner-freebsd-current@FreeBSD.ORG Sun Jun 6 15:09:54 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 2F00116A4CE for ; Sun, 6 Jun 2004 15:09:54 -0700 (PDT) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 53A2343D49 for ; Sun, 6 Jun 2004 15:09:53 -0700 (PDT) (envelope-from ph.schulz@gmx.de) Received: (qmail 11357 invoked by uid 65534); 6 Jun 2004 22:09:48 -0000 Received: from p5090CADC.dip0.t-ipconnect.de (EHLO gmx.de) (80.144.202.220) by mail.gmx.net (mp018) with SMTP; 07 Jun 2004 00:09:48 +0200 X-Authenticated: #1954550 Message-ID: <40C3960F.4080305@gmx.de> Date: Mon, 07 Jun 2004 00:09:19 +0200 From: Phil Schulz User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040520 X-Accept-Language: de, en-us, en MIME-Version: 1.0 To: freebsd-current@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: 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: Sun, 06 Jun 2004 22:09:54 -0000 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? 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) );