Do not rely on implicit conversion in syscalls

Message ID 000801d3a181$65878630$30969290$@jasoon.nl
State New
Headers show
Series
  • Do not rely on implicit conversion in syscalls
Related show

Commit Message

Jaap de Wolff Feb. 9, 2018, 8:38 a.m.
When registers are declared without a type they are implicit declared as
int.
It is better not to rely on implicit conversions

Jaap de Wolff

Patch

diff --git a/libgloss/arm/syscalls.c b/libgloss/arm/syscalls.c
index f80615db9..8163c7983 100644
--- a/libgloss/arm/syscalls.c
+++ b/libgloss/arm/syscalls.c
@@ -323,7 +323,7 @@  get_errno (void)
 #ifdef ARM_RDI_MONITOR
   return do_AngelSWI (AngelSWI_Reason_Errno, NULL);
 #else
-  register r0 asm("r0");
+  register int r0 asm("r0");
   asm ("swi %a1" : "=r"(r0) : "i" (SWI_GetErrno));
   return r0;
 #endif
@@ -364,9 +364,9 @@  _swiread (int fh,
   
   return checkerror (do_AngelSWI (AngelSWI_Reason_Read, block));
 #else
-  register r0 asm("r0");
-  register r1 asm("r1");
-  register r2 asm("r2");
+  register int r0 asm("r0");
+  register int r1 asm("r1");
+  register int r2 asm("r2");
   r0 = fh;
   r1 = (int)ptr;
   r2 = len;
@@ -517,9 +517,9 @@  _swiwrite (
   
   return checkerror (do_AngelSWI (AngelSWI_Reason_Write, block));
 #else
-  register r0 asm("r0");
-  register r1 asm("r1");
-  register r2 asm("r2");
+  register int r0 asm("r0");
+  register int r1 asm("r1");
+  register int r2 asm("r2");
   r0 = fh;
   r1 = (int)ptr;
   r2 = len;
@@ -653,7 +653,7 @@  _swiclose (int fh)
 #ifdef ARM_RDI_MONITOR
   return checkerror (do_AngelSWI (AngelSWI_Reason_Close, &fh));
 #else
-  register r0 asm("r0");
+  register int r0 asm("r0");
   r0 = fh;
   asm ("swi %a2" 
        : "=r"(r0) 
@@ -811,7 +811,7 @@  _unlink (const char *path)
   block[1] = strlen(path);
   res = do_AngelSWI (AngelSWI_Reason_Remove, block);
 #else
-  register r0 asm("r0");
+  register int r0 asm("r0");
   r0 = (int)path;
   asm ("swi %a2" 
        : "=r"(r0)
@@ -900,7 +900,7 @@  _isatty (int fd)
 #ifdef ARM_RDI_MONITOR
   tty = do_AngelSWI (AngelSWI_Reason_IsTTY, &pfd->handle);
 #else
-  register r0 asm("r0");
+  register int r0 asm("r0");
   r0 = pfd->handle;
   asm ("swi %a2"
        : "=r" (r0)
@@ -941,7 +941,7 @@  _system (const char *s)
     }
   return e;
 #else
-  register r0 asm("r0");
+  register int r0 asm("r0");
   r0 = (int)s;
   asm ("swi %a2" 
        : "=r" (r0)
@@ -961,8 +961,8 @@  _rename (const char * oldpath, const char * newpath)
   block[3] = strlen(newpath);
   return checkerror (do_AngelSWI (AngelSWI_Reason_Rename, block)) ? -1 : 0;
 #else
-  register r0 asm("r0");
-  register r1 asm("r1");
+  register int r0 asm("r0");
+  register int r1 asm("r1");
   r0 = (int)oldpath;
   r1 = (int)newpath;
   asm ("swi %a3"