diff options
author | Nick Clifton <nickc@redhat.com> | 2000-02-08 20:54:27 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2000-02-08 20:54:27 +0000 |
commit | 6d358e869b1efe22fa6697a8aa4191ddacbacef0 (patch) | |
tree | 8e46af77cc6bd1e1f07b560c31b7cdf0fbbffab9 /sim/arm | |
parent | ab266a97fb888efa38e7cdc1d53b6c97337b589f (diff) | |
download | gdb-6d358e869b1efe22fa6697a8aa4191ddacbacef0.zip gdb-6d358e869b1efe22fa6697a8aa4191ddacbacef0.tar.gz gdb-6d358e869b1efe22fa6697a8aa4191ddacbacef0.tar.bz2 |
Fix compile time warning messages.
Diffstat (limited to 'sim/arm')
-rw-r--r-- | sim/arm/ChangeLog | 11 | ||||
-rw-r--r-- | sim/arm/armcopro.c | 33 | ||||
-rw-r--r-- | sim/arm/armdefs.h | 6 | ||||
-rw-r--r-- | sim/arm/armemu.c | 11 | ||||
-rw-r--r-- | sim/arm/armemu.h | 4 | ||||
-rw-r--r-- | sim/arm/armos.c | 630 | ||||
-rw-r--r-- | sim/arm/armsupp.c | 18 | ||||
-rw-r--r-- | sim/arm/armvirt.c | 5 | ||||
-rw-r--r-- | sim/arm/bag.c | 13 | ||||
-rw-r--r-- | sim/arm/wrapper.c | 47 |
10 files changed, 109 insertions, 669 deletions
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index db8d4df..3569741 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,14 @@ +2000-02-08 Nick Clifton <nickc@cygnus.com> + + * wrapper.c: Fix compile time warning messages. + * armcopro.c: Fix compile time warning messages. + * armdefs.h: Fix compile time warning messages. + * armemu.c: Fix compile time warning messages. + * armemu.h: Fix compile time warning messages. + * armos.c: Fix compile time warning messages. + * armsupp.c: Fix compile time warning messages. + * armvirt.c: Fix compile time warning messages. + 2000-02-02 Bernd Schmidt <bernds@cygnus.co.uk> * *.[ch]: Use indent to make readable. diff --git a/sim/arm/armcopro.c b/sim/arm/armcopro.c index 6874ee1..579446c 100644 --- a/sim/arm/armcopro.c +++ b/sim/arm/armcopro.c @@ -1,5 +1,5 @@ /* armcopro.c -- co-processor interface: ARM6 Instruction Emulator. - Copyright (C) 1994 Advanced RISC Machines Ltd. + Copyright (C) 1994, 2000 Advanced RISC Machines Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,6 +16,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "armdefs.h" +#include "ansidecl.h" extern unsigned ARMul_CoProInit (ARMul_State * state); extern void ARMul_CoProExit (ARMul_State * state); @@ -61,7 +62,7 @@ MMUInit (ARMul_State * state) } static unsigned -MMUMRC (ARMul_State * state, unsigned type, ARMword instr, ARMword * value) +MMUMRC (ARMul_State * state ATTRIBUTE_UNUSED, unsigned type ATTRIBUTE_UNUSED, ARMword instr, ARMword * value) { int reg = BITS (16, 19) & 7; @@ -73,7 +74,7 @@ MMUMRC (ARMul_State * state, unsigned type, ARMword instr, ARMword * value) } static unsigned -MMUMCR (ARMul_State * state, unsigned type, ARMword instr, ARMword value) +MMUMCR (ARMul_State * state, unsigned type ATTRIBUTE_UNUSED, ARMword instr, ARMword value) { int reg = BITS (16, 19) & 7; @@ -91,7 +92,7 @@ MMUMCR (ARMul_State * state, unsigned type, ARMword instr, ARMword value) static unsigned -MMURead (ARMul_State * state, unsigned reg, ARMword * value) +MMURead (ARMul_State * state ATTRIBUTE_UNUSED, unsigned reg, ARMword * value) { if (reg == 0) *value = 0x41440110; @@ -131,7 +132,7 @@ I, C and F cyles) */ static ARMword ValReg[16]; static unsigned -ValLDC (ARMul_State * state, unsigned type, ARMword instr, ARMword data) +ValLDC (ARMul_State * state ATTRIBUTE_UNUSED, unsigned type, ARMword instr, ARMword data) { static unsigned words; @@ -156,7 +157,7 @@ ValLDC (ARMul_State * state, unsigned type, ARMword instr, ARMword data) } static unsigned -ValSTC (ARMul_State * state, unsigned type, ARMword instr, ARMword * data) +ValSTC (ARMul_State * state ATTRIBUTE_UNUSED, unsigned type, ARMword instr, ARMword * data) { static unsigned words; @@ -181,14 +182,14 @@ ValSTC (ARMul_State * state, unsigned type, ARMword instr, ARMword * data) } static unsigned -ValMRC (ARMul_State * state, unsigned type, ARMword instr, ARMword * value) +ValMRC (ARMul_State * state ATTRIBUTE_UNUSED, unsigned type ATTRIBUTE_UNUSED, ARMword instr, ARMword * value) { *value = ValReg[BITS (16, 19)]; return (ARMul_DONE); } static unsigned -ValMCR (ARMul_State * state, unsigned type, ARMword instr, ARMword value) +ValMCR (ARMul_State * state ATTRIBUTE_UNUSED, unsigned type ATTRIBUTE_UNUSED, ARMword instr, ARMword value) { ValReg[BITS (16, 19)] = value; return (ARMul_DONE); @@ -392,19 +393,29 @@ ARMul_CoProDetach (ARMul_State * state, unsigned number) \***************************************************************************/ static unsigned -NoCoPro3R (ARMul_State * state, unsigned a, ARMword b) +NoCoPro3R (ARMul_State * state ATTRIBUTE_UNUSED, + unsigned a ATTRIBUTE_UNUSED, + ARMword b ATTRIBUTE_UNUSED) { return (ARMul_CANT); } static unsigned -NoCoPro4R (ARMul_State * state, unsigned a, ARMword b, ARMword c) +NoCoPro4R ( + ARMul_State * state ATTRIBUTE_UNUSED, + unsigned a ATTRIBUTE_UNUSED, + ARMword b ATTRIBUTE_UNUSED, + ARMword c ATTRIBUTE_UNUSED) { return (ARMul_CANT); } static unsigned -NoCoPro4W (ARMul_State * state, unsigned a, ARMword b, ARMword * c) +NoCoPro4W ( + ARMul_State * state ATTRIBUTE_UNUSED, + unsigned a ATTRIBUTE_UNUSED, + ARMword b ATTRIBUTE_UNUSED, + ARMword * c ATTRIBUTE_UNUSED) { return (ARMul_CANT); } diff --git a/sim/arm/armdefs.h b/sim/arm/armdefs.h index 7b63a8f..bce638d 100644 --- a/sim/arm/armdefs.h +++ b/sim/arm/armdefs.h @@ -372,3 +372,9 @@ pascal void SpinCursor (short increment); /* copied from CursorCtl.h */ # define HOURGLASS SpinCursor( 1 ) # define HOURGLASS_RATE 1023 /* 2^n - 1 */ #endif + +extern void ARMul_UndefInstr (ARMul_State *, ARMword); +extern void ARMul_FixCPSR (ARMul_State *, ARMword, ARMword); +extern void ARMul_FixSPSR (ARMul_State *, ARMword, ARMword); +extern void ARMul_ConsolePrint (ARMul_State *, const char *, ...); +extern void ARMul_SelectProcessor (ARMul_State *, unsigned); diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c index bf0cb3b..83853f1 100644 --- a/sim/arm/armemu.c +++ b/sim/arm/armemu.c @@ -279,11 +279,11 @@ ARMul_Emulate26 (register ARMul_State * state) { #endif register ARMword instr, /* the current instruction */ - dest, /* almost the DestBus */ + dest = 0, /* almost the DestBus */ temp, /* ubiquitous third hand */ - pc; /* the address of the current instruction */ + pc = 0; /* the address of the current instruction */ ARMword lhs, rhs; /* almost the ABus and BBus */ - ARMword decoded, loaded; /* instruction pipeline */ + ARMword decoded = 0, loaded = 0; /* instruction pipeline */ /***************************************************************************\ * Execute the next instruction * @@ -2628,7 +2628,7 @@ ARMul_Emulate26 (register ARMul_State * state) #ifdef MODE32 state->Reg[14] = pc + 4; /* put PC into Link */ #else - state->Reg[14] = pc + 4 | ECC | ER15INT | EMODE; /* put PC into Link */ + state->Reg[14] = (pc + 4) | ECC | ER15INT | EMODE; /* put PC into Link */ #endif state->Reg[15] = pc + 8 + POSBRANCH; FLUSHPIPE; @@ -3742,7 +3742,7 @@ static unsigned Multiply64 (ARMul_State * state, ARMword instr, int msigned, int scc) { int nRdHi, nRdLo, nRs, nRm; /* operand register numbers */ - ARMword RdHi, RdLo, Rm; + ARMword RdHi = 0, RdLo = 0, Rm; int scount; /* cycle count */ nRdHi = BITS (16, 19); @@ -3809,7 +3809,6 @@ Multiply64 (ARMul_State * state, ARMword instr, int msigned, int scc) state->Reg[nRdLo] = RdLo; state->Reg[nRdHi] = RdHi; - } /* else undefined result */ else fprintf (stderr, "MULTIPLY64 - INVALID ARGUMENTS\n"); diff --git a/sim/arm/armemu.h b/sim/arm/armemu.h index 47238a8..b80c4ef 100644 --- a/sim/arm/armemu.h +++ b/sim/arm/armemu.h @@ -170,8 +170,8 @@ extern ARMword isize; ASSIGNV((state->Reg[15] & VBIT) != 0) ; \ } \ else { \ - state->Reg[15] = R15PC | (s) & (CCBITS | R15INTBITS | R15MODEBITS) ; \ - ARMul_R15Altered(state) ; \ + state->Reg[15] = R15PC | ((s) & (CCBITS | R15INTBITS | R15MODEBITS)) ; \ + ARMul_R15Altered (state) ; \ } #define SETABORT(i,m) state->Cpsr = ECC | EINT | (i) | (m) diff --git a/sim/arm/armos.c b/sim/arm/armos.c index 3095f57..67dd51c 100644 --- a/sim/arm/armos.c +++ b/sim/arm/armos.c @@ -23,6 +23,7 @@ fun, and definign VAILDATE will define SWI 1 to enter SVC mode, and SWI 0x11 to halt the emulator. */ #include "config.h" +#include "ansidecl.h" #include <time.h> #include <errno.h> @@ -94,11 +95,6 @@ extern ARMword ARMul_Debug (ARMul_State * state, ARMword pc, ARMword instr); #endif #define UNIQUETEMPS 256 -#ifndef NOOS -static void UnwindDataAbort (ARMul_State * state, ARMword addr); -static void getstring (ARMul_State * state, ARMword from, char *to); -#endif - /***************************************************************************\ * OS private Information * \***************************************************************************/ @@ -127,9 +123,9 @@ struct OSblock #define FIXCRLF(t,c) c #endif -static ARMword softvectorcode[] = { /* basic: swi tidyexception + event; mov pc, lr; - ldmia r11,{r11,pc}; swi generateexception + event - */ +static ARMword softvectorcode[] = +{ /* basic: swi tidyexception + event; mov pc, lr; + ldmia r11,{r11,pc}; swi generateexception + event. */ 0xef000090, 0xe1a0e00f, 0xe89b8800, 0xef000080, /*Reset */ 0xef000091, 0xe1a0e00f, 0xe89b8800, 0xef000081, /*Undef */ 0xef000092, 0xe1a0e00f, 0xe89b8800, 0xef000082, /*SWI */ @@ -137,8 +133,8 @@ static ARMword softvectorcode[] = { /* basic: swi tidyexception + event; mov pc, 0xef000094, 0xe1a0e00f, 0xe89b8800, 0xef000084, /*Data abort */ 0xef000095, 0xe1a0e00f, 0xe89b8800, 0xef000085, /*Address exception */ 0xef000096, 0xe1a0e00f, 0xe89b8800, 0xef000086, /*IRQ*/ - 0xef000097, 0xe1a0e00f, 0xe89b8800, 0xef000087, /*FIQ*/ - 0xef000098, 0xe1a0e00f, 0xe89b8800, 0xef000088, /*Error */ + 0xef000097, 0xe1a0e00f, 0xe89b8800, 0xef000087, /*FIQ*/ + 0xef000098, 0xe1a0e00f, 0xe89b8800, 0xef000088, /*Error */ 0xe1a0f00e /* default handler */ }; @@ -207,7 +203,7 @@ ARMul_OSInit (ARMul_State * state) ARMul_WriteWord (state, 4, FPENEWVECT (ARMul_ReadWord (state, i - 4))); /* install new vector */ ARMul_ConsolePrint (state, ", FPE"); -/* #endif /* ASIM */ +/* #endif ASIM */ #endif /* VALIDATE */ #endif /* NOOS */ @@ -230,9 +226,6 @@ ARMword ARMul_OSLastErrorP (ARMul_State * state) return ((struct OSblock *) state->OSptr)->ErrorP; } -#if 1 /* CYGNUS LOCAL */ -/* This is the cygnus way of doing it, which makes it simple to do our tests */ - static int translate_open_mode[] = { O_RDONLY, /* "r" */ O_RDONLY + O_BINARY, /* "rb" */ @@ -283,7 +276,7 @@ SWIopen (ARMul_State * state, ARMword name, ARMword SWIflags) int flags; int i; - for (i = 0; dummy[i] = ARMul_ReadByte (state, name + i); i++) + for (i = 0; (dummy[i] = ARMul_ReadByte (state, name + i)); i++) ; /* Now we need to decode the Demon open mode */ @@ -314,7 +307,7 @@ SWIread (ARMul_State * state, ARMword f, ARMword ptr, ARMword len) if (local == NULL) { - fprintf (stderr, "sim: Unable to read 0x%x bytes - out of memory\n", + fprintf (stderr, "sim: Unable to read 0x%ulx bytes - out of memory\n", len); return; } @@ -333,13 +326,13 @@ SWIwrite (ARMul_State * state, ARMword f, ARMword ptr, ARMword len) { struct OSblock *OSptr = (struct OSblock *) state->OSptr; int res; - int i; + ARMword i; char *local = malloc (len); if (local == NULL) { - fprintf (stderr, "sim: Unable to write 0x%x bytes - out of memory\n", - len); + fprintf (stderr, "sim: Unable to write 0x%lx bytes - out of memory\n", + (long) len); return; } @@ -366,13 +359,9 @@ SWIflen (ARMul_State * state, ARMword fh) } addr = lseek (fh, 0, SEEK_CUR); - if (addr < 0) - state->Reg[0] = -1L; - else - { - state->Reg[0] = lseek (fh, 0L, SEEK_END); - (void) lseek (fh, addr, SEEK_SET); - } + + state->Reg[0] = lseek (fh, 0L, SEEK_END); + (void) lseek (fh, addr, SEEK_SET); OSptr->ErrorNo = errno; } @@ -385,9 +374,7 @@ SWIflen (ARMul_State * state, ARMword fh) unsigned ARMul_OSHandleSWI (ARMul_State * state, ARMword number) { - ARMword addr, temp, fildes; - char buffer[BUFFERSIZE], *cptr; - FILE *fptr; + ARMword addr, temp; struct OSblock *OSptr = (struct OSblock *) state->OSptr; switch (number) @@ -562,7 +549,7 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number) else state->Reg[0] = -1; state->Emulate = FALSE; - return (TRUE); + return TRUE; case ADP_Stopped_ApplicationExit: state->Reg[0] = 0; @@ -605,535 +592,6 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number) } } -#else /* CYGNUS LOCAL: #if 1 */ - -unsigned -ARMul_OSHandleSWI (ARMul_State * state, ARMword number) -{ -#ifdef NOOS - return (FALSE); -#else -#ifdef VALIDATE - switch (number) - { - case 0x11: - state->Emulate = FALSE; - return (TRUE); - case 0x01: - if (ARM32BITMODE) - ARMul_SetCPSR (state, (ARMul_GetCPSR (state) & 0xffffffc0) | 0x13); - else - ARMul_SetCPSR (state, (ARMul_GetCPSR (state) & 0xffffffc0) | 0x3); - return (TRUE); - default: - return (FALSE); - } -#else - ARMword addr, temp; - char buffer[BUFFERSIZE], *cptr; - FILE *fptr; - struct OSblock *OSptr = (struct OSblock *) state->OSptr; - - switch (number) - { - case SWI_WriteC: - (void) fputc ((int) state->Reg[0], stderr); - OSptr->ErrorNo = errno; - return (TRUE); - - case SWI_Write0: - addr = state->Reg[0]; - while ((temp = ARMul_ReadByte (state, addr++)) != 0) - fputc ((char) temp, stderr); - OSptr->ErrorNo = errno; - return (TRUE); - - case SWI_ReadC: - state->Reg[0] = (ARMword) fgetc (stdin); - OSptr->ErrorNo = errno; - return (TRUE); - - case SWI_CLI: - addr = state->Reg[0]; - getstring (state, state->Reg[0], buffer); - state->Reg[0] = (ARMword) system (buffer); - OSptr->ErrorNo = errno; - return (TRUE); - - case SWI_GetEnv: - state->Reg[0] = ADDRCMDLINE; - if (state->MemSize) - state->Reg[1] = state->MemSize; - else - state->Reg[1] = ADDRUSERSTACK; - - addr = state->Reg[0]; - cptr = state->CommandLine; - if (cptr == NULL) - cptr = "\0"; - do - { - temp = (ARMword) * cptr++; - ARMul_WriteByte (state, addr++, temp); - } - while (temp != 0); - return (TRUE); - - case SWI_Exit: -#ifdef ASIM - simkernel1_abort_run (); -#else - state->Emulate = FALSE; -#endif - return (TRUE); - - case SWI_EnterOS: - if (ARM32BITMODE) - ARMul_SetCPSR (state, (ARMul_GetCPSR (state) & 0xffffffc0) | 0x13); - else - ARMul_SetCPSR (state, (ARMul_GetCPSR (state) & 0xffffffc0) | 0x3); - return (TRUE); - - case SWI_GetErrno: - state->Reg[0] = OSptr->ErrorNo; - return (TRUE); - - case SWI_Clock: - /* return muber of centi-seconds... */ - state->Reg[0] = -#ifdef CLOCKS_PER_SEC - (CLOCKS_PER_SEC >= 100) - ? (ARMword) (clock () / (CLOCKS_PER_SEC / 100)) - : (ARMword) ((clock () * 100) / CLOCKS_PER_SEC); -#else - /* presume unix... clock() returns microseconds */ - (ARMword) (clock () / 10000); -#endif - OSptr->ErrorNo = errno; - return (TRUE); - - case SWI_Time: - state->Reg[0] = (ARMword) time (NULL); - OSptr->ErrorNo = errno; - return (TRUE); - - case SWI_Remove: - getstring (state, state->Reg[0], buffer); - state->Reg[0] = unlink (buffer); - OSptr->ErrorNo = errno; - return (TRUE); - - case SWI_Rename: - { - char buffer2[BUFFERSIZE]; - - getstring (state, state->Reg[0], buffer); - getstring (state, state->Reg[1], buffer2); - state->Reg[0] = rename (buffer, buffer2); - OSptr->ErrorNo = errno; - return (TRUE); - } - - case SWI_Open: - { -#if 0 - /* It seems to me that these are in the wrong order - sac@cygnus.com, so I've redone it to use the - flags instead, with the functionality which was already - there -- ahh, perhaps the TRUNC bit is in a different - place on the original host ? */ - static char *fmode[] = { "r", "rb", "r+", "r+b", - "w", "wb", "w+", "w+b", - "a", "ab", "a+", "a+b", - "r", "r", "r", "r" - } /* last 4 are illegal */ ; -#endif - - unsigned type; - - type = (unsigned) (state->Reg[1] & 3L); - getstring (state, state->Reg[0], buffer); - if (strcmp (buffer, ":tt") == 0 && (type == O_RDONLY)) /* opening tty "r" */ - fptr = stdin; - else if (strcmp (buffer, ":tt") == 0 && (type == O_WRONLY)) /* opening tty "w" */ - fptr = stderr; - else - { - switch (type) - { - case O_RDONLY: - fptr = fopen (buffer, "r"); - break; - case O_WRONLY: - fptr = fopen (buffer, "w"); - break; - case O_RDWR: - fptr = fopen (buffer, "rw"); - break; - } - } - - state->Reg[0] = 0; - if (fptr != NULL) - { - for (temp = 0; temp < FOPEN_MAX; temp++) - if (OSptr->FileTable[temp] == NULL) - { - OSptr->FileTable[temp] = fptr; - OSptr->FileFlags[temp] = type & 1; /* preserve the binary bit */ - state->Reg[0] = (ARMword) (temp + 1); - break; - } - if (state->Reg[0] == 0) - OSptr->ErrorNo = EMFILE; /* too many open files */ - else - OSptr->ErrorNo = errno; - } - else - OSptr->ErrorNo = errno; - return (TRUE); - } - - case SWI_Close: - temp = state->Reg[0]; - if (temp == 0 || temp > FOPEN_MAX || OSptr->FileTable[temp - 1] == 0) - { - OSptr->ErrorNo = EBADF; - state->Reg[0] = -1L; - return (TRUE); - } - temp--; - fptr = OSptr->FileTable[temp]; - if (fptr == stdin || fptr == stderr) - state->Reg[0] = 0; - else - state->Reg[0] = fclose (fptr); - OSptr->FileTable[temp] = NULL; - OSptr->ErrorNo = errno; - return (TRUE); - - case SWI_Write: - { - unsigned size, upto, type; - char ch; - - temp = state->Reg[0]; - if (temp == 0 || temp > FOPEN_MAX || OSptr->FileTable[temp - 1] == 0) - { - OSptr->ErrorNo = EBADF; - state->Reg[0] = -1L; - return (TRUE); - } - temp--; - fptr = OSptr->FileTable[temp]; - type = OSptr->FileFlags[temp]; - addr = state->Reg[1]; - size = (unsigned) state->Reg[2]; - - if (type & READOP) - fseek (fptr, 0L, SEEK_CUR); - OSptr->FileFlags[temp] = (type & BINARY) | WRITEOP;; - while (size > 0) - { - if (size >= BUFFERSIZE) - upto = BUFFERSIZE; - else - upto = size; - for (cptr = buffer; (cptr - buffer) < upto; cptr++) - { - ch = (char) ARMul_ReadByte (state, (ARMword) addr++); - *cptr = FIXCRLF (type, ch); - } - temp = fwrite (buffer, 1, upto, fptr); - if (temp < upto) - { - state->Reg[0] = (ARMword) (size - temp); - OSptr->ErrorNo = errno; - return (TRUE); - } - size -= upto; - } - state->Reg[0] = 0; - OSptr->ErrorNo = errno; - return (TRUE); - } - - case SWI_Read: - { - unsigned size, upto, type; - char ch; - - temp = state->Reg[0]; - if (temp == 0 || temp > FOPEN_MAX || OSptr->FileTable[temp - 1] == 0) - { - OSptr->ErrorNo = EBADF; - state->Reg[0] = -1L; - return (TRUE); - } - temp--; - fptr = OSptr->FileTable[temp]; - addr = state->Reg[1]; - size = (unsigned) state->Reg[2]; - type = OSptr->FileFlags[temp]; - - if (type & WRITEOP) - fseek (fptr, 0L, SEEK_CUR); - OSptr->FileFlags[temp] = (type & BINARY) | READOP;; - while (size > 0) - { - if (isatty_ (fptr)) - { - upto = (size >= BUFFERSIZE) ? BUFFERSIZE : size + 1; - if (fgets (buffer, upto, fptr) != 0) - temp = strlen (buffer); - else - temp = 0; - upto--; /* 1 char used for terminating null */ - } - else - { - upto = (size >= BUFFERSIZE) ? BUFFERSIZE : size; - temp = fread (buffer, 1, upto, fptr); - } - for (cptr = buffer; (cptr - buffer) < temp; cptr++) - { - ch = *cptr; - ARMul_WriteByte (state, (ARMword) addr++, FIXCRLF (type, ch)); - } - if (temp < upto) - { - state->Reg[0] = (ARMword) (size - temp); - OSptr->ErrorNo = errno; - return (TRUE); - } - size -= upto; - } - state->Reg[0] = 0; - OSptr->ErrorNo = errno; - return (TRUE); - } - - case SWI_Seek: - if (state->Reg[0] == 0 || state->Reg[0] > FOPEN_MAX - || OSptr->FileTable[state->Reg[0] - 1] == 0) - { - OSptr->ErrorNo = EBADF; - state->Reg[0] = -1L; - return (TRUE); - } - fptr = OSptr->FileTable[state->Reg[0] - 1]; - state->Reg[0] = fseek (fptr, (long) state->Reg[1], SEEK_SET); - OSptr->ErrorNo = errno; - return (TRUE); - - case SWI_Flen: - if (state->Reg[0] == 0 || state->Reg[0] > FOPEN_MAX - || OSptr->FileTable[state->Reg[0] - 1] == 0) - { - OSptr->ErrorNo = EBADF; - state->Reg[0] = -1L; - return (TRUE); - } - fptr = OSptr->FileTable[state->Reg[0] - 1]; - addr = (ARMword) ftell (fptr); - if (fseek (fptr, 0L, SEEK_END) < 0) - state->Reg[0] = -1; - else - { - state->Reg[0] = (ARMword) ftell (fptr); - (void) fseek (fptr, addr, SEEK_SET); - } - OSptr->ErrorNo = errno; - return (TRUE); - - case SWI_IsTTY: - if (state->Reg[0] == 0 || state->Reg[0] > FOPEN_MAX - || OSptr->FileTable[state->Reg[0] - 1] == 0) - { - OSptr->ErrorNo = EBADF; - state->Reg[0] = -1L; - return (TRUE); - } - fptr = OSptr->FileTable[state->Reg[0] - 1]; - state->Reg[0] = isatty_ (fptr); - OSptr->ErrorNo = errno; - return (TRUE); - - case SWI_TmpNam: - { - ARMword size; - - addr = state->Reg[0]; - temp = state->Reg[1] & 0xff; - size = state->Reg[2]; - if (OSptr->tempnames[temp] == NULL) - { - if ((OSptr->tempnames[temp] = malloc (L_tmpnam)) == NULL) - { - state->Reg[0] = 0; - return (TRUE); - } - (void) tmpnam (OSptr->tempnames[temp]); - } - cptr = OSptr->tempnames[temp]; - if (strlen (cptr) > state->Reg[2]) - state->Reg[0] = 0; - else - do - { - ARMul_WriteByte (state, addr++, *cptr); - } - while (*cptr++ != 0); - OSptr->ErrorNo = errno; - return (TRUE); - } - - case SWI_InstallHandler: - { - ARMword handlerp = ADDRSOFHANDLERS + state->Reg[0] * 8; - ARMword oldr1 = ARMul_ReadWord (state, handlerp), - oldr2 = ARMul_ReadWord (state, handlerp + 4); - ARMul_WriteWord (state, handlerp, state->Reg[1]); - ARMul_WriteWord (state, handlerp + 4, state->Reg[2]); - state->Reg[1] = oldr1; - state->Reg[2] = oldr2; - return (TRUE); - } - - case SWI_GenerateError: - ARMul_Abort (state, ARMSWIV); - if (state->Emulate) - ARMul_SetR15 (state, - ARMul_ReadWord (state, ADDRSOFTVECTORS + ARMErrorV)); - return (TRUE); - -/* SWI's 0x9x unwind the state of the CPU after an abort of type x */ - - case 0x90: /* Branch through zero */ - { - ARMword oldpsr = ARMul_GetCPSR (state); - ARMul_SetCPSR (state, (oldpsr & 0xffffffc0) | 0x13); - ARMul_SetSPSR (state, SVC32MODE, oldpsr); - state->Reg[14] = 0; - goto TidyCommon; - } - - case 0x98: /* Error */ - { - ARMword errorp = state->Reg[0], regp = state->Reg[1]; - unsigned i; - ARMword errorpsr = ARMul_ReadWord (state, regp + 16 * 4); - for (i = 0; i < 15; i++) - ARMul_SetReg (state, errorpsr, i, - ARMul_ReadWord (state, regp + i * 4L)); - state->Reg[14] = ARMul_ReadWord (state, regp + 15 * 4L); - state->Reg[10] = errorp; - ARMul_SetSPSR (state, state->Mode, errorpsr); - OSptr->ErrorP = errorp; - goto TidyCommon; - } - - case 0x94: /* Data abort */ - { - ARMword addr = state->Reg[14] - 8; - ARMword cpsr = ARMul_GetCPSR (state); - if (ARM26BITMODE) - addr = addr & 0x3fffffc; - ARMul_SetCPSR (state, ARMul_GetSPSR (state, cpsr)); - UnwindDataAbort (state, addr); - if (addr >= FPESTART && addr < FPEEND) - { /* in the FPE */ - ARMword sp, spsr; - unsigned i; - - sp = state->Reg[13]; - state->Reg[13] += 64; /* fix the aborting mode sp */ - state->Reg[14] = ARMul_ReadWord (state, sp + 60); /* and its lr */ - spsr = ARMul_GetSPSR (state, state->Mode); - state->Mode = ARMul_SwitchMode (state, state->Mode, spsr); - for (i = 0; i < 15; i++) - { - ARMul_SetReg (state, spsr, i, ARMul_ReadWord (state, sp)); - sp += 4; - } - ARMul_SetCPSR (state, cpsr); - state->Reg[14] = ARMul_ReadWord (state, sp) + 4; /* botch it */ - ARMul_SetSPSR (state, state->Mode, spsr); - } - else - ARMul_SetCPSR (state, cpsr); - - /* and fall through to correct r14 */ - } - case 0x95: /* Address Exception */ - state->Reg[14] -= 4; - case 0x91: /* Undefined instruction */ - case 0x92: /* SWI */ - case 0x93: /* Prefetch abort */ - case 0x96: /* IRQ */ - case 0x97: /* FIQ */ - state->Reg[14] -= 4; - TidyCommon: - if (state->VectorCatch & (1 << (number - 0x90))) - { - ARMul_SetR15 (state, state->Reg[14] + 8); /* the 8 is the pipelining the the RDI will undo */ - ARMul_SetCPSR (state, ARMul_GetSPSR (state, ARMul_GetCPSR (state))); - if (number == 0x90) - state->EndCondition = 10; /* Branch through Zero Error */ - else - state->EndCondition = (unsigned) number - 0x8f; - state->Emulate = FALSE; - } - else - { - ARMword sp = state->Reg[13]; - ARMul_WriteWord (state, sp - 4, state->Reg[14]); - ARMul_WriteWord (state, sp - 8, state->Reg[12]); - ARMul_WriteWord (state, sp - 12, state->Reg[11]); - ARMul_WriteWord (state, sp - 16, state->Reg[10]); - state->Reg[13] = sp - 16; - state->Reg[11] = ADDRSOFHANDLERS + 8 * (number - 0x90); - } - return (TRUE); - -/* SWI's 0x8x pass an abort of type x to the debugger if a handler returns */ - - case 0x80: - case 0x81: - case 0x82: - case 0x83: - case 0x84: - case 0x85: - case 0x86: - case 0x87: - case 0x88: - { - ARMword sp = state->Reg[13]; - state->Reg[10] = ARMul_ReadWord (state, sp); - state->Reg[11] = ARMul_ReadWord (state, sp + 4); - state->Reg[12] = ARMul_ReadWord (state, sp + 8); - state->Reg[14] = ARMul_ReadWord (state, sp + 12); - state->Reg[13] = sp + 16; - ARMul_SetR15 (state, state->Reg[14] + 8); /* the 8 is the pipelining the the RDI will undo */ - ARMul_SetCPSR (state, ARMul_GetSPSR (state, ARMul_GetCPSR (state))); - if (number == 0x80) - state->EndCondition = 10; /* Branch through Zero Error */ - else - state->EndCondition = (unsigned) number - 0x7f; - state->Emulate = FALSE; - return (TRUE); - } - - default: - state->Emulate = FALSE; - return (FALSE); - } -#endif -#endif -} - -#endif /* CYGNUS LOCAL: #if 1 */ - #ifndef NOOS #ifndef ASIM @@ -1145,64 +603,12 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number) \***************************************************************************/ unsigned -ARMul_OSException (ARMul_State * state, ARMword vector, ARMword pc) +ARMul_OSException (ARMul_State * state ATTRIBUTE_UNUSED, ARMword vector ATTRIBUTE_UNUSED, ARMword pc ATTRIBUTE_UNUSED) { /* don't use this here */ return (FALSE); } #endif -/***************************************************************************\ -* Unwind a data abort * -\***************************************************************************/ - -static void -UnwindDataAbort (ARMul_State * state, ARMword addr) -{ - ARMword instr = ARMul_ReadWord (state, addr); - ARMword rn = BITS (16, 19); - ARMword itype = BITS (24, 27); - ARMword offset; - if (rn == 15) - return; - if (itype == 8 || itype == 9) - { - /* LDM or STM */ - unsigned long regs = BITS (0, 15); - offset = 0; - if (!BIT (21)) - return; /* no wb */ - for (; regs != 0; offset++) - regs ^= (regs & -regs); - if (offset == 0) - offset = 16; - } - else if (itype == 12 || /* post-indexed CPDT */ - (itype == 13 && BIT (21))) - { /* pre_indexed CPDT with WB */ - offset = BITS (0, 7); - } - else - return; - - if (BIT (23)) - state->Reg[rn] -= offset * 4; - else - state->Reg[rn] += offset * 4; -} - -/***************************************************************************\ -* Copy a string from the debuggee's memory to the host's * -\***************************************************************************/ - -static void -getstring (ARMul_State * state, ARMword from, char *to) -{ - do - { - *to = (char) ARMul_ReadByte (state, from++); - } - while (*to++ != '\0'); -} #endif /* NOOS */ diff --git a/sim/arm/armsupp.c b/sim/arm/armsupp.c index 5ffdae9..154d520 100644 --- a/sim/arm/armsupp.c +++ b/sim/arm/armsupp.c @@ -17,6 +17,7 @@ #include "armdefs.h" #include "armemu.h" +#include "ansidecl.h" /***************************************************************************\ * Definitions for the support routines * @@ -33,10 +34,8 @@ void ARMul_SetR15 (ARMul_State * state, ARMword value); ARMword ARMul_GetCPSR (ARMul_State * state); void ARMul_SetCPSR (ARMul_State * state, ARMword value); -void ARMul_FixCPSR (ARMul_State * state, ARMword instr, ARMword rhs); ARMword ARMul_GetSPSR (ARMul_State * state, ARMword mode); void ARMul_SetSPSR (ARMul_State * state, ARMword mode, ARMword value); -void ARMul_FixSPSR (ARMul_State * state, ARMword instr, ARMword rhs); void ARMul_CPSRAltered (ARMul_State * state); void ARMul_R15Altered (ARMul_State * state); @@ -62,7 +61,6 @@ void ARMul_STC (ARMul_State * state, ARMword instr, ARMword address); void ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source); ARMword ARMul_MRC (ARMul_State * state, ARMword instr); void ARMul_CDP (ARMul_State * state, ARMword instr); -void ARMul_UndefInstr (ARMul_State * state, ARMword instr); unsigned IntPending (ARMul_State * state); ARMword ARMul_Align (ARMul_State * state, ARMword address, ARMword data); @@ -417,7 +415,7 @@ ARMul_SwitchMode (ARMul_State * state, ARMword oldmode, ARMword newmode) \***************************************************************************/ static ARMword -ModeToBank (ARMul_State * state, ARMword mode) +ModeToBank (ARMul_State * state ATTRIBUTE_UNUSED, ARMword mode) { static ARMword bankofmode[] = { USERBANK, FIQBANK, IRQBANK, SVCBANK, DUMMYBANK, DUMMYBANK, DUMMYBANK, DUMMYBANK, @@ -740,7 +738,7 @@ ARMul_CDP (ARMul_State * state, ARMword instr) \***************************************************************************/ void -ARMul_UndefInstr (ARMul_State * state, ARMword instr) +ARMul_UndefInstr (ARMul_State * state, ARMword instr ATTRIBUTE_UNUSED) { ARMul_Abort (state, ARMul_UndefinedInstrV); } @@ -778,9 +776,13 @@ IntPending (ARMul_State * state) \***************************************************************************/ ARMword -ARMul_Align (ARMul_State * state, ARMword address, ARMword data) -{ /* this code assumes the address is really unaligned, - as a shift by 32 is undefined in C */ +ARMul_Align (state, address, data) + ARMul_State * state ATTRIBUTE_UNUSED; + ARMword address; + ARMword data; +{ + /* This code assumes the address is really unaligned, + as a shift by 32 is undefined in C. */ address = (address & 3) << 3; /* get the word address */ return ((data >> address) | (data << (32 - address))); /* rot right */ diff --git a/sim/arm/armvirt.c b/sim/arm/armvirt.c index ffcebd2..38f0083 100644 --- a/sim/arm/armvirt.c +++ b/sim/arm/armvirt.c @@ -25,6 +25,7 @@ defined to generate aborts. */ #include "armopts.h" #include "armdefs.h" +#include "ansidecl.h" #ifdef VALIDATE /* for running the validate suite */ #define TUBE 48 * 1024 * 1024 /* write a char on the screen */ @@ -462,7 +463,7 @@ ARMword ARMul_SwapByte (ARMul_State * state, ARMword address, ARMword data) \***************************************************************************/ void -ARMul_Icycles (ARMul_State * state, unsigned number, ARMword address) +ARMul_Icycles (ARMul_State * state, unsigned number, ARMword address ATTRIBUTE_UNUSED) { state->NumIcycles += number; ARMul_CLEARABORT; @@ -473,7 +474,7 @@ ARMul_Icycles (ARMul_State * state, unsigned number, ARMword address) \***************************************************************************/ void -ARMul_Ccycles (ARMul_State * state, unsigned number, ARMword address) +ARMul_Ccycles (ARMul_State * state, unsigned number, ARMword address ATTRIBUTE_UNUSED) { state->NumCcycles += number; ARMul_CLEARABORT; diff --git a/sim/arm/bag.c b/sim/arm/bag.c index ae91ff1..a09d749 100644 --- a/sim/arm/bag.c +++ b/sim/arm/bag.c @@ -25,6 +25,7 @@ /********************************************************************/ #include "bag.h" +#include <stdlib.h> #define HASH_TABLE_SIZE 256 #define hash(x) (((x)&0xff)^(((x)>>8)&0xff)^(((x)>>16)&0xff)^(((x)>>24)&0xff)) @@ -65,8 +66,8 @@ killwholelist (Hashentry * p) } } -void -removefromlist (Hashentry ** p, long first, long second) +static void +removefromlist (Hashentry ** p, long first) { Hashentry *q; @@ -134,8 +135,8 @@ BAG_killpair_byfirst (long first) if (BAG_getsecond (first, &second) == NO_SUCH_PAIR) return NO_SUCH_PAIR; - removefromlist (&lookupbyfirst[hash (first)], first, second); - removefromlist (&lookupbysecond[hash (second)], first, second); + removefromlist (&lookupbyfirst[hash (first)], first); + removefromlist (&lookupbysecond[hash (second)], first); return NO_ERROR; } @@ -146,8 +147,8 @@ BAG_killpair_bysecond (long second) if (BAG_getfirst (&first, second) == NO_SUCH_PAIR) return NO_SUCH_PAIR; - removefromlist (&lookupbyfirst[hash (first)], first, second); - removefromlist (&lookupbysecond[hash (second)], first, second); + removefromlist (&lookupbyfirst[hash (first)], first); + removefromlist (&lookupbysecond[hash (second)], first); return NO_ERROR; } diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index 8ac6f80..396c90d 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdio.h> #include <stdarg.h> +#include <string.h> #include <bfd.h> #include <signal.h> #include "callback.h" @@ -30,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "armdefs.h" #include "armemu.h" #include "dbg_rdi.h" +#include "ansidecl.h" host_callback *sim_callback; @@ -106,14 +108,15 @@ ARMul_ConsolePrint (ARMul_State * state, const char *format, ...) } } -ARMword ARMul_Debug (ARMul_State * state, ARMword pc, ARMword instr) +ARMword +ARMul_Debug (ARMul_State * state ATTRIBUTE_UNUSED, ARMword pc ATTRIBUTE_UNUSED, ARMword instr ATTRIBUTE_UNUSED) { - + return 0; } int sim_write (sd, addr, buffer, size) - SIM_DESC sd; + SIM_DESC sd ATTRIBUTE_UNUSED; SIM_ADDR addr; unsigned char *buffer; int size; @@ -129,7 +132,7 @@ sim_write (sd, addr, buffer, size) int sim_read (sd, addr, buffer, size) - SIM_DESC sd; + SIM_DESC sd ATTRIBUTE_UNUSED; SIM_ADDR addr; unsigned char *buffer; int size; @@ -145,7 +148,7 @@ sim_read (sd, addr, buffer, size) int sim_trace (sd) - SIM_DESC sd; + SIM_DESC sd ATTRIBUTE_UNUSED; { (*sim_callback->printf_filtered) (sim_callback, "This simulator does not support tracing\n"); @@ -154,7 +157,7 @@ sim_trace (sd) int sim_stop (sd) - SIM_DESC sd; + SIM_DESC sd ATTRIBUTE_UNUSED; { state->Emulate = STOP; stop_simulator = 1; @@ -163,8 +166,9 @@ sim_stop (sd) void sim_resume (sd, step, siggnal) - SIM_DESC sd; - int step, siggnal; + SIM_DESC sd ATTRIBUTE_UNUSED; + int step; + int siggnal ATTRIBUTE_UNUSED; { state->EndCondition = 0; stop_simulator = 0; @@ -188,7 +192,7 @@ sim_resume (sd, step, siggnal) SIM_RC sim_create_inferior (sd, abfd, argv, env) - SIM_DESC sd; + SIM_DESC sd ATTRIBUTE_UNUSED; struct _bfd *abfd; char **argv; char **env; @@ -247,7 +251,6 @@ sim_create_inferior (sd, abfd, argv, env) { if (strncmp (*env, "MEMSIZE=", sizeof ("MEMSIZE=") - 1) == 0) { - unsigned long top_of_memory; char *end_of_num; /* Set up memory limit */ @@ -263,8 +266,8 @@ sim_create_inferior (sd, abfd, argv, env) void sim_info (sd, verbose) - SIM_DESC sd; - int verbose; + SIM_DESC sd ATTRIBUTE_UNUSED; + int verbose ATTRIBUTE_UNUSED; { } @@ -311,10 +314,10 @@ tomem (state, memory, val) int sim_store_register (sd, rn, memory, length) - SIM_DESC sd; + SIM_DESC sd ATTRIBUTE_UNUSED; int rn; unsigned char *memory; - int length; + int length ATTRIBUTE_UNUSED; { init (); ARMul_SetReg (state, state->Mode, rn, frommem (state, memory)); @@ -323,10 +326,10 @@ sim_store_register (sd, rn, memory, length) int sim_fetch_register (sd, rn, memory, length) - SIM_DESC sd; + SIM_DESC sd ATTRIBUTE_UNUSED; int rn; unsigned char *memory; - int length; + int length ATTRIBUTE_UNUSED; { ARMword regval; @@ -404,8 +407,8 @@ sim_open (kind, ptr, abfd, argv) void sim_close (sd, quitting) - SIM_DESC sd; - int quitting; + SIM_DESC sd ATTRIBUTE_UNUSED; + int quitting ATTRIBUTE_UNUSED; { /* nothing to do */ } @@ -415,7 +418,7 @@ sim_load (sd, prog, abfd, from_tty) SIM_DESC sd; char *prog; bfd *abfd; - int from_tty; + int from_tty ATTRIBUTE_UNUSED; { extern bfd *sim_load_file (); /* ??? Don't know where this should live. */ bfd *prog_bfd; @@ -432,7 +435,7 @@ sim_load (sd, prog, abfd, from_tty) void sim_stop_reason (sd, reason, sigrc) - SIM_DESC sd; + SIM_DESC sd ATTRIBUTE_UNUSED; enum sim_stop *reason; int *sigrc; { @@ -458,8 +461,8 @@ sim_stop_reason (sd, reason, sigrc) void sim_do_command (sd, cmd) - SIM_DESC sd; - char *cmd; + SIM_DESC sd ATTRIBUTE_UNUSED; + char *cmd ATTRIBUTE_UNUSED; { (*sim_callback->printf_filtered) (sim_callback, "This simulator does not accept any commands.\n"); |