📄 callout_reboot_mv64360.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" .extern mv64360_base# R3: syspage paddr# R4: syspage vaddr# R5: rtn dst offset# R6: r/w offset# R7: patch data# R8: rtn srcpatcher: stwu %r1,-32(%r1) mflr %r0 stw %r31,28(%r1) stw %r0,36(%r1) add %r31,%r3,%r5 loada %r4,mv64360_base loadi %r3,0x30000 bl callout_io_map_indirect lhz %r4,6(%r31) lhz %r5,2(%r31) slwi %r5,%r5,16 or %r4,%r4,%r5 add %r3,%r3,%r4 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 .ifdef __LITTLEENDIAN__.error lwbrx's used below assume that we're running big endian.endif.macro DEVBASE reg,dev_reg_off # the instruction immediate values are patched by the above routine lis ®,(&dev_reg_off) >> 16 ori ®,®,(&dev_reg_off) & 0xffff.endm.set WDC, 0xb410.set WDV, 0xb414 CALLOUT_START reboot_mv64360, 0, patcher DEVBASE %r7,0 cmplwi %r4,0 beq 1f lhz %r5,SYSPAGE_SYSTEM_PRIVATE(%r3) add %r5,%r5,%r3 lwz %r5,SP_PRIVATE_FLAGS(%r5) bittst %r5,%r5,SYSTEM_PRIVATE_FLAG_ABNORMAL_REBOOT beq 2f1: #disable interrupts loadi %r9,PPC_MSR_EE mfmsr %r8 andc %r9,%r8,%r9 mtmsr %r9 sync loadi %r5,WDC loadi %r6,WDV lwbrx %r3,%r7,%r5 bittst %r0,%r3,0x80000000 # is watchdog enabled? beq 1f # disable it loadi %r4,1 << 24 stwbrx %r4,%r7,%r5 eieio loadi %r4,2 << 24 stwbrx %r4,%r7,%r5 eieio1: loadi %r4,1 stwbrx %r4,%r7,%r5 eieio loadi %r4,0x1000 stwbrx %r4,%r7,%r6 # make sure we don't get an NMI eieio loadi %r4, (1 << 24) # do first stage renable stwbrx %r4,%r7,%r5 eieio loadi %r4, (2 << 24) # do second stage renable stwbrx %r4,%r7,%r5 eieio2: b 2bCALLOUT_END reboot_mv64360
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -