[coreboot] why my program segmentation fault?
Star Liu
minxinjianxin at gmail.com
Mon Jul 14 11:31:18 CEST 2008
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? thanks!
#include <string.h>
#include <stdio.h>
void CopyMemoryToFile(char* FilePath, long StartAddress, long OffSet)
{
FILE* Memory;
Memory=fopen (FilePath, "w");
if(Memory!=NULL)
{
void* Start;
Start=StartAddress;
fwrite(Start, 1, OffSet, Memory);
}
fclose(Memory);
}
int main (void)
{
CopyMemoryToFile("~/cgi-bin_d/Memory",0xFFFF0000,0xFFFF);
return 0;
}
--
Regards!
Star
Shanghai, China
More information about the coreboot
mailing list