`
ladymaidu
  • 浏览: 678180 次
文章分类
社区版块
存档分类
最新评论

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 // 取读队列指针(地址)

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics