Memory Test Program

I am working on a program that is supposed to test blocks of memory locations.

I need to write to memory, read it back and make sure that the write and the read are then the same.

My question is, How do I avoid writing over my code segment? Also I am supposed to implement a far call. It is my understanding that a far call is in another code segment. How do I avoid writing over this as well?

If anyone can help, thanks!


  • According to intel software development manual - part 3 ,chapter four ,which talks about protection at both segment level and page level. It cannot possible as far as I know that to disable the mode once the bit 0 of cr0 set and switch to protected mode .(correct me if I am wrong) This also depends on the privilege level the processor is running . But clearing the WP of CR0 is different for page level protection ..

    In protected mode, the processor always uses the segment selector part of the far address to access the corresponding descriptor in the GDT or LDT. If this is so , then over writing to the far segment is not possible .(Correct me again ,if I am wrong) .

    But writing to a memory block and reading it back causes the memory to over write .Most memory resident virus concepts starts at this point. Your question depends on the mode your going to run the program. Using JMP or lds,les,....; instructions . This you have to be clear.

    Go through the chapter 6 and 4 of the above mentioned manual .


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion