2016年6月13日

C语言中结构体定义实际上相当于变量入栈

摘要: struct context { int edi; int esi; int ebx; int ebp; int eip;}; 对应的入栈顺序是 pushl %esp pushl %eip pushl %ebp pushl %ebx pushl %esi pushl %edi 阅读全文

posted @ 2016-06-13 16:13 Joker_88 阅读(611) 评论(0) 推荐(0)

2016年6月12日

c语言结构体指针必须初始化

摘要: 先说结论 struct test{ int i; struct buf *p;} t; //定义结构体t struct buf{ char data[512]; struct buf *prev; struct buf *next;} ; t定义后里面的成员变量在GCC下已经初始化为0了,但p并没有 阅读全文

posted @ 2016-06-12 16:08 Joker_88 阅读(10638) 评论(0) 推荐(1)

2016年6月10日

xv6的设计trick(不断更新)

摘要: 1、每个进程通过时钟中断出发trap.c中的 if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER) yield();来强制把这个进程置为Runnable状态,yield的实现如下: acquire(&ptable.l 阅读全文

posted @ 2016-06-10 16:35 Joker_88 阅读(382) 评论(0) 推荐(0)

GDB调试程序常用命令

摘要: 1、在xv6 内核中 通过 nm kernel | grep _start 找到kernel的起始地址是0010000c 2、 br * 0x0010000c 设置断点,(如果在函数start处设断点就是 br start) 3、c 继续执行到这个断点 4、查看寄存器,找到通过esp找到程序在内存中 阅读全文

posted @ 2016-06-10 15:50 Joker_88 阅读(1505) 评论(0) 推荐(0)

2016年6月6日

Java的引用c++的引用和C指针的区别

摘要: Java的引用本质上就是C中的指针,而c++的引用则完全不同;有一个类 class Point { int x; int y;} 同样的一个Point p; 在Java中p表示一个引用,它等同于C语言中 struct Point *p中的p,和C++中的Point *p 的p相似。为什么说相似呢?这 阅读全文

posted @ 2016-06-06 17:04 Joker_88 阅读(877) 评论(0) 推荐(0)

2016年5月17日

转分析栈堆得好文

摘要: http://www.cnblogs.com/youxin/p/3313288.html 阅读全文

posted @ 2016-05-17 17:30 Joker_88 阅读(125) 评论(0) 推荐(0)

2016年5月12日

转一篇分析C语言调用时栈的变化的好文

摘要: http://blog.csdn.net/zsy2020314/article/details/9429707 阅读全文

posted @ 2016-05-12 15:17 Joker_88 阅读(123) 评论(0) 推荐(0)

2016年5月4日

C语言根据函数名调用对应的函数

摘要: 通过函数指针定义,调用时加上参数 struct Command { const char *name; const char *desc; // return -1 to force monitor to exit int (*func)(int argc, char** argv, struct 阅读全文

posted @ 2016-05-04 16:52 Joker_88 阅读(1540) 评论(0) 推荐(0)

2016年4月17日

转一篇栈分析的好文

摘要: https://segmentfault.com/a/1190000002431457 阅读全文

posted @ 2016-04-17 20:29 Joker_88 阅读(98) 评论(0) 推荐(0)

2016年4月15日

VIM继承C语言(转)

摘要: 在下面的基础上加上了astyle sh.c --style=kr --indent=spaces --indent-cases --pad-header --pad-oper --unpad-paren --keep-one-line-statements --keep-one-line-block 阅读全文

posted @ 2016-04-15 17:07 Joker_88 阅读(126) 评论(0) 推荐(0)

导航