📄 con_drv.s
字号:
.file "con_drv.c" .section .text.globl _put_queue_put_queue: pushl %ebp movl %esp, %ebp pushl %ebx subl $4, %esp movl 12(%ebp), %eax movb %al, -8(%ebp) movl 8(%ebp), %eax movb 65(%eax), %dl movb %dl, %al sarb $7, %al movb %al, %cl shrb $2, %cl leal (%edx,%ecx), %eax andl $63, %eax subb %cl, %al movsbl %al,%ebx movl 8(%ebp), %eax movb 64(%eax), %dl movb %dl, %al sarb $7, %al movb %al, %cl shrb $2, %cl leal (%edx,%ecx), %eax andl $63, %eax subb %cl, %al movsbl %al,%eax movl %ebx, %edx subl %eax, %edx movl %edx, %eax cmpl $64, %eax je L4 movl 8(%ebp), %eax movb 65(%eax), %cl movb %cl, %al sarb $7, %al movb %al, %dl shrb $2, %dl leal (%ecx,%edx), %eax andl $63, %eax subb %dl, %al movsbl %al,%ebx movl 8(%ebp), %edx movb -8(%ebp), %al movb %al, (%edx,%ebx) leal 1(%ecx), %edx movl 8(%ebp), %eax movb %dl, 65(%eax)L4: addl $4, %esp popl %ebx popl %ebp ret.globl _get_queue_get_queue: pushl %ebp movl %esp, %ebp pushl %ebx subl $4, %esp movl 8(%ebp), %eax movb 64(%eax), %dl movb %dl, %al sarb $7, %al movb %al, %cl shrb $2, %cl leal (%edx,%ecx), %eax andl $63, %eax subb %cl, %al movb %al, %bl movl 8(%ebp), %eax movb 65(%eax), %dl movb %dl, %al sarb $7, %al movb %al, %cl shrb $2, %cl leal (%edx,%ecx), %eax andl $63, %eax subb %cl, %al cmpb %al, %bl jne L6 movl 8(%ebp), %eax movb $0, 64(%eax) movl 8(%ebp), %eax movb $0, 65(%eax) jmp L5L6: movl 8(%ebp), %eax movb 64(%eax), %cl movb %cl, %al sarb $7, %al movb %al, %dl shrb $2, %dl leal (%ecx,%edx), %eax andl $63, %eax subb %dl, %al movsbl %al,%edx movl 8(%ebp), %eax movb (%eax,%edx), %al movsbl %al,%ebx leal 1(%ecx), %edx movl 8(%ebp), %eax movb %dl, 64(%eax) movl %ebx, -8(%ebp)L5: movl -8(%ebp), %eax addl $4, %esp popl %ebx popl %ebp ret.globl _tty_init_tty_init: pushl %ebp movl %esp, %ebp movb $1, _tty movb $0, _tty+65 movb $0, _tty+66 movb $0, _tty+131 movb $0, _tty+132 movl $_con_write, _tty+136 popl %ebp ret.globl _char_drv_init_char_drv_init: pushl %ebp movl %esp, %ebp subl $8, %esp call _con_init call _tty_init subl $8, %esp pushl $_kb_interrupt pushl $33 call _set_trap addl $16, %esp subl $12, %esp pushl $33 call _inportb addl $16, %esp movl $0, %edx movb %al, %dl movl $253, %eax andl %edx, %eax subl $8, %esp pushl %eax pushl $33 call _outportb addl $16, %esp leave ret .section .data .p2align 4_key_map: .byte 0 .byte 27 .byte 96 .byte 33 .byte 64 .byte 35 .byte 36 .byte 37 .byte 38 .byte 47 .byte 40 .byte 41 .byte 61 .byte 63 .byte 127 .byte 9 .byte 81 .byte 87 .byte 69 .byte 82 .byte 84 .byte 89 .byte 85 .byte 73 .byte 79 .byte 80 .byte 93 .byte 94 .byte 10 .byte 0 .byte 65 .byte 83 .byte 68 .byte 70 .byte 71 .byte 72 .byte 74 .byte 75 .byte 76 .byte 92 .byte 91 .byte 0 .byte 0 .byte 42 .byte 90 .byte 88 .byte 67 .byte 86 .byte 66 .byte 78 .byte 77 .byte 59 .byte 58 .byte 95 .byte 0 .byte 42 .byte 0 .byte 32 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 45 .byte 0 .byte 0 .byte 0 .byte 43 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 62 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .space 30 .section .text.globl _do_kb_interrupt_do_kb_interrupt: pushl %ebp movl %esp, %ebp subl $24, %esp movl 8(%ebp), %eax movb %al, -20(%ebp) cmpb $0, -20(%ebp) js L16 movsbl -20(%ebp),%eax movb _key_map(%eax), %al movb %al, -1(%ebp) movsbl -1(%ebp),%eax pushl %eax pushl $_tty+1 call _put_queue addl $8, %esp pushl $_tty+1 call _get_queue addl $4, %esp movsbl %al,%eax pushl %eax pushl $_tty+67 call _put_queue addl $8, %esp movsbl -1(%ebp),%eax subl $12, %esp pushl %eax call _putchark addl $16, %espL16: leave ret.comm _tty,432 .ident "GCC: (GNU) 4.2.1"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -