码迷,mamicode.com
首页 > 其他好文 > 详细

asm 32/64区别

时间:2016-01-06 17:53:49      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:

1、系统调用及C函数调用,参数传递方式不同

  • User-level applications use as integer registers for passing the sequence %rdi, %rsi, %rdx, %rcx, %r8 and %r9. The kernel interface uses %rdi, %rsi, %rdx, %r10, %r8 and %r9.
  • A system-call is done via the syscall instruction. The kernel destroys registers %rcx and %r11.
  • The number of the syscall has to be passed in register %rax.
  • System-calls are limited to six arguments, no argument is passed directly on the stack.
  • Returning from the syscall, register %rax contains the result of the system-call. A value in the range between -4095 and -1 indicates an error, it is -errno.
  • Only values of class INTEGER or class MEMORY are passed to the kernel.

2、调用指令不同

  • For a 32bit kernel, SYSENTER/SYSEXIT are the only compatible pair [between AMD and Intel CPUs]
  • For a 64bit kernel in Long mode only… SYSCALL/SYSRET are the only compatible pair [between AMD and Intel CPUs]

3、syscall的call number不同

  • 32bit 定义在unistd_32.h
  • 64bit 定义在unistd_64.h

asm 32/64区别

标签:

原文地址:http://www.cnblogs.com/vtudiv/p/5106269.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!