[Lapetus-cvs] lapetus arcomm.c,NONE,1.1 arcomm.h,NONE,1.1
Status: Inactive
Brought to you by:
cyberwarriorx
From: Theo B. <cyb...@us...> - 2009-06-03 01:21:42
|
Update of /cvsroot/lapetus/lapetus In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29943 Added Files: arcomm.c arcomm.h Log Message: -Added early code for using a real AR's handler --- NEW FILE: arcomm.c --- /* Copyright 2009 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "lapetus.h" void ARCLInitHandler(int vector, u32 patchaddr, u16 patchinst, u32 codeaddr) { int i; // Copy over AR handler from 0x02003024-0x02003147 to codeaddr+8 for (i = 0; i < 292; i+=4) *((u32 *)(codeaddr+8+i)) = *((u32 *)(0x02003024+i)); // Patch code address+8 so the bra call is correct(fix me) *((u16 *)(codeaddr+0x8)) = *((u16 *)(codeaddr+0xA)); *((u16 *)(codeaddr+0xA)) = 0x0009; // Patch interrupt with AR handler *((u32 *)(0x06000000 + (vector << 2))) = codeaddr + 0x8; // Read patch address, write it to code address+0xC *((u16 *)(codeaddr+0xC)) = *((u16 *)patchaddr); // Write patch instruction to patch address *((u16 *)patchaddr) = patchinst; // Write a dummy code(not sure if this is needed) *((u32 *)(codeaddr)) = 0x06000000; *((u32 *)(codeaddr+4)) = 0x00000000; // flag to keep handler from running multiple times at the same time *((u32 *)(codeaddr+0x11C)) = codeaddr; } --- NEW FILE: arcomm.h --- /* Copyright 2009 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ARCOMM_H #define ARCOMM_H void ARCLInitHandler(int vector, u32 patchaddr, u16 patchinst, u32 codeaddr); #endif |