Chinaunix

标题: gcc 段寄存器传值 core [打印本页]

作者: tom916    时间: 2016-05-30 10:06
标题: gcc 段寄存器传值 core
  1. #include <stdio.h>
  2. void main(){

  3.     int result1  = 0;
  4.     int result2  = 0;
  5.     int i = 1;
  6.     __asm__  __volatile__ ("mov %%gs:%P1 , %%eax" :"=a"(result1) :"n"(1));

  7.     //为啥运行到这里就 core
  8.     __asm__  __volatile__ ("mov %%gs:%P1,%0" :"=a"(result2) :"m"(i));

  9.     printf("Result: %x %x \n", result1,result2);
  10. }     
复制代码





欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2