函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:arch\x86\include\asm\ptrace.h Create Date:2022-07-27 06:38:36
首页 Copyright©Brick

269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
/**
 * regs_get_kernel_stack_nth() - get Nth entry of the stack
 * @regs:   pt_regs which contains kernel stack pointer.
 * @n:      stack entry number.
 *
 * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which
 * is specified by @regs. If the @n th entry is NOT in the kernel stack
 * this returns 0.
 */
static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
                              unsigned int n)
{
    unsigned long *addr;
    unsigned long val;
    long ret;
 
    addr = regs_get_kernel_stack_nth_addr(regs, n);
    if (addr) {
        ret = probe_kernel_read(&val, addr, sizeof(val));
        if (!ret)
            return val;
    }
    return 0;
}