2011.10 整理
viktor
这个作者很懒,什么都没留下…
展开
-
编译支持Xen的Linux 3.1.0内核
这是我第一次真心把Linux内核完整的编译一遍……不过呢,从高版本起步,老内核里出现的诸多问题已经被开发者fix掉,反而更加容易。在内核中添加Xen支持就是这样。 从2.6.39版本开始,内核不需要patch 直接可以同时支持Xen Dom0和DomU ,但是想把Xen相关的编译选项调开倒真不容易。也许是我没习惯内核的编译方式吧。 环境:gcc4.5 处理器 Pentium D E原创 2011-11-04 16:41:00 · 2709 阅读 · 0 评论 -
最简单的linux内核模块 - hello - 及其Makefile
一个最简单的linux内核模块。当他加载和退出时各会打出一行信息。可以作为程序的框架,也可以测试加载模块。 #include "linux/init.h" #include "linux/module.h" //MODULE_LICENSE("GPL"); --此处:编译进内核的代码一定要标识自己符合GPL协议等开源协议。模块可以不用 static原创 2011-11-04 16:57:21 · 463 阅读 · 0 评论 -
根据窗口部分标题,查找窗口hwnd
输入窗口标题中含有的字符串,调用EnumWindows查找所有符合条件的窗口。 #include "windows.h" #include "psapi.h" #include "iostream" #include "vector" #include "algorithm" #include "string" #include "cstring" using namespace std;原创 2011-11-04 17:46:49 · 810 阅读 · 0 评论 -
2011.10 mark
gcc__attribute__ http://blog.chinaunix.net/space.php?uid=7246208&do=blog&cuid=491473 http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Function-Attributes.html a project with the goal of implemen原创 2011-11-04 16:01:07 · 278 阅读 · 0 评论 -
ubuntu 10.10 LXR配置 (with note)
ref: http://damocles.blogbus.com/tag/lxr/ Linux Cross Reference工具在很多网站上都有,不过很多都是国外的网站总是上不去,或者没有适合自己的版本。还是自己配置一下的好。而且可以举一反三,配好了LXR,还可以搞个FXR,XEN-XR什么的。很麻烦但是很有用。 我参考了上面的文章,加了一些内容。整理了一下原作者的配置顺序 配置步骤:原创 2011-11-04 15:43:35 · 828 阅读 · 1 评论 -
WinAPI 设定全局热键
text #include "windows.h" #include "psapi.h" #include "assert.h" #include "cstdio" static int hk_run, hk_exit; HWND g_hwnd; void reg() { hk_run=GlobalAddAtom("C-A-X"); hk_exit=GlobalAddAtom原创 2011-11-04 17:43:15 · 409 阅读 · 0 评论 -
在WinAPI中使用Lambda函数(坑:如何把no capture的lambda函数转换成函数指针)
使用WinAPI的时候经常有只是执行很简单功能的CallBack函数,我不想把它单独写成一个函数,这样把一个功能标记成(global) static单独悬在所有的类外面,很不好维护。于是想用lambda来简化。 但是 这些callback函数有一个共同点就是——都有一个属性叫做CALLBACK(也就是 __stdcall)。怎样才能让winAPI正确的调用lambda呢? 以下是cod原创 2011-11-04 17:40:33 · 792 阅读 · 2 评论 -
ELDD Chapter 2..3 Linux Kernel Facilities
Chapter 2 时间相关 calibrate_delay HZ=100 jiffies schedule_timeout init_timer m/u/ndelay time gettimeofday 内核线程同步 忙等待锁:spinlock.h 互斥信号量:mutex.h 中断控制:[local|spin_lock]_irq_[enable|disable|save原创 2011-11-04 15:59:39 · 355 阅读 · 0 评论 -
编译Xen4.1.2 Xen 4.1.3-rc1-pre
环境:ubuntu 10.10,内核版本2.6.35.30, gcc 4.5 1. 首先,如果想使用最新版的xen,需要先安装mercurial这个源代码管理工具,然后用下面的命令hg -v --time clone http://xenbits.xen.org/hg/xen-unstable.hg 2. 官网http://xen.org/products/xen_source.html下载4原创 2011-11-04 16:12:46 · 1260 阅读 · 0 评论 -
简单的字符设备-myscull
参考: Linux Device Drivers chapter 3: scull http://oss.org.cn/kernel-book/ldd3/ch03.html 字符设备是linux设备模型中最基本的一种。 main.c #include "mysc.h" MODULE_LICENSE("GPL"); struct mysc_dev scull_device; st原创 2011-11-04 17:25:34 · 289 阅读 · 0 评论