Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 Jun 2004 13:21:56 +0200
From:      Phil Schulz <ph.schulz@gmx.de>
To:        Doug White <dwhite@gumbysoft.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Execute BIOS function
Message-ID:  <40C5A154.7010900@gmx.de>
In-Reply-To: <20040606220342.W12662@carver.gumbysoft.com>
References:  <40C3960F.4080305@gmx.de> <20040606220342.W12662@carver.gumbysoft.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Doug White wrote:

>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?
>
>  
>
How do I check that?

I managed to get the code running in the kernel. I plan on posting the 
code at the ipw(4) homepage soon. I'm not sure if I did things 'right' 
but it works reliably.

Phil.

>>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"
>>
>>    
>>
>
>  
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40C5A154.7010900>