/*
* 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/*缓冲区(缓冲队列的长度)与/include/linux/tty.h line 14 #define TTY_BUF_SIZE 1024 相同 must be a power of two ! And MUST be the same /* must be power of two !
and must match the value
in tty_io. */
/* these are the offsets into the read/write buffer structures */
rs_addr = 0 #串行端口号字段偏移(端口号是0x3f8 或0x2f8)。
head = 4 #缓冲区中头指针字段偏移
tail = 8 #缓冲区中尾指针字段偏移
proc_list = 12 #等待该缓冲的进程字段偏移
buf = 16 #缓冲区字段偏移
startup = 256 #当写队列里还剩256 个字符空间(WAKEUP_CHARS)时,我们就可以写 /* 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
_rs1_interrupt:#串行端口1 中断处理程序入口点。
pushl $_table_list+8 #tty 表中对应串口1 的读写缓冲指针的地址入栈,linux-0.11\kernel\chr_drv\tty_io.c line 99
jmp rs_int
.align 2
_rs2_interrupt:#串行端口2 中断处理程序入口点
pushl $_table_list+16 #tty 表中对应串口2 的读写缓冲指针的地址入栈,linux-0.11\kernel\chr_drv\tty_io.c line 99
rs_int:
pushl %edx
pushl %ecx
pushl %ebx
pushl %eax
push %es
push %ds /* as this is an interrupt, we cannot */
pushl $0x10 /* know that bs is ok. Load it */
pop %ds
pushl $0x10
pop %es
movl 24(%esp),%edx
movl (%edx),%edx
movl rs_addr(%edx),%edx
addl $2,%edx /* interrupt ident. reg */
rep_int:
xorl %eax,%eax
inb %dx,%al
testb $1,%al
jne end
cmpb $6,%al /* this shouldn
|