使用windows live writer写的第一篇博客

clip_image002

试试粘贴world上的图片

在试试插入代码

// +FHDR -----------------------------------------------------------------------
// Copyright (c) 2006, Hongsi.
// Hongsi Confidential Proprietary
// 2006/08/21
//
// -----------------------------------------------------------------------------
// File Name: init_int.c
// Type: C Language
//
// -----------------------------------------------------------------------------
// Description:
// This code is a function for Interrupt Vector Initialization.
//
// -----------------------------------------------------------------------------
// Detailed Func Description:
// 1. Interrupt Vector Initialization Function.
//
// -----------------------------------------------------------------------------
// Revision History
// DATE         AUTHOR          DESCRIPTION
// 2006/08/21             V1.0
// -FHDR -----------------------------------------------------------------------

// --------------------------------------------------------------------- 
// Variables Declarations
// --------------------------------------------------------------------- 
// r2 : 1st arg of Fnuction;
// r3 : 2st arg of Fnuction;
// r4 : 3st arg of Fnuction;
// r5 : 4st arg of Fnuction;
#define BASE  r2
#define STACK r3
#define HANDLER r4
#define OFFSET r5

asm void Init_Int(register long base,register long stack,register void(*handler)(),register unsigned char offset)
{
     mfcr r1, VBR
     mtcr BASE,VBR
     movi  r7,31
     cmphs r0,r0
loop:     ld.w r6,(r1,0)
      st.w r6,(r2,0)
      addi r1,4
      addi r2,4
      loopt r7,loop
      mfcr r1, VBR
      st.w STACK,(r1,0)
      mfcr r7, PSR
      bseti r7,1
      mtcr r7,PSR
      mfcr r6, VBR
      ld.w r0,(r6,0)
      mfcr r7, PSR
      bclri r7,1
      mtcr r7,PSR
      mfcr r6,VBR
      lsli OFFSET,2
      addu  OFFSET,r6
      st.w HANDLER,(OFFSET,0)
      jmp r15
}

posted @ 2012-01-16 14:13  宫藏嘉辈  阅读(273)  评论(0编辑  收藏  举报