I think that the OP wanted to find a way to emulate an embedded system on a PC. In particular, he wanted to emulate the non-volatile RAM by saving a specific segment to disk between program invocations.
From what I have seen from linker maps on PC-targetted compilers, data segments are given special symbols to define their beginning and ending. Even if they are not given these special symbols, you can define your own by defining an "int" before and another "int" after all the variables that your application needs. Check the linker map to make sure that the variables you defined really do end up bracketing the application variables. Then write some start-up code and shut-down code to fill the memory thusly bracketted by a binary file read and start-up, and a similar binary file write on shut-down. If seg_start is a variable at the start of the segment and seg_end is a variable at the end, then the number of bytes read or written should be
((char*)(&seg_end))-((char*)(&seg_start))
and of course the starting address is &seg_start.
-Robert Scott Ypsilanti, Michigan (Reply through this forum, not by direct e-mail to me, as automatic reply address is fake.)