[coreboot] why my program segmentation fault?
peter at stuge.se
Mon Jul 14 12:36:48 CEST 2008
Please do stop cross-posting.
On Mon, Jul 14, 2008 at 05:31:18PM +0800, Star Liu wrote:
> I wrote a program to copy the memory content of FFFF0000-FFFFFFFF
> to a file, but it says "Segmentation fault", (i use AMD64 lenny, so
> the address is long), how could i fix it?
In Linux your program is running in protected mode, so all memory
addresses are virtual and not physical. The CPU has a paging table
which is used for translating between virtual and physical. In Linux,
mmap() is used to request access to a physical address space. Your
application does not have anything set up at virtual address
0xffff0000 so the kernel rewards it with SIGSEGV as usual. SIGSEGV
always means that an application has tried to access virtual memory
that it did not have access to.
flashrom uses mmap() correctly already. Let's continue that thread.
More information about the coreboot