本学期我们主要学习了: 1.数据的表示和存储 2.运算电路基础 3.乘除运算及浮点数运算 4.IA32指令系统概述 5.IA32指令类型 6.C语言的语句的机器级表示
那么我们来回忆并总结一下本学期的主要内容,主要以代码运行的方式进行:
一、汇编代码的生成以及初步互译
/* Demonstration of buffer overflow */ #include <stdio.h> #include <stdlib.h> /* Implementation of library function gets() */ char *gets(char *dest) { int c = getchar(); char *p = dest; while (c != EOF && c != '\n') { *p++ = c; c = getchar(); } *p = '\0'; return dest; } /* Read input line and write it back */ void echo() { char buf[4]; /* Way too small! */ gets(buf); puts(buf); } void call_echo() { echo(); } /*void smash() { printf("I've been smashed!\n"); exit(0); } */ int main() { printf("Type a string:"); call_echo(); return 0; }将其进行汇编:
Disassembly of section .init: 08048354 <_init>: 8048354: 53 push