![]() ![]() Static inline long _do_sys_write ( unsigned int fd, const char _user * buf, size_t count ) Jne swapgs_restore_regs_and_return_to_usermodeĭo_syscall_64 and do_syscall_圆4 are defined in arch/x86/entry/common.c : * In the Xen PV case we must use iret anyway.ĪLTERNATIVE "", "jmp swapgs_restore_regs_and_return_to_usermode", \Ĭmpq % rcx, % r11 / * SYSRET requires RCX = RIP * / * a completely clean 64 -bit userspace context. Movslq % eax, % rsi / * clobbers % rax, make sure it is after saving the syscall nr * /Ĭall do_syscall_64 / * returns with IRQs disabled * / / * * Try to use SYSRET instead of IRET if we're returning to Movq % rsp, % rdi / * Sign extend the lower 32bit as syscall numbers are treated as int * / SYM_INNER_LABEL(entry_SYSCALL_64_after_hwframe, SYM_L_ GLOBAL) Pushq PER_ CPU_VAR(cpu_tss_rw + TSS_sp2) /* pt_regs->sp */ SYM_INNER_LABEL(entry_SYSCALL_64_safe_stack, SYM_L_ GLOBAL) / * Construct struct pt_regs on stack * / Movq PER_ CPU_VAR(cpu_current_top_of_stack), %rsp Movq % rsp, PER_ CPU_VAR(cpu_tss_rw + TSS_sp2) * with them due to bugs in both AMD and Intel CPUs. * it deals with uncanonical addresses better. * * When user can change pt_regs - >foo always force IRET. * (note: r12 - r15, rbp, rbx are callee -preserved in C ABI) * r10 arg3 (needs to be moved to rcx to conform to C ABI) * r11 saved rflags (note: r11 is callee -clobbered register in C ABI) SYSCALL does not save anything on the stack * rflags gets masked by a value from another MSR (so CLD and CLAC * then loads new ss, cs, and rip from previously programmed MSRs. ![]() * * 64 -bit SYSCALL saves rip to rcx, clears rflags.RF, then saves rflags to r11, * of SYSCALL instructions in the vDSO used, for example, as a ![]() * well as some other programs and libraries. * * SYSCALL instructions can be found inlined in libc implementations as * argument mapping Linux uses fits well with the registers that are * hardware interface is reasonably well designed and the register to * * This is the only entry point used for 64 -bit system calls. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |