I thought this was a somewhat interesting phenomenon but found myself unable to explain it. When reading from a memory location that is explicitly qualified to utilize the CS segment register, and storing that value, the logical address (offset component) essentially serves as the linear address (i.e. a flat-memory model) and the contents of the memory address provided are written to the storage location operand. Code selectors can be read from, so this is normal. Upon writing to a location that is explicitly qualified to use the CS segment register, a fault is generated; this is also normal as code selectors cannot be written to. However, the fault claims that an illegal memory read from 0xffffffff has been made. Where did this come from? Is the process actually attempting to read from this address or does the act of writing to a read-only segment simply output that an invalid read was attempted at the segment's limit?
Thanks for the insight.
Segment Write Exception
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Segment Write Exception
I don't know how you observed that.
A segment violation yields a GPF with the segment as the error code. It does not provide you directly with the segment offset responsible, you have to find that out yourself by disassembling the faulted instruction and computing the value of its memory operands.
A segment violation yields a GPF with the segment as the error code. It does not provide you directly with the segment offset responsible, you have to find that out yourself by disassembling the faulted instruction and computing the value of its memory operands.
Re: Segment Write Exception
I was using inline assembly in VC 2010. I used the logical address x of a local on the current call stack.Combuster wrote:I don't know how you observed that.
Quite simply
Code: Select all
mov cs:[x], 0x1
Re: Segment Write Exception
It sounds like you are running your software under windows. If this is the case then the message you get will be whatever windows and its debugger decide to give you.
To guarantee that you can see the 'real' fault information you need to write your own operating system and your own fault handlers. Then you will see what Combuster described.
To guarantee that you can see the 'real' fault information you need to write your own operating system and your own fault handlers. Then you will see what Combuster described.
If a trainstation is where trains stop, what is a workstation ?