上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 16 下一页
摘要: 1 首先是Windows的inline asm形式:void function_name{ .... __asm{ MASM inline syntax; } ....}使用Windows的编译器,cl.exe来编译。默认使用的MASM汇编语法,使用ml.exe进行编译。具体语法查看MSDN。2 如果使用Dev-C++编译器进行编译,查看安装目录,里面全是gcc.exe, as.exe默认使用gnu的标准,即inline asm的形式为:void c_func();int main(int argc, char* argv[]){ printf("%d : %s\n",.. 阅读全文
posted @ 2011-12-05 11:46 Jack204 阅读(695) 评论(0) 推荐(0) 编辑
摘要: 因为在Windows下使用VS编写程序再编译的方式,对我在linux整天游荡的人来说实在是感觉被IDE束缚着很不爽。我喜欢用emacs写完了然后用一个命令编译完了就ok了。下面是在Windows下的C与Asm互相调用如何编写,编译,链接成功的?前提是确定下面使用的命令路径能够找得到。先贴c代码:A.c#include <stdio.h>#include <stdlib.h>int asm_func(int);int c_var;int main(int argc, char* argv[]){ int r; c_var = 0; r = asm_func(c_var); 阅读全文
posted @ 2011-12-03 14:25 Jack204 阅读(1930) 评论(0) 推荐(0) 编辑
摘要: 查看反汇编主要的思路在于将 流程,处理,算法 区分开来。1 函数调用:原C代码:int sum(int, int);int main(){ int c = sum(1, 2); printf("c=%d", c); return 0;}int sum(int a, int b){ int c = a + b; return c;}反汇编的函数调用主要使用bp-frame式(不懂自己去查去)的调用方式:mmm然后是被调用的sum:ss2 for循环:基本的for循环是这样的:int sum(int b){ int c, i=0; c = 0; fo... 阅读全文
posted @ 2011-12-02 13:44 Jack204 阅读(59541) 评论(0) 推荐(8) 编辑
摘要: 从上周五下午开始进入暂时停止了Linux Kernel的学习,转而投身于Windows驱动编程。就像煤老板说的,我看了那么多了,是时候将所学知识转化为生产力了。怎么说呢?《windows驱动开发技术详解》我花了一天就看了200页,其中的感受不只是惊叹。惊叹的是:Linux内核与Windows内核在一些机制上是那么的相似,尽管在整体上Linux内核是宏内核,而Windows内核是所谓的伪微内核。我深刻的体会到如果遇到什么思想性不懂的东西,还是要回去看《cpu手册》,去看《Linux Device Driver》,去看《Understanding the Linux Kernel》。Linux是开 阅读全文
posted @ 2011-11-27 14:00 Jack204 阅读(1412) 评论(1) 推荐(0) 编辑
摘要: 今晚尝试编译ldd3书中的short模块的的代码。可以在编译的过程中爆出了找不到"AS_INTERRUPT"等等各种找不到变量的错误,显然是GCC在编译的时候找不到head file,1 刚开始查到它在<asm/signal.h>中,于是尝试加上这个头文件,可是依然无效。2 网上乱查,无效【很傻叉的方法】3 在linux cross reference 上搜索,因为我尝试编译链接的内核版本是2.6.35的,然后查到AS_INTERRUPT --- not used.3方法之后,恍然大悟,原来在2.6.35的内核版本中,该变量被去除了。汗那。。浪费了我这么久的时间 阅读全文
posted @ 2011-11-22 23:55 Jack204 阅读(292) 评论(0) 推荐(0) 编辑
摘要: Reason to use per-CPU variable1 Remember that the 2.6 kernel is preemptible; it would not do for a processor to be preempted inthe middle of a critical section that modifies a per-CPU variable.2 It also would not be good if your process were to be moved to another processor in the middle of a per-CP 阅读全文
posted @ 2011-11-21 11:24 Jack204 阅读(842) 评论(0) 推荐(0) 编辑
摘要: 1 首先要说的最简单的是在一个process在运行的时候,它看到的内存是这个样子的。3G以后是给kernel使用的运行和动态分配的内存的空间,注意因为是process所看到的,下面全部都是虚拟地址空间。如下:2 然后需要说的是Linux Physical Memory Layout下面这段话解释了为什么linux不能占用所有的Ram内存:Why isn't the kernel loaded starting with the first available megabyte of RAM? Well, the PC architecture hasseveral peculiarit 阅读全文
posted @ 2011-11-21 10:28 Jack204 阅读(8803) 评论(0) 推荐(1) 编辑
摘要: 打好linux基础,不断的跟随这篇文章中的建议,适应linux kernel开发的流程。虽然需要很久甚至几年的时间,但我相信坚持就会前进!加油!HOWTO do Linux kernel development - take 3 (中文版)译者:张乐 robert_AT_thizlinux_DOT_com 原作:Greg KH 译注:本文依据take 3翻译,应该不会再有大的改动了,如果有本文会随时更新 时间仓促,恐难免错漏,欢迎指正 原文:http://permalink.gmane.org/gmane.linux.kernel/349656 (转贴说明:也可以在内核源代码目录下的Docum 阅读全文
posted @ 2011-11-15 15:03 Jack204 阅读(724) 评论(0) 推荐(0) 编辑
摘要: I’ve been getting some emails from young developers wanting to “level up” as programmers. I’m definitely not the first to write about this topic, so I’m not sure how much I have to add. Still, for what it’s worth here are a few points off the top of my head:Work with other developers. We are at a wo 阅读全文
posted @ 2011-11-14 20:35 Jack204 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 我言简意赅的说:1 if the timer expires in the next 0 to 255 jiffies, it is added to one of the 256 lists devoted to short-range timers using the least significant bits of the expires field.2 If it expires farther in the future (but before 16,384 jif-fies), it is added to one of 64 lists based on bits 9–14 o 阅读全文
posted @ 2011-11-14 20:19 Jack204 阅读(153) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 16 下一页