Re:Branch Privilege Injection: Exploiting branch predictor r...
by umanwizard on Tuesday May 13, 2025 @05:49PM
(#43978151)
A modern processor pipeline is dozens of cycles deep. Without branch prediction, we would need to know the next instruction at all times before beginning to fetch it. So we couldn’t begin fetching anything until the current instruction is decoded and we know it’s not a branch or jump. Even more seriously, if it is a branch, we would need to stall the pipeline and not do anything until the instruction finishes executing and we know whether it’s taken or not (possibly dozens of cycles later, or hundreds if it depends on a memory access). Stalling for so many cycles on every branch is totally incompatible with any kind of modern performance. If you want a processor that works this way, buy a microcontroller.
[ Parent
| on HN ]
Re:Branch Privilege Injection: Exploiting branch predictor r...
by superblas on Tuesday May 13, 2025 @08:07PM
(#43979287)
> If you want a processor that works this way, buy a microcontroller.
The ARM Cortex-R5F and Cortex-M7, to name a few, have branch predictors as well, for what it’s worth ;)
Re:Branch Privilege Injection: Exploiting branch predictor r...
by jeffbee on Tuesday May 13, 2025 @09:51PM
(#43979882)
You can still have a static branch predictor. That has surprisingly good coverage. I'm not saying this is a great idea, just pointing it out.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by tremon on Wednesday May 14, 2025 @10:20AM
(#43984889)
But branch prediction doesn't necessarily need complicated logic. If I remember correctly (it's been 20 years since I read any papers on it), the simple heuristic "all relative branches backwards are taken, but forward and absolute branches are not" could achieve 70-80% performance of the state-of-the-art implementations back then.