Changeset 32b8506 in rtems for c/src/lib/libbsp/arm/gdbarmsim


Ignore:
Timestamp:
Nov 29, 2009, 2:53:02 PM (10 years ago)
Author:
Ralf Corsepius <ralf.corsepius@…>
Branches:
4.10, 4.11, master
Children:
d4b4664b
Parents:
28352fae
Message:

Whitespace removal.

Location:
c/src/lib/libbsp/arm/gdbarmsim
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/gdbarmsim/start/start.S

    r28352fae r32b8506  
    8181              defintion of .Lstack
    8282            - Provide "hooks" that may be used by the application to add
    83               custom init code - see .Lhwinit and .Lswinit     
     83              custom init code - see .Lhwinit and .Lswinit
    8484            - Go through all execution modes and set up stack for each of them.
    8585              Loosely based on init.s from ARM/Motorola example code.
     
    9292#ifdef __thumb2__
    9393        it      eq
    94 #endif 
     94#endif
    9595        ldreq   r3, .LC0
    9696        /* Note: This 'mov' is essential when starting in User, and ensures we
    97                  always get *some* sp value for the initial mode, even if we 
     97                 always get *some* sp value for the initial mode, even if we
    9898                 have somehow missed it below (in which case it gets the same
    9999                 value as FIQ - not ideal, but better than nothing.) */
     
    108108        mov     sp, r3
    109109        sub     sl, sp, #0x1000 /* This mode also has its own sl (see below) */
    110        
    111         mov     r3, sl 
     110
     111        mov     r3, sl
    112112        msr     CPSR_c, #0xD7   /* Abort mode, interrupts disabled */
    113113        mov     sp, r3
     
    121121        mov     sp, r3
    122122        sub     r3, r3, #0x2000
    123                
     123
    124124        msr     CPSR_c, #0xD3   /* Supervisory mode, interrupts disabled */
    125125
     
    129129        bic     r3, r3, #0xFF00
    130130
    131         str     r3, [r3, #-4]   /* Move value into user mode sp without */ 
    132         ldmdb   r3, {sp}^       /* changing modes, via '^' form of ldm */ 
     131        str     r3, [r3, #-4]   /* Move value into user mode sp without */
     132        ldmdb   r3, {sp}^       /* changing modes, via '^' form of ldm */
    133133        orr     r2, r2, #0xC0   /* Back to original mode, presumably SVC, */
    134134        msr     CPSR_c, r2      /* with FIQ/IRQ disable bits forced to 1 */
    135 #endif 
     135#endif
    136136.LC23:
    137137        /* Setup a default stack-limit in-case the code has been
     
    149149        mov     fp, a2                  /* Null frame pointer */
    150150        mov     r7, a2                  /* Null frame pointer for Thumb */
    151        
     151
    152152        ldr     a1, .LC1                /* First arg: start of memory block */
    153         ldr     a3, .LC2       
     153        ldr     a3, .LC2
    154154        sub     a3, a3, a1              /* Third arg: length of block */
    155        
     155
    156156
    157157#if defined(__thumb__) && !defined(__thumb2__)
     
    163163        .global __change_mode
    164164        .thumb_func
    165 __change_mode: 
    166 #endif
    167        
     165__change_mode:
     166#endif
     167
    168168        bl      FUNCTION (memset)
    169169#if !defined (ARM_RDP_MONITOR) && !defined (ARM_RDI_MONITOR)
     
    181181        mov     pc, r3
    182182#endif
    183 .LC24: 
     183.LC24:
    184184        ldr     r3, .Lswinit
    185185        cmp     r3, #0
     
    192192#endif
    193193
    194 .LC25: 
     194.LC25:
    195195        mov     r0, #0          /*  no arguments  */
    196196        mov     r1, #0          /*  no argv either */
     
    198198        /* Need to set up standard file handles */
    199199        bl      FUNCTION (initialise_monitor_handles)
    200        
     200
    201201#ifdef ARM_RDP_MONITOR
    202202        swi     SWI_GetEnv      /*  sets r0 to point to the command line */
     
    290290        add     r3, #4
    291291        b       .LC15
    292 .LC14: 
     292.LC14:
    293293        /* Ensure doubleword stack alignment.  */
    294294        mov     r4, sp
     
    329329        swi     SWI_Exit
    330330#endif
    331        
    332         /* For Thumb, constants must be after the code since only 
     331
     332        /* For Thumb, constants must be after the code since only
    333333           positive offsets are supported for PC relative addresses.  */
    334        
     334
    335335        .align 0
    336336.LC0:
     
    343343           it points to a non-0 value. Also set up references to "hooks" that
    344344           may be used by the application to provide additional init code. */
    345        
     345
    346346#ifdef __pe__
    347347        .word   0x800000
     
    349349        .word   0x80000                 /* Top of RAM on the PIE board.  */
    350350#endif
    351 .Lstack:       
     351.Lstack:
    352352        .word   __stack
    353 .Lhwinit:       
     353.Lhwinit:
    354354        .word   FUNCTION (hardware_init_hook)
    355355.Lswinit:
     
    361361           does not provide the symbols. (The linker uses a weak symbol if,
    362362           and only if, a normal version of the same symbol isn't provided
    363            e.g. by a linker script or another object file.) */ 
     363           e.g. by a linker script or another object file.) */
    364364
    365365        .weak __stack
    366         .weak FUNCTION (hardware_init_hook) 
     366        .weak FUNCTION (hardware_init_hook)
    367367        .weak FUNCTION (software_init_hook)
    368368#endif
    369        
     369
    370370#endif
    371371#if defined(__ELF__) && !defined(__USING_SJLJ_EXCEPTIONS__)
     
    397397CommandLine:    .space  256,0   /*  Maximum length of 255 chars handled.  */
    398398#endif
    399        
     399
    400400#ifdef __pe__
    401401        .section .idata$3
  • c/src/lib/libbsp/arm/gdbarmsim/startup/syscalls.c

    r28352fae r32b8506  
    6565#define MAX_OPEN_FILES 20
    6666
    67 /* User file descriptors (fd) are integer indexes into 
     67/* User file descriptors (fd) are integer indexes into
    6868   the openfiles[] array. Error checking is done by using
    69    findslot(). 
    70 
    71    This openfiles array is manipulated directly by only 
     69   findslot().
     70
     71   This openfiles array is manipulated directly by only
    7272   these 5 functions:
    7373
     
    104104
    105105/* Return a pointer to the structure associated with
    106    the user file descriptor fd. */ 
     106   the user file descriptor fd. */
    107107static struct fdent*
    108108findslot (int fd)
     
    122122}
    123123
    124 /* Return the next lowest numbered free file 
    125    structure, or -1 if we can't find one. */ 
     124/* Return the next lowest numbered free file
     125   structure, or -1 if we can't find one. */
    126126static int
    127127newslot (void)
     
    143143{
    144144  int i;
    145  
     145
    146146  /* Open the standard file descriptors by opening the special
    147147   * teletype device, ":tt", read-only to obtain a descritpor for
     
    156156#ifdef ARM_RDI_MONITOR
    157157  int volatile block[3];
    158  
     158
    159159  block[0] = (int) ":tt";
    160160  block[2] = 3;     /* length of filename */
     
    243243/* fh, is a valid internal file handle.
    244244   ptr, is a null terminated string.
    245    len, is the length in bytes to read. 
     245   len, is the length in bytes to read.
    246246   Returns the number of bytes *not* written. */
    247247int
     
    252252#ifdef ARM_RDI_MONITOR
    253253  int block[3];
    254  
     254
    255255  block[0] = fh;
    256256  block[1] = (int) ptr;
    257257  block[2] = len;
    258  
     258
    259259  return checkerror (do_AngelSWI (AngelSWI_Reason_Read, block));
    260260#else
     
    272272}
    273273
    274 /* fd, is a valid user file handle. 
     274/* fd, is a valid user file handle.
    275275   Translates the return of _swiread into
    276276   bytes read. */
     
    297297  pfd->pos += len - res;
    298298
    299   /* res == len is not an error, 
     299  /* res == len is not an error,
    300300     at least if we want feof() to work.  */
    301301  return len - res;
     
    342342      dir = SEEK_SET;
    343343    }
    344  
     344
    345345#ifdef ARM_RDI_MONITOR
    346346  int block[2];
     
    353353      ptr += res;
    354354    }
    355  
     355
    356356  /* This code only does absolute seeks.  */
    357357  block[0] = pfd->handle;
     
    406406#ifdef ARM_RDI_MONITOR
    407407  int block[3];
    408  
     408
    409409  block[0] = fh;
    410410  block[1] = (int) ptr;
    411411  block[2] = len;
    412  
     412
    413413  return checkerror (do_AngelSWI (AngelSWI_Reason_Write, block));
    414414#else
     
    450450  pfd->pos += len - res;
    451451
    452   /* We wrote 0 bytes? 
     452  /* We wrote 0 bytes?
    453453     Retrieve errno just in case. */
    454454  if ((len - res) == 0)
    455455    return error (0);
    456  
     456
    457457  return (len - res);
    458458}
     
    465465  int block[3];
    466466#endif
    467  
     467
    468468  int fd = newslot ();
    469469
     
    473473      return -1;
    474474    }
    475  
     475
    476476  /* It is an error to open a file that already exists. */
    477   if ((flags & O_CREAT) 
     477  if ((flags & O_CREAT)
    478478      && (flags & O_EXCL))
    479479    {
     
    488488    }
    489489
    490   /* The flags are Unix-style, so we need to convert them. */ 
     490  /* The flags are Unix-style, so we need to convert them. */
    491491#ifdef O_BINARY
    492492  if (flags & O_BINARY)
    493493    aflags |= 1;
    494494#endif
    495  
     495
    496496  /* In O_RDONLY we expect aflags == 0. */
    497497
    498   if (flags & O_RDWR) 
     498  if (flags & O_RDWR)
    499499    aflags |= 2;
    500500
     
    510510      aflags |= 8;
    511511    }
    512  
     512
    513513#ifdef ARM_RDI_MONITOR
    514514  block[0] = (int) path;
    515515  block[2] = strlen (path);
    516516  block[1] = aflags;
    517  
     517
    518518  fh = do_AngelSWI (AngelSWI_Reason_Open, block);
    519  
     519
    520520#else
    521521  asm ("mov r0,%2; mov r1, %3; swi %a1; mov %0, r0"
     
    524524       : "r0","r1");
    525525#endif
    526  
     526
    527527  /* Return a user file descriptor or an error. */
    528528  if (fh >= 0)
     
    551551  register int r0 asm("r0");
    552552  r0 = fh;
    553   asm ("swi %a2" 
    554        : "=r"(r0) 
     553  asm ("swi %a2"
     554       : "=r"(r0)
    555555       : "0"(r0), "i" (SWI_Close));
    556556  return checkerror (r0);
     
    606606  if (heap_end == NULL)
    607607    heap_end = & end;
    608  
     608
    609609  prev_heap_end = heap_end;
    610  
     610
    611611  if (heap_end + incr > stack_ptr)
    612612    {
     
    617617
    618618      _write (1, "_sbrk: Heap and stack collision\n", 32);
    619      
     619
    620620      abort ();
    621621#else
     
    624624#endif
    625625    }
    626  
     626
    627627  heap_end += incr;
    628628
     
    631631#endif
    632632
    633 int 
     633int
    634634_swistat (int fd, struct stat * st)
    635635{
     
    676676  int fd, res;
    677677  memset (st, 0, sizeof (* st));
    678   /* The best we can do is try to open the file readonly. 
     678  /* The best we can do is try to open the file readonly.
    679679     If it exists, then we can guess a few things about it. */
    680680  if ((fd = _open (fname, O_RDONLY)) == -1)
     
    683683  res = _swistat (fd, st);
    684684  /* Not interested in the error. */
    685   _close (fd); 
     685  _close (fd);
    686686  return res;
    687687}
     
    706706  register int r0 asm("r0");
    707707  r0 = (int)path;
    708   asm ("swi %a2" 
     708  asm ("swi %a2"
    709709       : "=r"(r0)
    710710       : "0"(r0), "i" (SWI_Remove));
    711711  res = r0;
    712712#endif
    713   if (res == -1) 
     713  if (res == -1)
    714714    return error (res);
    715715  return 0;
     
    748748
    749749/* Return a clock that ticks at 100Hz.  */
    750 clock_t 
     750clock_t
    751751_clock (void)
    752752{
     
    774774      tp->tms_cstime = 0;       /* system time, children */
    775775    }
    776  
     776
    777777  return timeval;
    778778};
     
    832832  register int r0 asm("r0");
    833833  r0 = (int)s;
    834   asm ("swi %a2" 
     834  asm ("swi %a2"
    835835       : "=r" (r0)
    836836       : "0"(r0), "i" (SWI_CLI));
     
    854854  r0 = (int)oldpath;
    855855  r1 = (int)newpath;
    856   asm ("swi %a3" 
     856  asm ("swi %a3"
    857857       : "=r" (r0)
    858858       : "0" (r0), "r" (r1), "i" (SWI_Rename));
Note: See TracChangeset for help on using the changeset viewer.