📄 callout_debug_8250.s
字号:
# # Copyright 2007, QNX Software Systems. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not reproduce, modify or distribute this software except in # compliance with the License. You may obtain a copy of the License # at: http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTIES OF ANY KIND, either express or implied.# # This file may contain contributions from others, either as # contributors under the License or as licensors under other terms. # Please review this entire file for other proprietary rights or license # notices, as well as the QNX Development Suite License Guide at # http://licensing.qnx.com/license-guide/ for other information.# # An entry point for a hardware kernel callout.# It may be called by an interrupt handler.# This code MUST be position independant.# .include "callout.ah" patch_debug: stwu %r1,-32(%r1) mflr %r0 stw %r31,28(%r1) stw %r0,36(%r1) add %r31,%r3,%r5 lwz %r5,DDI_SHIFT(%r7) li %r3,REG_LS slw %r3,%r3,%r5 sth %r3,10(%r31) la %r4,DDI_BASE(%r7) addi %r3,%r3,1 # offsetof REG_LS + sizeof REG_LS => length to map bl callout_io_map_indirect sth %r3,6(%r31) srwi %r3,%r3,16 sth %r3,2(%r31) lwz %r0,36(%r1) mtlr %r0 lwz %r31,28(%r1) addi %r1,%r1,32 blr## void display_output(struct syspage_entry *sysp, char c)## Display debug messages from kdebug or the kernel.#CALLOUT_START display_char_8250, 0, patch_debug lis %r6,0x1234 # get serial port base (patched) ori %r6,%r6,0x5678 # ..... li %r7,0x0000 # get LS register offset (patched) lhz %r9,SYSPAGE_PPC_KERINFO(%r3) add %r9,%r9,%r3 lwz %r9,KERINFO_TS_CLEAR(%r9) #disable interrupt bitset %r9,%r9,PPC_MSR_EE mfmsr %r8 andc %r9,%r8,%r9 mtmsr %r9 isync1: lbzx %r0,%r6,%r7 andi. %r0,%r0,LSR_TXRDY beq 1b stb %r4,0(%r6) mtmsr %r8 isync blrCALLOUT_END display_char_8250 ## int poll_key(volatile struct syspage_entry *)## return a key value, or -1 if no key is available (for kdebug use)#CALLOUT_START poll_key_8250, 0, patch_debug lis %r6,0x1234 # get serial port base (patched) ori %r6,%r6,0x5678 # ..... li %r7,0x0000 # get LS register offset (patched) lhz %r9,SYSPAGE_PPC_KERINFO(%r3) add %r9,%r9,%r3 lwz %r9,KERINFO_TS_CLEAR(%r9) #disable interrupt bitset %r9,%r9,PPC_MSR_EE mfmsr %r8 andc %r9,%r8,%r9 mtmsr %r9 isync lbzx %r0,%r6,%r7 andi. %r0,%r0,LSR_RXRDY beq 1f lbz %r3,0(%r6) mtmsr %r8 isync blr1: li %r3,-1 mtmsr %r8 blrCALLOUT_END poll_key_8250 ## int break_detect(volatile struct syspage_entry *)## return 1 if a break condition is detected, 0 otherwise#CALLOUT_START break_detect_8250, 0, patch_debug lis %r6,0x1234 # get serial port base (patched) ori %r6,%r6,0x5678 # ..... li %r7,0x0000 # get LS register offset (patched) lhz %r9,SYSPAGE_PPC_KERINFO(%r3) add %r9,%r9,%r3 lwz %r9,KERINFO_TS_CLEAR(%r9) #disable interrupt bitset %r9,%r9,PPC_MSR_EE mfmsr %r8 andc %r9,%r8,%r9 mtmsr %r9 isync lbzx %r3,%r6,%r7 andi. %r3,%r3,LSR_BI beq 1f lbz %r0,0(%r6) # eat extraneous char1: mtmsr %r8 isync blrCALLOUT_END break_detect_8250
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -