検索条件
全1件
(1/1ページ)
NAME copy_to_user - Copy a block of data into user space. SYNOPSIS unsigned long copy_to_user(void __user * to, const void * from, unsigned long n); ARGUMENTS to Destination address, in user space. from Source address, in kernel space. n Number of bytes to copy. CONTEXT User context only. This function may sleep. DESCRIPTION Copy data from kernel space to user space. Returns number of bytes that could not be copied. On success, this will be zero.
.macro str1w ptr reg abort strusr \reg, \ptr, 4, abort=\abort .endmFILE: archinc/asm/assembler.h
.macro strusr, reg, ptr, inc, cond=al, rept=1, abort=9001f usracc str, \reg, \ptr, \inc, \cond, \rept, \abort .endm .macro usracc, instr, reg, ptr, inc, cond, rept, abort, t=TUSER() .rept \rept 9999: .if \inc == 1 \instr\cond\()b\()\t \reg, [\ptr], #\inc .elseif \inc == 4 \instr\cond\()\t \reg, [\ptr], #\inc .else .error "Unsupported inc macro argument" .endif .pushsection __ex_table,"a" .align 3 .long 9999b, \abort .popsection .endr .endm usracc str, \reg, \ptr, \inc(=4), \cond(=none,al), \rept(=none,1), \abort(=pop) stral reg, [ptr], #inc .pushsection __ex_table,"a" .align 3 .long 9999b, \abort
. = ALIGN(4); __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { __start___ex_table = .; #ifdef CONFIG_MMU *(__ex_table) #endif __stop___ex_table = .;
/* Given an address, look for it in the exception tables. */ const struct exception_table_entry *search_exception_tables(unsigned long addr)さらにこれを使っているところを探すと、アーキ依存部のpage fault処理部分が見つかる。
int fixup_exception(struct pt_regs *regs) { const struct exception_table_entry *fixup; fixup = search_exception_tables(instruction_pointer(regs)); if (fixup) { regs->ARM_pc = fixup->fixup; #ifdef CONFIG_THUMB2_KERNEL /* Clear the IT state to avoid nasty surprises in the fixup */ regs->ARM_cpsr &= ~PSR_IT_MASK; #endif } return fixup != NULL; }さらにさらに、これを使っているところを探すと、
/* * Oops. The kernel tried to access some page that wasn't present. */ static void __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, struct pt_regs *regs) { /* * Are we prepared to handle this kernel fault? */ if (fixup_exception(regs)) return;ここに来れば faultが発生しても、Oopsを吐かずに指定されたアドレスへ
static int __kprobes do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)