/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (show annotations)
Mon Oct 8 16:18:27 2007 UTC (16 years, 5 months ago) by dpavlin
File MIME type: text/plain
File size: 4467 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.815 2005/06/27 23:04:35 debug Exp $
20050617	Experimenting some more with netbooting OpenBSD/sgi. Adding
		a hack which allows emulated ethernet networks to be
		distributed across multiple emulator processes.
20050618	Minor updates (documentation, dummy YAMON emulation, etc).
20050620	strcpy/strcat -> strlcpy/strlcat updates.
		Some more progress on evbmips (Malta).
20050621	Adding a section to doc/configfiles.html about ethernet
		emulation across multiple hosts.
		Beginning the work on the ARM translation engine (using the
		dynamic-but-not-binary translation method).
		Fixing a bintrans bug: 0x9fc00000 should always be treated as
		PROM area, just as 0xbfc00000 is.
		Minor progress on Malta emulation (the PCI-ISA bus).
20050622	NetBSD/evbmips can now be installed (using another emulated
		machine) and run (including userland and so on). :-)
		Spliting up the bintrans haddr_entry field into two (one for
		read, one for write). Probably not much of a speed increase,
		though.
		Updating some NetBSD 2.0 -> 2.0.2 in the documentation.
20050623	Minor updates (documentation, the TODO file, etc).
		gzipped kernels are now always automagically gunzipped when
		loaded.
20050624	Adding a dummy Playstation Portable (PSP) mode, just barely
		enough to run Hello World (in weird colors :-).
		Removing the -b command line option; old bintrans is enabled
		by default instead. It makes more sense.
		Trying to finally fix the non-working performance measurement
		thing (instr/second etc).
20050625	Continuing on the essential basics for ARM emulation. Two
		instructions seem to work, a branch and a simple "mov". (The
		mov arguments are not correct yet.) Performance is definitely
		reasonable.
		Various other minor updates.
		Adding the ARM "bl" instruction.
		Adding support for combining multiple ARM instructions into one
		function call. ("mov" + "mov" is the only one implemented so
		far, but it seems to work.)
		Cleaning up some IP32 interrupt things (crime/mace); disabling
		the PS/2 keyboard controller on IP32, so that NetBSD/sgimips
		boots into userland again.
20050626	Finally! NetBSD/sgimips netboots. Adding instructions to
		doc/guestoses.html on how to set up an nfs server etc.
		Various other minor fixes.
		Playstation Portable ".pbp" files can now be used directly.
		(The ELF part of the .pbp is extracted transparently.)
		Converting some sprintf -> snprintf.
		Adding some more instructions to the ARM disassembler.
20050627	More ARM updates. Adding some simple ldr(b), str(b),
		cmps, and conditional branch instructions, enough to run
		a simple Hello World program.
		All ARM instructions are now inlined/generated for all possible
		condition codes.
		Adding add and sub, and more load/store instructions.
		Removing dummy files: cpu_alpha.c, cpu_hppa.c, and cpu_sparc.c.
		Some minor documentation updates; preparing for a 0.3.4
		release. Updating some URLs.

==============  RELEASE 0.3.4  ==============


1 #ifndef MISC_H
2 #define MISC_H
3
4 /*
5 * Copyright (C) 2003-2005 Anders Gavare. All rights reserved.
6 *
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 * $Id: misc.h,v 1.233 2005/06/20 05:52:49 debug Exp $
32 *
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 /*
49 * ENABLE_INSTRUCTION_DELAYS should be defined on the cc commandline using
50 * -D if you want it. (This is done by ./configure --delays)
51 *
52 * ALWAYS_SIGNEXTEND_32 is enabled by ./configure --always32
53 */
54 #define USE_TINY_CACHE
55 /* #define HALT_IF_PC_ZERO */
56
57
58 #ifdef NO_MAP_ANON
59 #ifdef mmap
60 #undef mmap
61 #endif
62 #include <fcntl.h>
63 #include <stdlib.h>
64 #include <sys/mman.h>
65 static void *no_map_anon_mmap(void *addr, size_t len, int prot, int flags,
66 int nonsense_fd, off_t offset)
67 {
68 void *p;
69 int fd = open("/dev/zero", O_RDWR);
70 if (fd < 0) {
71 fprintf(stderr, "Could not open /dev/zero\n");
72 exit(1);
73 }
74
75 printf("addr=%p len=%lli prot=0x%x flags=0x%x nonsense_fd=%i "
76 "offset=%16lli\n", addr, (long long) len, prot, flags,
77 nonsense_fd, (long long) offset);
78
79 p = mmap(addr, len, prot, flags, fd, offset);
80
81 printf("p = %p\n", p);
82
83 /* TODO: Close the descriptor? */
84 return p;
85 }
86 #define mmap no_map_anon_mmap
87 #endif
88
89
90 struct cpu;
91 struct emul;
92 struct machine;
93 struct memory;
94
95
96 #define NO_BYTE_ORDER_OVERRIDE -1
97 #define EMUL_LITTLE_ENDIAN 0
98 #define EMUL_BIG_ENDIAN 1
99
100
101 /* Debug stuff: */
102 #define DEBUG_BUFSIZE 1024
103
104 #ifndef DEFAULT_BINTRANS_SIZE_IN_MB
105 #define DEFAULT_BINTRANS_SIZE_IN_MB 16
106 #endif
107
108
109 /* dec_prom.c: */
110 int decstation_prom_emul(struct cpu *cpu);
111
112
113 /* file.c: */
114 int file_n_executables_loaded(void);
115 void file_load(struct machine *machine, struct memory *mem,
116 char *filename, uint64_t *entrypointp,
117 int arch, uint64_t *gpp, int *byte_order, uint64_t *tocp);
118
119
120 /* main.c: */
121 void debug_indentation(int diff);
122 void debug(char *fmt, ...);
123 void fatal(char *fmt, ...);
124
125
126 /* misc.c: */
127 unsigned long long mystrtoull(const char *s, char **endp, int base);
128 int mymkstemp(char *template);
129 #ifdef USE_STRLCPY_REPLACEMENTS
130 size_t mystrlcpy(char *dst, const char *src, size_t size);
131 size_t mystrlcat(char *dst, const char *src, size_t size);
132 #endif
133
134
135 /* of.c: */
136 int of_emul(struct cpu *cpu);
137
138
139 /* pc_bios.c: */
140 void pc_bios_simple_pmode_setup(struct cpu *cpu);
141 void pc_bios_init(struct cpu *cpu);
142 int pc_bios_emul(struct cpu *cpu);
143
144
145 /* ps2_bios.c: */
146 int playstation2_sifbios_emul(struct cpu *cpu);
147
148
149 /* useremul.c: */
150 void useremul_setup(struct cpu *, int, char **);
151 void useremul_syscall(struct cpu *cpu, uint32_t code);
152 void useremul_name_to_useremul(struct cpu *, char *name,
153 int *arch, char **machine_name, char **cpu_name);
154 void useremul_list_emuls(void);
155 void useremul_init(void);
156
157
158 /* yamon.c: */
159 int yamon_emul(struct cpu *cpu);
160
161
162 #endif /* MISC_H */

  ViewVC Help
Powered by ViewVC 1.1.26