⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pushpopmem.c

📁 The Valgrind distribution has multiple tools. The most popular is the memory checking tool (called M
💻 C
字号:
#include <assert.h>#include <stdio.h>#include <stdlib.h>unsigned int do32 ( unsigned int x ){  unsigned int* y = malloc(sizeof(unsigned int));  unsigned int* z = malloc(sizeof(unsigned int));  unsigned int t;  assert(y);  assert(z);  y[0] = x;  __asm__ __volatile__(     "pushl %0\n\t"     "pushl %1\n\t"     "popl %%ebx\n\t"     "popl %%eax\n\t"     "pushl 0(%%eax)\n\t"     "popl 0(%%ebx)"     : /*OUT*/     : /*IN*/ "r"(y), "r"(z)     : /*TRASH*/ "memory", "eax", "ebx"  );  t = z[0];  free(y);  free(z);  return t;}unsigned short do16 ( unsigned short x ){  unsigned short* y = malloc(sizeof(unsigned short));  unsigned short* z = malloc(sizeof(unsigned short));  unsigned short t;  assert(y);  assert(z);  y[0] = x;  __asm__ __volatile__(     "pushl %0\n\t"     "pushl %1\n\t"     "popl %%ebx\n\t"     "popl %%eax\n\t"     "pushw 0(%%eax)\n\t"     "popw 0(%%ebx)"     : /*OUT*/     : /*IN*/ "r"(y), "r"(z)     : /*TRASH*/ "memory", "eax", "ebx"  );  t = z[0];  free(y);  free(z);  return t;}int main ( void ){   printf("do32: 0x%08X\n", do32(0xCafeBabe) );   printf("do16: 0x%08X\n", (unsigned int)do16(0xfeBa) );   return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -