日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux内核态串口读写程序,linux 0.11 内核学习 -- rs_io.s,串口汇编代码

發布時間:2025/4/5 linux 13 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux内核态串口读写程序,linux 0.11 内核学习 -- rs_io.s,串口汇编代码 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

/*

* ?該文件實現rs232 串行通信中斷處理

*/

/*

* ?linux/kernel/rs_io.s

*

* ?(C) 1991 ?Linus Torvalds

*/

/*

*rs_io.s

*

* This module implements the rs232 io interrupts.

*/

.text

.globl _rs1_interrupt,_rs2_interrupt

/* 讀寫隊列緩沖區的長度 */

size= 1024/* must be power of two !

and must match the value

in tty_io.c!!! */

/* these are the offsets into the read/write buffer structures */

/* 讀寫緩沖結構中的偏移量tty_queue */

rs_addr = 0

head = 4

tail = 8

proc_list = 12

buf = 16

/* 當寫隊列里還剩256 個字符空間(WAKEUP_CHARS)時,我們就可以寫 */

startup= 256/* chars left in write queue when we restart it */

/*

* These are the actual interrupt routines. They look where

* the interrupt is coming from, and take appropriate action.

*/

.align 2

/* 串行端口1 中斷處理程序入口點 */

_rs1_interrupt:

// tty 表中對應串口1 的讀寫緩沖指針的地址入棧

pushl $_table_list+8// table_list定義在文件tty_io.c文件中

jmp rs_int

/* 串行端口2 中斷處理程序入口點 */

.align 2

_rs2_interrupt:

pushl $_table_list+16// 同上

rs_int:

pushl %edx

pushl %ecx

pushl %ebx

pushl %eax

push %es

push %ds/* as this is an interrupt, we cannot */

/* 讓ds、es 指向內核數據段 */

pushl $0x10/* know that bs is ok. Load it */

pop %ds

pushl $0x10

pop %es

movl 24(%esp),%edx// 將緩沖隊列指針地址存入edx 寄存器

movl (%edx),%edx// 取讀隊列指針(地址)

總結

以上是生活随笔為你收集整理的linux内核态串口读写程序,linux 0.11 内核学习 -- rs_io.s,串口汇编代码的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。