Execute BIOS function
ph.schulz at gmx.de
Sun Jun 6 22:09:54 GMT 2004
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.
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), "b"(ebx), "c"(ptr)
More information about the freebsd-current