By: Adrian (a.delete@this.acm.org), August 17, 2020 6:39 pm
Room: Moderated Discussions
Anon3 (anon3.delete@this.anon3.invalid) on August 17, 2020 5:34 pm wrote:
>
> The processor cannot know where the instruction boundaries are without decoding from
> the target of a branch and some x86 instructions are one byte thus it's a fundamental
> property of the ISA (without CFI) that you must be able to jump to any address.
>
On x86 not only it is permitted to jump into the middle of an instruction, but actually this was used very frequently in most commercial MS-DOS programs, for 2 reasons, some times it was used for code obfuscation, to desynchronize the less clever disassemblers, some times it was used because this reduced the code size, e.g. by using a 1-byte load instruction instead of a 2-byte jump (on 8088) or 3-byte jump (on 8080). The load was only 1 byte long because it loaded an immediate value which was then ignored, so this was equivalent to skipping over the next 2 bytes of code.
The first time I have seen this technique used in many Microsoft programs for CP/M on Intel 8080, e.g. in their BASIC interpreter. Later this style of programming was inherited by many of their MS-DOS programs.
>
> The processor cannot know where the instruction boundaries are without decoding from
> the target of a branch and some x86 instructions are one byte thus it's a fundamental
> property of the ISA (without CFI) that you must be able to jump to any address.
>
On x86 not only it is permitted to jump into the middle of an instruction, but actually this was used very frequently in most commercial MS-DOS programs, for 2 reasons, some times it was used for code obfuscation, to desynchronize the less clever disassemblers, some times it was used because this reduced the code size, e.g. by using a 1-byte load instruction instead of a 2-byte jump (on 8088) or 3-byte jump (on 8080). The load was only 1 byte long because it loaded an immediate value which was then ignored, so this was equivalent to skipping over the next 2 bytes of code.
The first time I have seen this technique used in many Microsoft programs for CP/M on Intel 8080, e.g. in their BASIC interpreter. Later this style of programming was inherited by many of their MS-DOS programs.
Topic | Posted By | Date |
---|---|---|
IBM introduces POWER10 | Crystal S. Diamond | 2020/08/16 10:20 PM |
"New ISA Prefix Fusion" | QAnon | 2020/08/16 11:21 PM |
"New ISA Prefix Fusion" | Anon3 | 2020/08/17 06:59 AM |
"New ISA Prefix Fusion" | Kevin G | 2020/08/17 10:51 AM |
"New ISA Prefix Fusion" | Maynard Handley | 2020/08/17 11:51 AM |
"New ISA Prefix Fusion" | Anon3 | 2020/08/17 04:10 PM |
"New ISA Prefix Fusion" | Maynard Handley | 2020/08/17 04:34 PM |
"New ISA Prefix Fusion" | Anon3 | 2020/08/17 05:34 PM |
"New ISA Prefix Fusion" | Adrian | 2020/08/17 06:39 PM |
"New ISA Prefix Fusion" | anon2 | 2020/08/17 09:24 PM |
"New ISA Prefix Fusion" | Doug S | 2020/08/17 09:58 PM |
"New ISA Prefix Fusion" | hobold | 2020/08/18 01:47 AM |
"New ISA Prefix Fusion" | Michael S | 2020/08/18 04:48 AM |
"New ISA Prefix Fusion" | hobold | 2020/08/18 11:58 AM |
"New ISA Prefix Fusion" | dmcq | 2020/08/18 01:00 PM |
"New ISA Prefix Fusion" | Michael S | 2020/08/18 01:48 PM |
"New ISA Prefix Fusion" | hobold | 2020/08/18 02:29 PM |
"New ISA Prefix Fusion" | Maynard Handley | 2020/08/18 03:46 PM |
"New ISA Prefix Fusion" | Maynard Handley | 2020/08/18 03:42 PM |
"New ISA Prefix Fusion" | anon2 | 2020/08/18 07:04 PM |
"New ISA Prefix Fusion" | Maynard Handley | 2020/08/18 09:17 PM |
"New ISA Prefix Fusion" | dmcq | 2020/08/19 04:08 AM |
"New ISA Prefix Fusion" | Maynard Handley | 2020/08/19 10:02 AM |
"New ISA Prefix Fusion" | dmcq | 2020/08/19 11:08 AM |
"New ISA Prefix Fusion" | Maynard Handley | 2020/08/19 12:05 PM |
"New ISA Prefix Fusion" | dmcq | 2020/08/19 02:14 PM |
"New ISA Prefix Fusion" | Maynard Handley | 2020/08/19 02:44 PM |
IBM introduces POWER10 | Thu | 2020/08/16 11:56 PM |
IBM introduces POWER10 | Michael S | 2020/08/17 02:12 AM |
IBM introduces POWER10 | Thu | 2020/08/17 03:27 AM |
IBM introduces POWER10 | TransientStudent | 2020/08/17 04:23 AM |
IBM introduces POWER10 | Rayla | 2020/08/17 04:29 AM |
IBM introduces POWER10 | Maynard Handley | 2020/08/17 10:44 AM |
IBM introduces POWER10 | Kevin G | 2020/08/17 10:57 AM |
IBM introduces POWER10 | Rayla | 2020/08/17 04:26 AM |
IBM introduces POWER10 | Thu | 2020/08/17 05:00 PM |
Matrix Math Accelerator | Adrian | 2020/08/17 01:01 AM |
Matrix Math Accelerator | Michael S | 2020/08/17 02:32 AM |
Matrix Math Accelerator | Adrian | 2020/08/17 02:46 AM |
Matrix Math Accelerator | j | 2020/08/18 02:32 AM |