From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 402 invoked by alias); 9 May 2002 10:09:03 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 389 invoked from network); 9 May 2002 10:08:59 -0000 Received: from unknown (HELO dell-pe2450-3.cambridge.redhat.com) (195.224.55.225) by sources.redhat.com with SMTP; 9 May 2002 10:08:59 -0000 Received: from north-pole.nickc.cambridge.redhat.com (host217-35-6-237.in-addr.btopenworld.com [217.35.6.237]) by dell-pe2450-3.cambridge.redhat.com (Postfix) with ESMTP id B85CA84819 for ; Thu, 9 May 2002 11:08:58 +0100 (BST) Received: from north-pole.nickc.cambridge.redhat.com.nickc.cambridge.redhat.com (localhost [127.0.0.1]) by north-pole.nickc.cambridge.redhat.com (Postfix) with ESMTP id D898F1C395 for ; Thu, 9 May 2002 11:08:42 +0100 (BST) To: gdb-patches@sources.redhat.com Subject: Add support for RedBoot SWIs to ARM Simulator From: Nick Clifton Date: Thu, 09 May 2002 03:09:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-05/txt/msg00267.txt.bz2 Hi Guys, I am applying the patch below to add support for the SWI used by RedBoot to implement some of its system calls. The patch only supports those system calls already supported by the simulator's Angel and Demon SWI protocol support. Note - it is not possible to support the RedBoot SWI in Thumb mode, since this SWI value - 0x18 - is also the thumb breakpoint value used by GDB. Cheers Nick 2002-05-09 Nick Clifton * armos.c (ARMul_OSHandleSWI): Support the RedBoot SWI in ARM mode and some of its system calls. Index: sim/arm/armos.c =================================================================== RCS file: /cvs/src/src/sim/arm/armos.c,v retrieving revision 1.11 diff -c -3 -p -w -r1.11 armos.c *** sim/arm/armos.c 21 Feb 2002 20:22:49 -0000 1.11 --- sim/arm/armos.c 9 May 2002 10:01:16 -0000 *************** ARMul_OSHandleSWI (ARMul_State * state, *** 635,640 **** --- 635,703 ---- /* These are used by the FPE code. */ break; + case 0x180001: /* RedBoot's Syscall SWI in ARM mode. */ + switch (state->Reg[0]) + { + /* These numbers are defined in libgloss/syscall.h + but the simulator should not be dependend upon + libgloss being installed. */ + case 1: /* Exit. */ + state->Emulate = FALSE; + return TRUE; + + case 2: /* Open. */ + SWIopen (state, state->Reg[1], state->Reg[2]); + return TRUE; + + case 3: /* Close. */ + state->Reg[0] = close (state->Reg[1]); + OSptr->ErrorNo = errno; + return TRUE; + + case 4: /* Read. */ + SWIread (state, state->Reg[1], state->Reg[2], state->Reg[3]); + return TRUE; + + case 5: /* Write. */ + SWIwrite (state, state->Reg[1], state->Reg[2], state->Reg[3]); + return TRUE; + + case 6: /* Lseek. */ + state->Reg[0] = lseek (state->Reg[1], state->Reg[2], state->Reg[3]); + OSptr->ErrorNo = errno; + return TRUE; + + case 17: /* Utime. */ + state->Reg[0] = (ARMword) time (state->Reg[1]); + OSptr->ErrorNo = errno; + return (TRUE); + + case 7: /* Unlink. */ + case 8: /* Getpid. */ + case 9: /* Kill. */ + case 10: /* Fstat. */ + case 11: /* Sbrk. */ + case 12: /* Argvlen. */ + case 13: /* Argv. */ + case 14: /* ChDir. */ + case 15: /* Stat. */ + case 16: /* Chmod. */ + case 18: /* Time. */ + sim_callback->printf_filtered + (sim_callback, + "sim: unhandled RedBoot syscall '%d' encountered - ignoring\n", + state->Reg[0]); + return FALSE; + + default: + sim_callback->printf_filtered + (sim_callback, + "sim: unknown RedBoot syscall '%d' encountered - ignoring\n", + state->Reg[0]); + return FALSE; + } + return TRUE; + default: /* If there is a SWI vector installed use it. */ if (state->is_XScale && saved_number != -1)