Commit 7f1a8398ab447c9ba2cc0e73935d7c97d6075053

Authored by bellard
1 parent e7b81015

removed unused code


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2080 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 0 additions and 273 deletions
... ... @@ -33,242 +33,6 @@
33 33 #include "vl.h"
34 34 #endif
35 35  
36   -#if defined(__i386__) && !defined(CONFIG_SOFTMMU) && !defined(CONFIG_USER_ONLY)
37   -
38   -#include <sys/mman.h>
39   -#include <sys/ipc.h>
40   -
41   -/* When not using soft mmu, libc independant functions are needed for
42   - the CPU core because it needs to use alternates stacks and
43   - libc/thread incompatibles settings */
44   -
45   -#include <linux/unistd.h>
46   -
47   -#define QEMU_SYSCALL0(name) \
48   -{ \
49   -long __res; \
50   -__asm__ volatile ("int $0x80" \
51   - : "=a" (__res) \
52   - : "0" (__NR_##name)); \
53   -return __res; \
54   -}
55   -
56   -#define QEMU_SYSCALL1(name,arg1) \
57   -{ \
58   -long __res; \
59   -__asm__ volatile ("int $0x80" \
60   - : "=a" (__res) \
61   - : "0" (__NR_##name),"b" ((long)(arg1))); \
62   -return __res; \
63   -}
64   -
65   -#define QEMU_SYSCALL2(name,arg1,arg2) \
66   -{ \
67   -long __res; \
68   -__asm__ volatile ("int $0x80" \
69   - : "=a" (__res) \
70   - : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \
71   -return __res; \
72   -}
73   -
74   -#define QEMU_SYSCALL3(name,arg1,arg2,arg3) \
75   -{ \
76   -long __res; \
77   -__asm__ volatile ("int $0x80" \
78   - : "=a" (__res) \
79   - : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
80   - "d" ((long)(arg3))); \
81   -return __res; \
82   -}
83   -
84   -#define QEMU_SYSCALL4(name,arg1,arg2,arg3,arg4) \
85   -{ \
86   -long __res; \
87   -__asm__ volatile ("int $0x80" \
88   - : "=a" (__res) \
89   - : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
90   - "d" ((long)(arg3)),"S" ((long)(arg4))); \
91   -return __res; \
92   -}
93   -
94   -#define QEMU_SYSCALL5(name,arg1,arg2,arg3,arg4,arg5) \
95   -{ \
96   -long __res; \
97   -__asm__ volatile ("int $0x80" \
98   - : "=a" (__res) \
99   - : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
100   - "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
101   -return __res; \
102   -}
103   -
104   -#define QEMU_SYSCALL6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
105   -{ \
106   -long __res; \
107   -__asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; pop %%ebp" \
108   - : "=a" (__res) \
109   - : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
110   - "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \
111   - "0" ((long)(arg6))); \
112   -return __res; \
113   -}
114   -
115   -/****************************************************************/
116   -/* shmat replacement */
117   -
118   -int qemu_ipc(int call, unsigned long first,
119   - unsigned long second, unsigned long third,
120   - void *ptr, unsigned long fifth)
121   -{
122   - QEMU_SYSCALL6(ipc, call, first, second, third, ptr, fifth);
123   -}
124   -
125   -#define SHMAT 21
126   -
127   -/* we must define shmat so that a specific address will be used when
128   - mapping the X11 ximage */
129   -void *shmat(int shmid, const void *shmaddr, int shmflg)
130   -{
131   - void *ptr;
132   - int ret;
133   - /* we give an address in the right memory area */
134   - if (!shmaddr)
135   - shmaddr = get_mmap_addr(8192 * 1024);
136   - ret = qemu_ipc(SHMAT, shmid, shmflg, (unsigned long)&ptr, (void *)shmaddr, 0);
137   - if (ret < 0)
138   - return NULL;
139   - return ptr;
140   -}
141   -
142   -/****************************************************************/
143   -/* sigaction bypassing the threads */
144   -
145   -static int kernel_sigaction(int signum, const struct qemu_sigaction *act,
146   - struct qemu_sigaction *oldact,
147   - int sigsetsize)
148   -{
149   - QEMU_SYSCALL4(rt_sigaction, signum, act, oldact, sigsetsize);
150   -}
151   -
152   -int qemu_sigaction(int signum, const struct qemu_sigaction *act,
153   - struct qemu_sigaction *oldact)
154   -{
155   - return kernel_sigaction(signum, act, oldact, 8);
156   -}
157   -
158   -/****************************************************************/
159   -/* memory allocation */
160   -
161   -//#define DEBUG_MALLOC
162   -
163   -#define MALLOC_BASE 0xab000000
164   -#define PHYS_RAM_BASE 0xac000000
165   -
166   -#define MALLOC_ALIGN 16
167   -#define BLOCK_HEADER_SIZE 16
168   -
169   -typedef struct MemoryBlock {
170   - struct MemoryBlock *next;
171   - unsigned long size; /* size of block, including header */
172   -} MemoryBlock;
173   -
174   -static MemoryBlock *first_free_block;
175   -static unsigned long malloc_addr = MALLOC_BASE;
176   -
177   -static void *malloc_get_space(size_t size)
178   -{
179   - void *ptr;
180   - size = TARGET_PAGE_ALIGN(size);
181   - ptr = mmap((void *)malloc_addr, size,
182   - PROT_WRITE | PROT_READ,
183   - MAP_PRIVATE | MAP_FIXED | MAP_ANON, -1, 0);
184   - if (ptr == MAP_FAILED)
185   - return NULL;
186   - malloc_addr += size;
187   - return ptr;
188   -}
189   -
190   -void *qemu_malloc(size_t size)
191   -{
192   - MemoryBlock *mb, *mb1, **pmb;
193   - void *ptr;
194   - size_t size1, area_size;
195   -
196   - if (size == 0)
197   - return NULL;
198   -
199   - size = (size + BLOCK_HEADER_SIZE + MALLOC_ALIGN - 1) & ~(MALLOC_ALIGN - 1);
200   - pmb = &first_free_block;
201   - for(;;) {
202   - mb = *pmb;
203   - if (mb == NULL)
204   - break;
205   - if (size <= mb->size)
206   - goto found;
207   - pmb = &mb->next;
208   - }
209   - /* no big enough blocks found: get new space */
210   - area_size = TARGET_PAGE_ALIGN(size);
211   - mb = malloc_get_space(area_size);
212   - if (!mb)
213   - return NULL;
214   - size1 = area_size - size;
215   - if (size1 > 0) {
216   - /* create a new free block */
217   - mb1 = (MemoryBlock *)((uint8_t *)mb + size);
218   - mb1->next = NULL;
219   - mb1->size = size1;
220   - *pmb = mb1;
221   - }
222   - goto the_end;
223   - found:
224   - /* a free block was found: use it */
225   - size1 = mb->size - size;
226   - if (size1 > 0) {
227   - /* create a new free block */
228   - mb1 = (MemoryBlock *)((uint8_t *)mb + size);
229   - mb1->next = mb->next;
230   - mb1->size = size1;
231   - *pmb = mb1;
232   - } else {
233   - /* suppress the first block */
234   - *pmb = mb->next;
235   - }
236   - the_end:
237   - mb->size = size;
238   - mb->next = NULL;
239   - ptr = ((uint8_t *)mb + BLOCK_HEADER_SIZE);
240   -#ifdef DEBUG_MALLOC
241   - qemu_printf("malloc: size=0x%x ptr=0x%lx\n", size, (unsigned long)ptr);
242   -#endif
243   - return ptr;
244   -}
245   -
246   -void qemu_free(void *ptr)
247   -{
248   - MemoryBlock *mb;
249   -
250   - if (!ptr)
251   - return;
252   - mb = (MemoryBlock *)((uint8_t *)ptr - BLOCK_HEADER_SIZE);
253   - mb->next = first_free_block;
254   - first_free_block = mb;
255   -}
256   -
257   -/****************************************************************/
258   -/* virtual memory allocation */
259   -
260   -unsigned long mmap_addr = PHYS_RAM_BASE;
261   -
262   -void *get_mmap_addr(unsigned long size)
263   -{
264   - unsigned long addr;
265   - addr = mmap_addr;
266   - mmap_addr += ((size + 4095) & ~4095) + 4096;
267   - return (void *)addr;
268   -}
269   -
270   -#else
271   -
272 36 #ifdef _WIN32
273 37 #include <windows.h>
274 38 #elif defined(_BSD)
... ... @@ -424,8 +188,6 @@ void qemu_vfree(void *ptr)
424 188  
425 189 #endif
426 190  
427   -#endif
428   -
429 191 void *qemu_mallocz(size_t size)
430 192 {
431 193 void *ptr;
... ...
... ... @@ -15,39 +15,4 @@ void qemu_vfree(void *ptr);
15 15  
16 16 void *get_mmap_addr(unsigned long size);
17 17  
18   -/* specific kludges for OS compatibility (should be moved elsewhere) */
19   -#if defined(__i386__) && !defined(CONFIG_SOFTMMU) && !defined(CONFIG_USER_ONLY)
20   -
21   -/* disabled pthread version of longjmp which prevent us from using an
22   - alternative signal stack */
23   -extern void __longjmp(jmp_buf env, int val);
24   -#define longjmp __longjmp
25   -
26   -#include <signal.h>
27   -
28   -struct siginfo;
29   -
30   -/* NOTE: it works only because the glibc sigset_t is >= kernel sigset_t */
31   -struct qemu_sigaction {
32   - union {
33   - void (*_sa_handler)(int);
34   - void (*_sa_sigaction)(int, struct siginfo *, void *);
35   - } _u;
36   - unsigned long sa_flags;
37   - void (*sa_restorer)(void);
38   - sigset_t sa_mask; /* mask last for extensibility */
39   -};
40   -
41   -int qemu_sigaction(int signum, const struct qemu_sigaction *act,
42   - struct qemu_sigaction *oldact);
43   -
44   -#undef sigaction
45   -#undef sa_handler
46   -#undef sa_sigaction
47   -#define sigaction qemu_sigaction
48   -#define sa_handler _u._sa_handler
49   -#define sa_sigaction _u._sa_sigaction
50   -
51   -#endif
52   -
53 18 #endif
... ...