LIBUNWIND-IA64(3libunwind)
๐ libunwind-ia64 โ IA-64-specific support in libunwind ๐
okay bestie, welcome to the 3libunwind manual, the IA-64 edition โจ this whole page lives in the Programming Library section, and it's all about the Itanium-flavored corner of libunwind. let's get into it ๐ฆ
๐ธ NAME ๐ธ
libunwind-ia64 โ IA-64-specific support in libunwind
โจ INTRODUCTION โจ
so the IA-64 version of libunwind? it rolls with a platform-string of ia64 and โ at least in theory ๐ โ should be able to support all operating systems that adhere to the processor-specific ABI defined for the Itanium Processor Family. that includes both little-endian Linux and big-endian HP-UX, iconic range honestly ๐
and to make it possible for a single library to unwind both 32- and 64-bit targets, the type unw_word_t is always defined to be 64 bits wide โ independent of the natural word-size of the host. slay ๐
but having said all thatโฆ the current implementation has been tested only with IA-64 Linux. no cap. so keep that in mind fr fr ๐ญ
when you're targeting IA-64, the libunwind header file defines the macro UNW_TARGET_IA64 as 1 and the macro UNW_TARGET as "ia64" (without the quotation marks, bestie, those are just for show here). the first one lets platform-dependent unwind code use conditional-compilation to pick the appropriate implementation. the second one is useful for stringification purposes and for constructing target-platform-specific symbols. very demure, very mindful ๐
one special feature of IA-64 is the use of NaT bits to support speculative execution. usually people think of NaT bits as the "65-th bit" of a general register. but to make everything fit into 64-bit wide unw_word_t values, libunwind treats the NaT-bits like separate boolean registers, whose 64-bit value is either TRUE (non-zero) or FALSE (zero). tiny but mighty ๐
๐ MACHINE-STATE ๐
the machine-state (aka the set of registers) that you can reach through libunwind depends on the type of stack frame that a cursor points to. so:
- for normal frames, all "preserved" (callee-saved) registers are accessible.
- for signal-trampoline frames, all registers are accessible โ including "scratch" (caller-saved) registers ๐ฅ
most applications do not have to worry a-priori about which registers are accessible when. and if you're ever in doubt, it is always safe to just try to access a register (via unw_get_reg() or unw_get_fpreg()) โ and if the register isn't accessible, the call will fail with a return-value of -UNW_EBADREG. no harm, no foul ๐
as a special exception to the above general rule, the scratch registers r15-r18 are always accessible, even in normal frames. this makes it possible to pass arguments, e.g., to exception handlers. periodt โจ
for a detailed description of the IA-64 register usage convention, please see the "Itanium Software Conventions and Runtime Architecture Guide", available at:
http://www.intel.com/design/itanium/downloads/245358.htm
๐ฆ REGISTER NAMES ๐ฆ
the IA-64-version of libunwind defines three kinds of register name macros: frame-register macros, normal register macros, and convenience macros. below, we describe each kind in turn ๐ซ
๐ FRAME-REGISTER MACROS ๐
frame-registers are special (pseudo) registers because they always have a valid value โ even though sometimes they don't get saved explicitly. like, if a memory stack frame is 16 bytes in size, the previous stack-pointer value can be calculated simply as sp+16, so there's no need to save the stack-pointer explicitly. efficiency queen ๐
moreover, the set of frame register values uniquely identifies a stack frame. the IA-64 architecture defines two stacks (a memory and a register stack). including the instruction-pointer (IP), this means there are three frame registers:
UNW_IA64_IPโ Contains the instruction pointer (IP, or "program counter") of the current stack frame. given this value, the remaining machine-state corresponds to the register-values that were present in the CPU when it was just about to execute the instruction pointed to byUNW_IA64_IP. bits 0 and 1 of this frame-register encode the slot number of the instruction. Note: due to the way the call instruction works on IA-64, the slot number is usually zero, but can be non-zero, e.g., in the stack-frame of a signal-handler trampoline ๐UNW_IA64_SPโ Contains the (memory) stack-pointer value (SP).UNW_IA64_BSPโ Contains the register backing-store pointer (BSP). Note: the value in this register is equal to the contents of registerar.bspat the time the instruction atUNW_IA64_IPwas about to begin execution.
๐ NORMAL REGISTER MACROS ๐
the following normal register name macros are available:
UNW_IA64_GRโ The base-index for general (integer) registers. add an index in the range from0..127to get a particular general register. for example, to accessr4, the indexUNW_IA64_GR+4should be used. registersr0andr1(gp) are read-only, and any attempt to write them will result in an error (-UNW_EREADONLYREG). even thoughr1is read-only, libunwind will automatically adjust its value if the instruction-pointer (UNW_IA64_IP) is modified. for example, ifUNW_IA64_IPis set to a value inside a functionfunc(), then readingUNW_IA64_GR+1will return the global-pointer value for this function. she's autonomous ๐UNW_IA64_NATโ The base-index for the NaT bits of the general (integer) registers. a non-zero value in these registers corresponds to a set NaT-bit. add an index in the range from0..127to get a particular NaT-bit register. for example, to access the NaT bit ofr4, the indexUNW_IA64_NAT+4should be used.UNW_IA64_FRโ The base-index for floating-point registers. add an index in the range from0..127to get a particular floating-point register. for example, to accessf2, the indexUNW_IA64_FR+2should be used. registersf0andf1are read-only, and any attempt to write to indicesUNW_IA64_FR+0orUNW_IA64_FR+1will result in an error (-UNW_EREADONLYREG).UNW_IA64_ARโ The base-index for application registers. add an index in the range from0..127to get a particular application register. for example, to accessar40, the indexUNW_IA64_AR+40should be used. the IA-64 architecture defines several application registers as "reserved for future use". attempting to access such registers results in an error (-UNW_EBADREG). not me getting rejected by reserved registers ๐ญUNW_IA64_BRโ The base-index for branch registers. add an index in the range from0..7to get a particular branch register. for example, to accessb6, the indexUNW_IA64_BR+6should be used.UNW_IA64_PRโ Contains the set of predicate registers. this 64-bit wide register contains registersp0throughp63in the "broad-side" format. just like with the "move predicates" instruction, the registers are mapped as ifCFM.rrb.prwere set to0. thus, in general the value of predicate registerpNwithN>=16can be found in bit16 + ((N-16)+CFM.rrb.pr) % 48. math girlie behavior ๐งฎโจUNW_IA64_CFMโ Contains the current-frame-mask register.
๐ CONVENIENCE MACROS ๐
convenience macros are simply aliases for certain frequently used registers:
UNW_IA64_GPโ Alias forUNW_IA64_GR+1, the global-pointer register.UNW_IA64_TPโ Alias forUNW_IA64_GR+13, the thread-pointer register.UNW_IA64_AR_RSCโ Alias forUNW_IA64_GR+16, the register-stack configuration register.UNW_IA64_AR_BSPโ Alias forUNW_IA64_GR+17. this register index accesses the value of registerar.bspas of the time it was last saved explicitly. this is rarely what you want. normally, you'll want to useUNW_IA64_BSPinstead. lowkey a trap, bestie ๐ชคUNW_IA64_AR_BSPSTOREโ Alias forUNW_IA64_GR+18, the register-backing store write pointer.UNW_IA64_AR_RNATโ Alias forUNW_IA64_GR+19, the register-backing store NaT-collection register.UNW_IA64_AR_CCVโ Alias forUNW_IA64_GR+32, the compare-and-swap value register.UNW_IA64_AR_CSDโ Alias forUNW_IA64_GR+25, the compare-and-swap-data register (used by 16-byte atomic operations).UNW_IA64_AR_UNATโ Alias forUNW_IA64_GR+36, the user NaT-collection register.UNW_IA64_AR_FPSRโ Alias forUNW_IA64_GR+40, the floating-point status (and control) register.UNW_IA64_AR_PFSโ Alias forUNW_IA64_GR+64, the previous frame-state register.UNW_IA64_AR_LCโ Alias forUNW_IA64_GR+65the loop-count register.UNW_IA64_AR_ECโ Alias forUNW_IA64_GR+66, the epilogue-count register.
๐ซถ THE UNWIND-CONTEXT TYPE ๐ซถ
on IA-64, unw_context_t is simply an alias for ucontext_t (as defined by the Single UNIX Spec). this implies that it's possible to initialize a value of this type not just with unw_getcontext(), but also with getcontext(), for example. very convenient, very iconic โจ
however โ since this is an IA-64-specific extension to libunwind, portable code should not rely on this equivalence. write once, cry once, iykyk ๐
๐ SEE ALSO ๐
๐ AUTHOR ๐
David Mosberger-Tang Email: dmosberger@gmail.com WWW: http://www.nongnu.org/libunwind/
and that's the whole page bestie!! this came straight out of the Programming Library manual, dated 29 August 2023 โ so if you're out here unwinding on Itanium, you're in the best hands ๐ซถ๐ stay slay, stay 64-bit wide ๐ฆโจ
๐ฆ where this page comes from
- alpine 3.24: libunwind-doc 1.8.3-r0 ยท MIT
- arch rolling: libunwind 1.8.3-1 ยท MIT
- epel 10: libunwind-devel 1.8.0-4.el10_0 ยท MIT
- epel 9: libunwind-devel 1.8.0-4.el9 ยท MIT
- fedora 43: libunwind-devel 1.8.3-4.fc43 ยท MIT
- fedora 43: libunwind-devel 1.8.3-4.fc43 ยท MIT
- fedora 44: libunwind-devel 1.8.3-1.fc44 ยท MIT
- fedora 44: libunwind-devel 1.8.3-1.fc44 ยท MIT
- fedora 44: libunwind-devel 1.8.3-4.fc44 ยท MIT
- fedora 44: libunwind-devel 1.8.3-4.fc44 ยท MIT
- nixpkgs unstable: libunwind 1.8.3-devman
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms