arch/s390/include/asm/ctlreg.h
Source file repositories/reference/linux-study-clean/arch/s390/include/asm/ctlreg.h
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/include/asm/ctlreg.h- Extension
.h- Size
- 8004 bytes
- Lines
- 257
- Domain
- Architecture Layer
- Bucket
- arch/s390
- 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/bits.hlinux/bug.h
Detected Declarations
struct ctlregstruct addrtypestruct addrtypestruct lowcorefunction local_ctl_loadfunction local_ctl_storefunction local_ctl_set_bitfunction local_ctl_clear_bitfunction system_ctl_set_bitfunction system_ctl_clear_bitfunction system_ctl_load
Annotated Snippet
struct ctlreg {
unsigned long val;
};
#define __local_ctl_load(low, high, array) do { \
struct addrtype { \
char _[sizeof(array)]; \
}; \
int _high = high; \
int _low = low; \
int _esize; \
\
_esize = (_high - _low + 1) * sizeof(struct ctlreg); \
BUILD_BUG_ON(sizeof(struct addrtype) != _esize); \
typecheck(struct ctlreg, array[0]); \
asm volatile( \
" lctlg %[_low],%[_high],%[_arr]" \
: \
: [_arr] "Q" (*(struct addrtype *)(&array)), \
[_low] "i" (low), [_high] "i" (high) \
: "memory"); \
} while (0)
#define __local_ctl_store(low, high, array) do { \
struct addrtype { \
char _[sizeof(array)]; \
}; \
int _high = high; \
int _low = low; \
int _esize; \
\
_esize = (_high - _low + 1) * sizeof(struct ctlreg); \
BUILD_BUG_ON(sizeof(struct addrtype) != _esize); \
typecheck(struct ctlreg, array[0]); \
asm volatile( \
" stctg %[_low],%[_high],%[_arr]" \
: [_arr] "=Q" (*(struct addrtype *)(&array)) \
: [_low] "i" (low), [_high] "i" (high)); \
} while (0)
static __always_inline void local_ctl_load(unsigned int cr, struct ctlreg *reg)
{
asm volatile(
" lctlg %[cr],%[cr],%[reg]"
:
: [reg] "Q" (*reg), [cr] "i" (cr)
: "memory");
}
static __always_inline void local_ctl_store(unsigned int cr, struct ctlreg *reg)
{
asm volatile(
" stctg %[cr],%[cr],%[reg]"
: [reg] "=Q" (*reg)
: [cr] "i" (cr));
}
static __always_inline struct ctlreg local_ctl_set_bit(unsigned int cr, unsigned int bit)
{
struct ctlreg new, old;
local_ctl_store(cr, &old);
new = old;
new.val |= 1UL << bit;
local_ctl_load(cr, &new);
return old;
}
static __always_inline struct ctlreg local_ctl_clear_bit(unsigned int cr, unsigned int bit)
{
struct ctlreg new, old;
local_ctl_store(cr, &old);
new = old;
new.val &= ~(1UL << bit);
local_ctl_load(cr, &new);
return old;
}
struct lowcore;
void system_ctlreg_lock(void);
void system_ctlreg_unlock(void);
void system_ctlreg_init_save_area(struct lowcore *lc);
void system_ctlreg_modify(unsigned int cr, unsigned long data, int request);
enum {
CTLREG_SET_BIT,
CTLREG_CLEAR_BIT,
CTLREG_LOAD,
Annotation
- Immediate include surface: `linux/bits.h`, `linux/bug.h`.
- Detected declarations: `struct ctlreg`, `struct addrtype`, `struct addrtype`, `struct lowcore`, `function local_ctl_load`, `function local_ctl_store`, `function local_ctl_set_bit`, `function local_ctl_clear_bit`, `function system_ctl_set_bit`, `function system_ctl_clear_bit`.
- Atlas domain: Architecture Layer / arch/s390.
- 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.