- 博客(7)
- 资源 (11)
- 收藏
- 关注
原创 softirq_demo
软中断的编号 `IRQ_NR` 需要根据实际情况定义,Linux 内核中预定义了一些软中断,例如 `HI_SOFTIRQ`、`TIMER_SOFTIRQ` 等。2. **软中断调度**:使用 `open_softirq` 和 `raise_softirq` 将任务分发到软中断的下半部处理。- 使用 `open_softirq` 定义软中断处理函数 `softirq_handler`。- 本示例中使用的是虚拟中断 10。3. 查看 `/dev` 目录下的字符设备 `/dev/softirq_demo`。
2025-02-28 11:27:59
415
原创 tasklet_demo
`tasklet_schedule` 将 tasklet 添加到软中断队列中,由 tasklet 的下半部在稍后执行。- 中断处理程序(上半部)仅打印一条消息,然后调用 `tasklet_schedule` 调度 tasklet。- `tasklet_schedule` 和 `tasklet_kill` 是安全的 API,可在中断上下文中使用。- `tasklet_handler` 是 tasklet 的下半部,在软中断上下文中执行。- 将代码保存为 `tasklet_demo.c`。
2025-02-28 11:27:24
575
原创 proc实验
#include <linux/module.h>#include <linux/kernel.h>#include <linux/proc_fs.h>#include <linux/sched.h>#include <linux/uaccess.h>#define STRINGLEN 1024char global_buffer[STRINGLEN] = "hello";struct proc_dir_entry *examp.
2022-03-21 20:53:02
187
原创 memcpy函数
C 库函数void *memcpy(void *str1, const void *str2, size_t n)从存储区 str2 复制 n 个字节到存储区 str1。参数str1-- 指向用于存储复制内容的目标数组,类型强制转换为 void* 指针。 str2-- 指向要复制的数据源,类型强制转换为 void* 指针。 n-- 要被复制的字节数。该函数返回一个指向目标存储区 str1 的指针。// 将字符串复制到数组 dest 中#include <stdio....
2022-03-21 18:16:22
326
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人