I only deal with C recently, but I have dealt with hand assembles and assemblers.However, they only dealt with the content in accordance with the textbook.
Suddenly I went back to the starting point and wondered if every bit string was assigned an instruction in the world of 1 and 0
I still wonder what would happen if I put in a bit string with no instruction assignment and run it if it wasn't assigned
I would like to hear from you if there are people who have studied hard.
language-specification
It's safer to think that it's not assigned to everything.
I think you can categorize the behavior of executing unassigned code into three categories.
What actually happens depends on the type of CPU and sometimes the version, so it's hard to say for sure.
For more information on what happens when unallocated code is executed, you can get a rough idea of how the CPU physically/electrically executes code in books like Computer System Theory and Implementation--Modern Computer Making .
(I didn't study hard, but I looked at the answers from my experience and knowledge.)
Take RX microcomputer as an example
If you intentionally reverse-assemble the "data" area in the JTAG debugger,
for a specific value of memory bytes
The reverse assembler indicates that it cannot be translated, that is, there is no corresponding instruction.In other words,
Not all bit patterns are assigned instructions.
To put it in a very rough way (I know it's not appropriate to express it)
- The RX microcomputer has 90 instructions.
- There are 69 instructions for H8/S microcomputers.
- SH2 Microcomputer has 62 instructions.
- One byte has 256 different values.
It is only natural that there are unassigned values.
In addition, RX generates an "undefined instruction exception" when it tries to execute an "undefined instruction".
Exceptions can be captured by the debugger, so you can quickly see that there is a bug.
Therefore, the specifications around here are different for each microcomputer.
Read and understand the specifications for your microcomputer if necessary.
Naturally, this is a CPU-dependent topic, but if an instruction is assigned to every bit string, then the CPU will not have the opportunity to extend the instruction.
For example, for Intel processors, the reality is that SSE; Streaming SIMD Extensions instructions continue to be added.There are also UD2
instructions.This is an operational code that is guaranteed to cause invalid operational code exceptions even if you extend the instructions in the future.
© 2024 OneMinuteCode. All rights reserved.