/[gxemul]/trunk/src/include/misc.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/src/include/misc.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 30 - (hide annotations)
Mon Oct 8 16:20:40 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 5190 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1325 2006/08/15 15:38:37 debug Exp $
20060723	More Transputer instructions (pfix, nfix, opr, mint, ldl, ldlp,
		eqc, rev, ajw, stl, stlf, sthf, sub, ldnl, ldnlp, ldpi, move,
		wcnt, add, bcnt).
		Adding more SPARC instructions (andcc, addcc, bl, rdpr).
		Progress on the igsfb framebuffer used by NetBSD/netwinder.
		Enabling 8-bit fills in dev_fb.
		NetBSD/netwinder 3.0.1 can now run from a disk image :-)
20060724	Cleanup/performance fix for 64-bit virtual translation table
		updates (by removing the "timestamp" stuff). A full NetBSD/pmax
		3.0.1 install for R4400 has dropped from 667 seconds to 584 :)
		Fixing the igsfb "almost vga" color (it is 24-bit, not 18-bit).
		Adding some MIPS instruction combinations (3*lw, and 3*addu).
		The 8048 keyboard now turns off interrupt enable between the
		KBR_ACK and the KBR_RSTDONE, to work better with Linux 2.6.
		Not causing PPC DEC interrupts if PPC_NO_DEC is set for a
		specific CPU; NetBSD/bebox gets slightly further than before.
		Adding some more SPARC instructions: branches, udiv.
20060725	Refreshing dev_pckbc.c a little.
		Cleanups for the SH emulation mode, and adding the first
		"compact" (16-bit) instructions: various simple movs, nop,
		shll, stc, or, ldc.
20060726	Adding dummy "pcn" (AMD PCnet NIC) PCI glue.
20060727	Various cleanups; removing stuff from cpu.h, such as
		running_translated (not really meaningful anymore), and
		page flags (breaking into the debugger clears all translations
		anyway).
		Minor MIPS instruction combination updates.
20060807	Expanding the 3*sw and 3*lw MIPS instruction combinations to
		work with 2* and 4* too, resulting in a minor performance gain.
		Implementing a usleep hack for the RM52xx/MIPS32/MIPS64 "wait"
		instruction (when emulating 1 cpu).
20060808	Experimenting with some more MIPS instruction combinations.
		Implementing support for showing a (hardcoded 12x22) text
		cursor in igsfb.
20060809	Simplifying the NetBSD/evbmips (Malta) install instructions
		somewhat (by using a NetBSD/pmax ramdisk install kernel).
20060812	Experimenting more with the MIPS 'wait' instruction.
		PCI configuration register writes can now be handled, which
		allow PCI IDE controllers to work with NetBSD/Malta 3.0.1 and
		NetBSD/cobalt 3.0.1. (Previously only NetBSD 2.1 worked.)
20060813	Updating dev_gt.c based on numbers from Alec Voropay, to enable
		Linux 2.6 to use PCI on Malta.
		Continuing on Algor interrupt stuff.
20060814	Adding support for routing ISA interrupts to two different
		interrupts, making it possible to run NetBSD/algor :-)
20060814-15	Testing for the release.

==============  RELEASE 0.4.2  ==============


1 dpavlin 4 #ifndef MISC_H
2     #define MISC_H
3    
4     /*
5 dpavlin 24 * Copyright (C) 2003-2006 Anders Gavare. All rights reserved.
6 dpavlin 4 *
7     * Redistribution and use in source and binary forms, with or without
8     * modification, are permitted provided that the following conditions are met:
9     *
10     * 1. Redistributions of source code must retain the above copyright
11     * notice, this list of conditions and the following disclaimer.
12     * 2. Redistributions in binary form must reproduce the above copyright
13     * notice, this list of conditions and the following disclaimer in the
14     * documentation and/or other materials provided with the distribution.
15     * 3. The name of the author may not be used to endorse or promote products
16     * derived from this software without specific prior written permission.
17     *
18     * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19     * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20     * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21     * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22     * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23     * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24     * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25     * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26     * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27     * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28     * SUCH DAMAGE.
29     *
30     *
31 dpavlin 30 * $Id: misc.h,v 1.242 2006/07/25 21:03:25 debug Exp $
32 dpavlin 4 *
33     * Misc. definitions for gxemul.
34     */
35    
36    
37     #include <sys/types.h>
38     #include <inttypes.h>
39    
40     /*
41     * ../../config.h contains #defines set by the configure script. Some of these
42     * might reduce speed of the emulator, so don't enable them unless you
43     * need them.
44     */
45    
46     #include "../../config.h"
47    
48 dpavlin 24
49     #ifdef NO_C99_PRINTF_DEFINES
50     /*
51     * This is a SUPER-UGLY HACK which happens to work on some machines.
52     * The correct solution is to upgrade your compiler to C99.
53 dpavlin 4 */
54 dpavlin 24 #ifdef NO_C99_64BIT_LONGLONG
55     #define PRIi16 "i"
56     #define PRIi32 "i"
57     #define PRIi64 "lli"
58     #define PRIx16 "x"
59     #define PRIx32 "x"
60     #define PRIx64 "llx"
61     #else
62     #define PRIi16 "i"
63     #define PRIi32 "i"
64     #define PRIi64 "li"
65     #define PRIx16 "x"
66     #define PRIx32 "x"
67     #define PRIx64 "lx"
68     #endif
69     #endif
70 dpavlin 4
71    
72     #ifdef NO_MAP_ANON
73     #ifdef mmap
74     #undef mmap
75     #endif
76     #include <fcntl.h>
77     #include <stdlib.h>
78     #include <sys/mman.h>
79     static void *no_map_anon_mmap(void *addr, size_t len, int prot, int flags,
80     int nonsense_fd, off_t offset)
81     {
82     void *p;
83     int fd = open("/dev/zero", O_RDWR);
84     if (fd < 0) {
85     fprintf(stderr, "Could not open /dev/zero\n");
86     exit(1);
87     }
88    
89     printf("addr=%p len=%lli prot=0x%x flags=0x%x nonsense_fd=%i "
90     "offset=%16lli\n", addr, (long long) len, prot, flags,
91     nonsense_fd, (long long) offset);
92    
93     p = mmap(addr, len, prot, flags, fd, offset);
94    
95     printf("p = %p\n", p);
96    
97     /* TODO: Close the descriptor? */
98     return p;
99     }
100     #define mmap no_map_anon_mmap
101     #endif
102    
103    
104     struct cpu;
105     struct emul;
106     struct machine;
107     struct memory;
108    
109    
110     #define NO_BYTE_ORDER_OVERRIDE -1
111     #define EMUL_LITTLE_ENDIAN 0
112     #define EMUL_BIG_ENDIAN 1
113    
114 dpavlin 22 #ifdef HOST_LITTLE_ENDIAN
115 dpavlin 30 #define LE16_TO_HOST(x) (x)
116     #define BE16_TO_HOST(x) ((((x) & 0xff00) >> 8) | (((x)&0xff) << 8))
117     #else
118     #define LE16_TO_HOST(x) ((((x) & 0xff00) >> 8) | (((x)&0xff) << 8))
119     #define BE16_TO_HOST(x) (x)
120     #endif
121    
122     #ifdef HOST_LITTLE_ENDIAN
123 dpavlin 22 #define LE32_TO_HOST(x) (x)
124 dpavlin 30 #define BE32_TO_HOST(x) ((((x) & 0xff000000) >> 24) | (((x)&0xff) << 24) | \
125 dpavlin 22 (((x) & 0xff0000) >> 8) | (((x) & 0xff00) << 8))
126     #else
127 dpavlin 30 #define LE32_TO_HOST(x) ((((x) & 0xff000000) >> 24) | (((x)&0xff) << 24) | \
128 dpavlin 22 (((x) & 0xff0000) >> 8) | (((x) & 0xff00) << 8))
129     #define BE32_TO_HOST(x) (x)
130     #endif
131 dpavlin 4
132 dpavlin 30
133 dpavlin 4 /* Debug stuff: */
134     #define DEBUG_BUFSIZE 1024
135 dpavlin 22 #define DEBUG_INDENTATION 4
136 dpavlin 4
137    
138     /* dec_prom.c: */
139     int decstation_prom_emul(struct cpu *cpu);
140    
141    
142     /* file.c: */
143     int file_n_executables_loaded(void);
144     void file_load(struct machine *machine, struct memory *mem,
145     char *filename, uint64_t *entrypointp,
146     int arch, uint64_t *gpp, int *byte_order, uint64_t *tocp);
147    
148    
149     /* main.c: */
150     void debug_indentation(int diff);
151     void debug(char *fmt, ...);
152     void fatal(char *fmt, ...);
153 dpavlin 10
154    
155     /* misc.c: */
156 dpavlin 4 unsigned long long mystrtoull(const char *s, char **endp, int base);
157 dpavlin 10 int mymkstemp(char *template);
158     #ifdef USE_STRLCPY_REPLACEMENTS
159     size_t mystrlcpy(char *dst, const char *src, size_t size);
160     size_t mystrlcat(char *dst, const char *src, size_t size);
161     #endif
162 dpavlin 4
163    
164     /* pc_bios.c: */
165 dpavlin 6 void pc_bios_simple_pmode_setup(struct cpu *cpu);
166     void pc_bios_init(struct cpu *cpu);
167 dpavlin 4 int pc_bios_emul(struct cpu *cpu);
168    
169    
170     /* ps2_bios.c: */
171     int playstation2_sifbios_emul(struct cpu *cpu);
172    
173    
174     /* useremul.c: */
175     void useremul_setup(struct cpu *, int, char **);
176     void useremul_syscall(struct cpu *cpu, uint32_t code);
177     void useremul_name_to_useremul(struct cpu *, char *name,
178     int *arch, char **machine_name, char **cpu_name);
179     void useremul_list_emuls(void);
180     void useremul_init(void);
181    
182    
183 dpavlin 10 /* yamon.c: */
184     int yamon_emul(struct cpu *cpu);
185    
186    
187 dpavlin 4 #endif /* MISC_H */

  ViewVC Help
Powered by ViewVC 1.1.26