[libc-commits] [libc] [libc] Add ucontext types and headers (PR #191789)
Pavel Labath via libc-commits
libc-commits at lists.llvm.org
Tue Apr 14 03:54:40 PDT 2026
================
@@ -0,0 +1,121 @@
+//===-- Definition of type mcontext_t -------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Note: Definitions in this file are based on the Linux kernel ABI.
+
+#ifndef LLVM_LIBC_TYPES_MCONTEXT_T_H
+#define LLVM_LIBC_TYPES_MCONTEXT_T_H
+
+// The following definitions correspond to the general purpose registers.
+// The layout of gregset_t and the enum indices must match the layout of
+// 'struct sigcontext' in the Linux kernel on x86_64 (see
+// arch/x86/include/uapi/asm/sigcontext.h). The kernel uses named fields
+// (like r8, r9) while we use an array indexed by these enum values.
+//
+// Note: The kernel defines segment registers (cs, gs, fs, ss) as four
+// separate 16-bit fields. In our flat 64-bit array representation, they
+// are packed into a single 64-bit slot at index __LIBC_REG_CSGSFS, occupying
----------------
labath wrote:
```suggestion
// are packed into a single 64-bit slot at index REG_CSGSFS, occupying
```
https://github.com/llvm/llvm-project/pull/191789
More information about the libc-commits
mailing list