Hacker News new | past | comments | ask | show | jobs | submit login

It's discussed in the body.

It gives another version that separates code and data. The challenge is that in x86 assembler, there is no distinction between code and data at the cpu-acting-on-memory level - either way you're reading memory and indeed reading some of the same byte values of member.




While in modern x86 CPUs the memory pages have a more restricted set of possible access rights, in the now obsolete memory protection scheme based on segments, which was introduced in Intel 80286 and extended to 32 bits in Intel 80386, it was possible to have memory segments from which only instruction fetches were allowed, but no data reads or writes were permitted, and memory segments from which instruction fetches were prohibited but data reads and writes were allowed.

So in 16-bit and 32-bit x86 CPUs, starting with 80286, it was possible to distinguish code memory and data memory, without allowing any mixing between them. The distinction was possible even in the assembly source text, for some of the more sophisticated assemblers, because you could declare the segments used, with all their attributes, and the assembler could check if the segments were used correctly, based on ASSUME directives that specified the content of the segment registers.

In the more recent 64-bit x86 CPUs, it is possible to prohibit instruction fetches from a memory page, but it is not possible to prohibit data reads from a memory page with code.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: