Take the 2-minute tour ×

Unlike (most) RISC arch, x86 instructions have different length. The start/end of an instruction don't have to align. so if the compiler don't care, they will generate some instructions which just lying across the page margin.

Assume that if the head of an instruction start from the last byte of a page: PAGE-1, which is marked as executable. and the rest of the instruction is in the second page: PAGE-2, which is marked as forbid to execute.

In such case, what will hardware do?

Does compiler need to care such cases?

share|improve this question
Upvoted unexplained downvote. –  EJP Jul 12 '11 at 8:24
add comment

1 Answer

up vote 4 down vote accepted

Hardware will (should, haven't tested) generate a GPF.

Compiler shouldn't care.

share|improve this answer
I seem to recall a bug relating to that with early iapx286 chips in protected mode. Either it would fail to GPF on an instruction going over a boundary, or would erroneously GPF on an instruction that should just fit inside. Can't recall at the moment... #trivia :-) –  Brian Knoblauch Jul 12 '11 at 17:59
add comment

Your Answer


