arch/powerpc/include/asm/kup.h
Source file repositories/reference/linux-study-clean/arch/powerpc/include/asm/kup.h
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/include/asm/kup.h- Extension
.h- Size
- 3022 bytes
- Lines
- 137
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hasm/book3s/64/kup.hasm/nohash/32/kup-8xx.hasm/nohash/kup-booke.hasm/book3s/32/kup.hlinux/pgtable.h
Detected Declarations
function kuap_is_disabledfunction setup_kuapfunction __bad_kuap_faultfunction kuap_user_restorefunction restore_user_accessfunction kuap_lockfunction kuap_save_and_lockfunction kuap_kernel_restorefunction kuap_get_and_assert_lockedfunction kuap_assert_locked
Annotated Snippet
static inline void setup_kuap(bool disabled) { }
static __always_inline bool kuap_is_disabled(void) { return true; }
static __always_inline bool
__bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
{
return false;
}
static __always_inline void kuap_user_restore(struct pt_regs *regs) { }
static __always_inline void __kuap_kernel_restore(struct pt_regs *regs, unsigned long amr) { }
/*
* book3s/64/kup-radix.h defines these functions for the !KUAP case to flush
* the L1D cache after user accesses. Only include the empty stubs for other
* platforms.
*/
#ifndef CONFIG_PPC_BOOK3S_64
static __always_inline void allow_user_access(void __user *to, unsigned long dir) { }
static __always_inline void prevent_user_access(unsigned long dir) { }
static __always_inline unsigned long prevent_user_access_return(void) { return 0UL; }
static __always_inline void restore_user_access(unsigned long flags) { }
#endif /* CONFIG_PPC_BOOK3S_64 */
#endif /* CONFIG_PPC_KUAP */
static __always_inline bool
bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
{
if (kuap_is_disabled())
return false;
return __bad_kuap_fault(regs, address, is_write);
}
static __always_inline void kuap_lock(void)
{
#ifdef __kuap_lock
if (kuap_is_disabled())
return;
__kuap_lock();
#endif
}
static __always_inline void kuap_save_and_lock(struct pt_regs *regs)
{
#ifdef __kuap_save_and_lock
if (kuap_is_disabled())
return;
__kuap_save_and_lock(regs);
#endif
}
static __always_inline void kuap_kernel_restore(struct pt_regs *regs, unsigned long amr)
{
if (kuap_is_disabled())
return;
__kuap_kernel_restore(regs, amr);
}
static __always_inline unsigned long kuap_get_and_assert_locked(void)
{
#ifdef __kuap_get_and_assert_locked
if (!kuap_is_disabled())
return __kuap_get_and_assert_locked();
#endif
return 0;
}
static __always_inline void kuap_assert_locked(void)
{
if (IS_ENABLED(CONFIG_PPC_KUAP_DEBUG))
kuap_get_and_assert_locked();
}
#endif /* !__ASSEMBLER__ */
#endif /* _ASM_POWERPC_KUAP_H_ */
Annotation
- Immediate include surface: `linux/types.h`, `asm/book3s/64/kup.h`, `asm/nohash/32/kup-8xx.h`, `asm/nohash/kup-booke.h`, `asm/book3s/32/kup.h`, `linux/pgtable.h`.
- Detected declarations: `function kuap_is_disabled`, `function setup_kuap`, `function __bad_kuap_fault`, `function kuap_user_restore`, `function restore_user_access`, `function kuap_lock`, `function kuap_save_and_lock`, `function kuap_kernel_restore`, `function kuap_get_and_assert_locked`, `function kuap_assert_locked`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.