Iulian Neamtiu
2005-04-06 16:31:59 UTC
As I mentioned in recitation today,
you might want to print the CRC ('digest') of the page you're paging out
and the CRC of the page when you bring it in, in order to make sure you
bring the correct page in from disk, and the page doesn't get corrupted.
GeekOS comes with crc computing routines. All you have to do is:
- in your Write_To_Paging_File() ,compute the CRC of the page you're
about to page out:
crc32(0, paddr, PAGE_SIZE)
and save it in the associated Disk_Page structure.
- in your Read_From_Paging_File(), after you read from the disk into
paddr, compute the CRC of the page you've read from the disk:
crc32(0, paddr, PAGE_SIZE)
The two crc's should obviously be equal.
Iulian
you might want to print the CRC ('digest') of the page you're paging out
and the CRC of the page when you bring it in, in order to make sure you
bring the correct page in from disk, and the page doesn't get corrupted.
GeekOS comes with crc computing routines. All you have to do is:
- in your Write_To_Paging_File() ,compute the CRC of the page you're
about to page out:
crc32(0, paddr, PAGE_SIZE)
and save it in the associated Disk_Page structure.
- in your Read_From_Paging_File(), after you read from the disk into
paddr, compute the CRC of the page you've read from the disk:
crc32(0, paddr, PAGE_SIZE)
The two crc's should obviously be equal.
Iulian