How instructions are differentiated from data?

后端 未结 6 1367
长情又很酷
长情又很酷 2020-12-01 12:42

While reading ARM core document, I got this doubt. How does the CPU differentiate the read data from data bus, whether to execute it as an instruction or as a data that it c

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-01 13:32

    Simple answer - it doesn't. Machine code instructions are just binary numbers, as are data. More complicated answer - your processor may (or may not) provide segmentation of memory, meaning that attempting to execute what has been specified as data causes a trap of some sort. This is one of the the meaning of a "segmentation fault" - the processor tried to execute something that was not labelled as being executable code.

提交回复
热议问题