target-mips: optimize gen_muldiv()
[qemu] / darwin-user / syscall.c
index ab3a7c1..130d33c 100644 (file)
@@ -16,7 +16,8 @@
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ *  MA 02110-1301, USA.
  */
 #include <fcntl.h>
 #include <stdio.h>
@@ -68,7 +69,7 @@
 # define DEBUG_ENABLE_ALL()  static int __DEBUG_qemu_user_force_enable = 1
     DEBUG_ENABLE_ALL();
 
-# define DPRINTF(...) do { if(loglevel) fprintf(logfile, __VA_ARGS__); \
+# define DPRINTF(...) do { qemu_log(__VA_ARGS__); \
                            if(__DEBUG_qemu_user_force_enable) fprintf(stderr, __VA_ARGS__); \
                          } while(0)
 #else
@@ -76,7 +77,7 @@
 # define DEBUG_BEGIN_ENABLE
 # define DEBUG_END_ENABLE
 
-# define DPRINTF(...) do { if(loglevel) fprintf(logfile, __VA_ARGS__); } while(0)
+# define DPRINTF(...) do { qemu_log(__VA_ARGS__); } while(0)
 #endif
 
 enum {
@@ -135,7 +136,7 @@ void static inline print_description_msg_header(mach_msg_header_t *hdr)
         { 4241876,  "lu_message_reply_id" }, /* lookupd */
     };
 
-    for(i = 0; i < sizeof(msg_name)/sizeof(msg_name[0]); i++) {
+    for(i = 0; i < ARRAY_SIZE(msg_name); i++) {
         if(msg_name[i].number == hdr->msgh_id)
         {
             name = msg_name[i].name;
@@ -210,7 +211,7 @@ static inline void print_mach_msg_return(mach_msg_return_t ret)
         DPRINTF("MACH_MSG_SUCCESS\n");
     else
     {
-        for( i = 0; i < sizeof(msg_name)/sizeof(msg_name[0]); i++) {
+        for( i = 0; i < ARRAY_SIZE(msg_name); i++) {
             if(msg_name[i].code == ret) {
                 DPRINTF("%s\n", msg_name[i].name);
                 found = 1;
@@ -417,7 +418,7 @@ long do_mach_syscall(void *cpu_env, int num, uint32_t arg1, uint32_t arg2, uint3
                 uint32_t arg4, uint32_t arg5, uint32_t arg6, uint32_t arg7,
                 uint32_t arg8)
 {
-    extern uint32_t mach_reply_port();
+    extern uint32_t mach_reply_port(void);
 
     long ret = 0;
 
@@ -551,7 +552,7 @@ long do_thread_syscall(void *cpu_env, int num, uint32_t arg1, uint32_t arg2, uin
                 uint32_t arg8)
 {
     extern uint32_t cthread_set_self(uint32_t);
-    extern uint32_t processor_facilities_used();
+    extern uint32_t processor_facilities_used(void);
     long ret = 0;
 
     arg1 = tswap32(arg1);
@@ -654,7 +655,7 @@ typedef struct IOCTLEntry {
 
 #define MAX_STRUCT_SIZE 4096
 
-IOCTLEntry ioctl_entries[] = {
+static IOCTLEntry ioctl_entries[] = {
 #define IOCTL(cmd, access, types...) \
     { cmd, cmd, #cmd, access, { types } },
 #include "ioctls.h"
@@ -830,7 +831,7 @@ static inline void byteswap_timeval(struct timeval *t)
 }
 
 long do_unix_syscall_indirect(void *cpu_env, int num);
-long do_sync();
+long do_sync(void);
 long do_exit(uint32_t arg1);
 long do_getlogin(char *out, uint32_t size);
 long do_open(char * arg1, uint32_t arg2, uint32_t arg3);
@@ -996,7 +997,7 @@ long do_exit(uint32_t arg1)
     return -1;
 }
 
-long do_sync()
+long do_sync(void)
 {
     sync();
     return 0;
@@ -1336,7 +1337,7 @@ static inline long bswap_syctl(int * mib, int count, void *buf, int size)
         if(!(sysctl = sysctl->childs))
             break;
     }
-    
+
     if(ret->childs)
         qerror("we shouldn't have a directory element\n");
 
@@ -1375,7 +1376,7 @@ long do___sysctl(int * name, uint32_t namelen, void * oldp, size_t * oldlenp, vo
         //bswap_syctl(name, namelen, newp, newlen);
         tswap32s((uint32_t*)oldlenp);
     }
-        
+
     if(name) /* Sometimes sysctl is called with no arg1, ignore */
         ret = get_errno(sysctl(name, namelen, oldp, oldlenp, newp, newlen));