Commit 5f6504956066090d81936c1621750b397f444c7b

Authored by Isaku Yamahata
Committed by Anthony Liguori
1 parent 23e0affd

consolidate user cpu_{in, out}[bwl] into ioport-user.c

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Makefile.target
@@ -321,7 +321,8 @@ CFLAGS+=-p @@ -321,7 +321,8 @@ CFLAGS+=-p
321 endif 321 endif
322 322
323 obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \ 323 obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
324 - elfload.o linuxload.o uaccess.o envlist.o gdbstub.o gdbstub-xml.o 324 + elfload.o linuxload.o uaccess.o envlist.o gdbstub.o gdbstub-xml.o \
  325 + ioport-user.o
325 LIBS+= $(PTHREADLIBS) 326 LIBS+= $(PTHREADLIBS)
326 LIBS+= $(CLOCKLIBS) 327 LIBS+= $(CLOCKLIBS)
327 obj-$(TARGET_HAS_BFLT) += flatload.o 328 obj-$(TARGET_HAS_BFLT) += flatload.o
@@ -372,7 +373,7 @@ LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000 @@ -372,7 +373,7 @@ LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
372 LIBS+=-lmx 373 LIBS+=-lmx
373 374
374 obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \ 375 obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \
375 - gdbstub.o gdbstub-xml.o 376 + gdbstub.o gdbstub-xml.o ioport-user.o
376 377
377 # Note: this is a workaround. The real fix is to avoid compiling 378 # Note: this is a workaround. The real fix is to avoid compiling
378 # cpu_signal_handler() in cpu-exec.c. 379 # cpu_signal_handler() in cpu-exec.c.
@@ -471,7 +472,7 @@ endif @@ -471,7 +472,7 @@ endif
471 endif 472 endif
472 473
473 obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \ 474 obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \
474 - gdbstub.o gdbstub-xml.o 475 + gdbstub.o gdbstub-xml.o ioport-user.o
475 obj-y += uaccess.o 476 obj-y += uaccess.o
476 477
477 # Note: this is a workaround. The real fix is to avoid compiling 478 # Note: this is a workaround. The real fix is to avoid compiling
bsd-user/main.c
@@ -55,39 +55,6 @@ void gemu_log(const char *fmt, ...) @@ -55,39 +55,6 @@ void gemu_log(const char *fmt, ...)
55 va_end(ap); 55 va_end(ap);
56 } 56 }
57 57
58 -void cpu_outb(CPUState *env, int addr, int val)  
59 -{  
60 - fprintf(stderr, "outb: port=0x%04x, data=%02x\n", addr, val);  
61 -}  
62 -  
63 -void cpu_outw(CPUState *env, int addr, int val)  
64 -{  
65 - fprintf(stderr, "outw: port=0x%04x, data=%04x\n", addr, val);  
66 -}  
67 -  
68 -void cpu_outl(CPUState *env, int addr, int val)  
69 -{  
70 - fprintf(stderr, "outl: port=0x%04x, data=%08x\n", addr, val);  
71 -}  
72 -  
73 -int cpu_inb(CPUState *env, int addr)  
74 -{  
75 - fprintf(stderr, "inb: port=0x%04x\n", addr);  
76 - return 0;  
77 -}  
78 -  
79 -int cpu_inw(CPUState *env, int addr)  
80 -{  
81 - fprintf(stderr, "inw: port=0x%04x\n", addr);  
82 - return 0;  
83 -}  
84 -  
85 -int cpu_inl(CPUState *env, int addr)  
86 -{  
87 - fprintf(stderr, "inl: port=0x%04x\n", addr);  
88 - return 0;  
89 -}  
90 -  
91 #if defined(TARGET_I386) 58 #if defined(TARGET_I386)
92 int cpu_get_pic_interrupt(CPUState *env) 59 int cpu_get_pic_interrupt(CPUState *env)
93 { 60 {
darwin-user/main.c
@@ -72,39 +72,6 @@ void gemu_log(const char *fmt, ...) @@ -72,39 +72,6 @@ void gemu_log(const char *fmt, ...)
72 va_end(ap); 72 va_end(ap);
73 } 73 }
74 74
75 -void cpu_outb(CPUState *env, int addr, int val)  
76 -{  
77 - fprintf(stderr, "outb: port=0x%04x, data=%02x\n", addr, val);  
78 -}  
79 -  
80 -void cpu_outw(CPUState *env, int addr, int val)  
81 -{  
82 - fprintf(stderr, "outw: port=0x%04x, data=%04x\n", addr, val);  
83 -}  
84 -  
85 -void cpu_outl(CPUState *env, int addr, int val)  
86 -{  
87 - fprintf(stderr, "outl: port=0x%04x, data=%08x\n", addr, val);  
88 -}  
89 -  
90 -int cpu_inb(CPUState *env, int addr)  
91 -{  
92 - fprintf(stderr, "inb: port=0x%04x\n", addr);  
93 - return 0;  
94 -}  
95 -  
96 -int cpu_inw(CPUState *env, int addr)  
97 -{  
98 - fprintf(stderr, "inw: port=0x%04x\n", addr);  
99 - return 0;  
100 -}  
101 -  
102 -int cpu_inl(CPUState *env, int addr)  
103 -{  
104 - fprintf(stderr, "inl: port=0x%04x\n", addr);  
105 - return 0;  
106 -}  
107 -  
108 int cpu_get_pic_interrupt(CPUState *env) 75 int cpu_get_pic_interrupt(CPUState *env)
109 { 76 {
110 return -1; 77 return -1;
ioport-user.c 0 โ†’ 100644
  1 +/*
  2 + * qemu user ioport functions
  3 + *
  4 + * Copyright (c) 2003-2008 Fabrice Bellard
  5 + *
  6 + * This program is free software; you can redistribute it and/or modify
  7 + * it under the terms of the GNU General Public License as published by
  8 + * the Free Software Foundation; either version 2 of the License, or
  9 + * (at your option) any later version.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU General Public License
  17 + * along with this program; if not, write to the Free Software
  18 + * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  19 + * MA 02110-1301, USA.
  20 + */
  21 +
  22 +#include <stdio.h>
  23 +
  24 +#include "qemu.h"
  25 +#include "qemu-common.h"
  26 +#include "ioport.h"
  27 +
  28 +void cpu_outb(CPUState *env, int addr, int val)
  29 +{
  30 + fprintf(stderr, "outb: port=0x%04x, data=%02x\n", addr, val);
  31 +}
  32 +
  33 +void cpu_outw(CPUState *env, int addr, int val)
  34 +{
  35 + fprintf(stderr, "outw: port=0x%04x, data=%04x\n", addr, val);
  36 +}
  37 +
  38 +void cpu_outl(CPUState *env, int addr, int val)
  39 +{
  40 + fprintf(stderr, "outl: port=0x%04x, data=%08x\n", addr, val);
  41 +}
  42 +
  43 +int cpu_inb(CPUState *env, int addr)
  44 +{
  45 + fprintf(stderr, "inb: port=0x%04x\n", addr);
  46 + return 0;
  47 +}
  48 +
  49 +int cpu_inw(CPUState *env, int addr)
  50 +{
  51 + fprintf(stderr, "inw: port=0x%04x\n", addr);
  52 + return 0;
  53 +}
  54 +
  55 +int cpu_inl(CPUState *env, int addr)
  56 +{
  57 + fprintf(stderr, "inl: port=0x%04x\n", addr);
  58 + return 0;
  59 +}
linux-user/main.c
@@ -85,39 +85,6 @@ void gemu_log(const char *fmt, ...) @@ -85,39 +85,6 @@ void gemu_log(const char *fmt, ...)
85 va_end(ap); 85 va_end(ap);
86 } 86 }
87 87
88 -void cpu_outb(CPUState *env, int addr, int val)  
89 -{  
90 - fprintf(stderr, "outb: port=0x%04x, data=%02x\n", addr, val);  
91 -}  
92 -  
93 -void cpu_outw(CPUState *env, int addr, int val)  
94 -{  
95 - fprintf(stderr, "outw: port=0x%04x, data=%04x\n", addr, val);  
96 -}  
97 -  
98 -void cpu_outl(CPUState *env, int addr, int val)  
99 -{  
100 - fprintf(stderr, "outl: port=0x%04x, data=%08x\n", addr, val);  
101 -}  
102 -  
103 -int cpu_inb(CPUState *env, int addr)  
104 -{  
105 - fprintf(stderr, "inb: port=0x%04x\n", addr);  
106 - return 0;  
107 -}  
108 -  
109 -int cpu_inw(CPUState *env, int addr)  
110 -{  
111 - fprintf(stderr, "inw: port=0x%04x\n", addr);  
112 - return 0;  
113 -}  
114 -  
115 -int cpu_inl(CPUState *env, int addr)  
116 -{  
117 - fprintf(stderr, "inl: port=0x%04x\n", addr);  
118 - return 0;  
119 -}  
120 -  
121 #if defined(TARGET_I386) 88 #if defined(TARGET_I386)
122 int cpu_get_pic_interrupt(CPUState *env) 89 int cpu_get_pic_interrupt(CPUState *env)
123 { 90 {
tests/Makefile
@@ -78,9 +78,9 @@ runcom: runcom.c @@ -78,9 +78,9 @@ runcom: runcom.c
78 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< 78 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
79 79
80 # NOTE: -fomit-frame-pointer is currently needed : this is a bug in libqemu 80 # NOTE: -fomit-frame-pointer is currently needed : this is a bug in libqemu
81 -qruncom: qruncom.c ../i386-user/libqemu.a 81 +qruncom: qruncom.c ../ioport-user.c ../i386-user/libqemu.a
82 $(CC) $(CFLAGS) -fomit-frame-pointer $(LDFLAGS) -I../target-i386 -I.. -I../i386-user -I../fpu \ 82 $(CC) $(CFLAGS) -fomit-frame-pointer $(LDFLAGS) -I../target-i386 -I.. -I../i386-user -I../fpu \
83 - -o $@ $< -L../i386-user -lqemu -lm 83 + -o $@ $(filter %.c, $^) -L../i386-user -lqemu -lm
84 84
85 # arm test 85 # arm test
86 hello-arm: hello-arm.o 86 hello-arm: hello-arm.o
tests/qruncom.c
@@ -16,39 +16,6 @@ @@ -16,39 +16,6 @@
16 16
17 //#define SIGTEST 17 //#define SIGTEST
18 18
19 -void cpu_outb(CPUState *env, int addr, int val)  
20 -{  
21 - fprintf(stderr, "outb: port=0x%04x, data=%02x\n", addr, val);  
22 -}  
23 -  
24 -void cpu_outw(CPUState *env, int addr, int val)  
25 -{  
26 - fprintf(stderr, "outw: port=0x%04x, data=%04x\n", addr, val);  
27 -}  
28 -  
29 -void cpu_outl(CPUState *env, int addr, int val)  
30 -{  
31 - fprintf(stderr, "outl: port=0x%04x, data=%08x\n", addr, val);  
32 -}  
33 -  
34 -int cpu_inb(CPUState *env, int addr)  
35 -{  
36 - fprintf(stderr, "inb: port=0x%04x\n", addr);  
37 - return 0;  
38 -}  
39 -  
40 -int cpu_inw(CPUState *env, int addr)  
41 -{  
42 - fprintf(stderr, "inw: port=0x%04x\n", addr);  
43 - return 0;  
44 -}  
45 -  
46 -int cpu_inl(CPUState *env, int addr)  
47 -{  
48 - fprintf(stderr, "inl: port=0x%04x\n", addr);  
49 - return 0;  
50 -}  
51 -  
52 int cpu_get_pic_interrupt(CPUState *env) 19 int cpu_get_pic_interrupt(CPUState *env)
53 { 20 {
54 return -1; 21 return -1;