Skip to main content
9 events
when toggle format what by license comment
Mar 9 at 20:14 history edited Jean-François Fabre CC BY-SA 4.0
fixed spelling
Dec 11, 2022 at 22:57 comment added Jerry Coffin @PeterCordes: Yeah, you'd want interrupts disabled. As far as the details go...yup, lots of variation possible.
Dec 11, 2022 at 22:01 comment added Peter Cordes I guess you'd do this with interrupts disabled, otherwise that could flush the prefetch queue earlier than expected on 8086. (Also, not that it matters, but instead of modifying a jmp rel8, it could be an add al, 0 or 2. In real code you'd probably be branching on the result instead of returning an integer so this is a good example.)
S Dec 6, 2022 at 5:53 history suggested CommunityBot CC BY-SA 4.0
fix typo: 8086 -> 8088
Dec 6, 2022 at 3:19 review Suggested edits
S Dec 6, 2022 at 5:53
Dec 4, 2022 at 11:19 comment added ecm @occipita That should be jmp short $ + 2, not plus 1. The answer is also wrong because its example is missing the branch_offset label after the jump instruction, plus it depends on the jmp being near where an optimising assembler may easily turn it into a short jump.
Dec 4, 2022 at 0:07 comment added Raffzahn Yes, that twist needs to be remembered as well. after all, self modifying code always had to take care of cache, prefetch and pipeline - on all CPU and alwasys.
Dec 3, 2022 at 23:30 comment added occipita Right. Self modfiying code often used techniques that flushed the prefetch queue (e.g. running JMP $+1, which IIRC worked at least up to the 80286, as it was included in the standard code to switch to protected mode) to ensure they ran the updated code.
Dec 3, 2022 at 20:44 history answered Jerry Coffin CC BY-SA 4.0