Вход на сайт

Просмотр новости

Найдите то, что Вас интересует

Windows on Itanium also provided for hot-patching, in an even simpler way

Дата публикации: 01-10-2026 14:00:57

Once again, the benefit of fixed-length instructions.
The post Windows on Itanium also provided for hot-patching, in an even simpler way appeared first on The Old New Thing.


Основное содержимое страницы с новостью.

Last time, we looked at Windows hot-patching on 64-bit ARM. But what about Itanium?

Oh, you remembered Itanium!

Itanium also had fixed-sized instructions, or more accurately, fixed-sized bundles, where each bundle encodes three instructions. Fixed-size bundles mean that, like AArch64, there is no hot-patching restriction on the first instruction of a function.

In fact, there was no spare space for hot-patching at all.

Because none was needed.

During hot-patching, the first bundle of the instruction could be overwritten with

        nop
        brl.cond.sptk target64

The second instruction brl is a “long branch” that accepts a 64-bit target.¹ This is a “double-wide” instruction that takes up two slots in the bundle, which is why we see a bundle of only two instructions.

Based on my experience with AArch64, I thought at first that the instruction sequence would be more like

    movl r8 = target64   /* double-wide 64-bit load instruction */
    br.cond.sptk r8

But then I realized that this doesn’t work because you cannot perform an indirect jump through a general-purpose register. You have to move it to a branch register first. and that would take us to four instructions (since the movl occupies two slots), which exceeds the capacity of a bundle.

Bonus chatter: If you study some old Itanium binaries like I did, you will find that many functions are preceded by an apparent spare bundle:

    break.m 0
    break.i 0
    break.i 0

This is a bundle full of breakpoint instructions, and you might be tricked (like me) into thinking that they are there for hot-patching. But then you find that some other functions don’t have this spare bundle, and after closer study, you realize that this spare bundle is not for hot patching. It’s padding to bring the start of every function to a 32-byte boundary.

¹ Formally, it’s a conditional long branch instruction predicated on p0, and statically predicted to be taken. The p0 register is hard-wired to true, so the assembler conveniently simplifies the disassembly and omits the p0.

Author

Raymond Chen

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

Схожие новости

#Наименование новостиТональностьИнформативностьДата публикации
1Windows on AArch64 also provides for hot-patching, but it’s much simpler than on x86012.7730-09-2026
2If somebody tries to hot-patch an already-hot-patched function, how do they avoid conflicts?012.9705-10-2026
3Why is there no Windows hot-patching support for other architectures like 32-bit ARM and MIPS?09.0602-10-2026
4No, really, you need to pass all unhandled messages to DefWindowProc, part 205.8424-09-2026
5Debugging walkthrough: Access violation on nonsense instruction, episode 307.8925-09-2026
6As a general rule, calling product support while drunk is not recommended04.5629-09-2026
7Why does the compiler sometimes use ud2 and sometimes int 3 for code that shouldn’t execute?07.706-10-2026
8How can undefined opcodes ud0 and ud1 have parameters? How undefined were they?08.607-10-2026
9C++ reminder: Function-local static variables are initialized only once, even if it looks like they get initialized multiple times05.9228-09-2026
10AMD Posts GCC Compiler Patches For AVX10V1AUX ISA Support011.8524-09-2026

Классификация: . Схожих патентов: 0. Схожих новостей: 10. Тональность: 0. Информативность: 10.2. Источник: blogs.msdn.microsoft.com.