3 allocmap, addseg, findseg, addrtoseg,
4 addrtosegafter, removeseg, freemap,
5 get1, get2, get4, get8,
6 put1, put2, put4, put8,
8 locnone, locaddr, locconst, locreg, locindir,
9 loccmp, loceval, locfmt, locsimplify,
10 lget1, lget2, lget4, lget8,
11 lput1, lput2, lput4, lput8 \- machine-independent
12 access to address spaces and register sets
21 .ta \w'\fBxxxxxx'u +\w'xxxxxxx'u
23 typedef struct Map Map;
24 typedef struct Seg Seg;
36 int (*rw)(Map*, Seg*, ulong, void*, uint, int);
51 int addseg(Map *map, Seg seg)
53 int findseg(Map *map, char *name, char *file)
55 int addrtoseg(Map *map, ulong addr, Seg *seg)
57 int addrtosegafter(Map *map, ulong addr, Seg *seg)
59 void removeseg(Map *map, int i)
61 void freemap(Map *map)
64 int get1(Map *map, ulong addr, uchar *a, uint n)
66 int get2(Map *map, ulong addr, u16int *u)
68 int get4(Map *map, ulong addr, u32int *u)
70 int get8(Map *map, ulong addr, u64int *u)
73 int put1(Map *map, ulong addr, uchar *a, uint n)
75 int put2(Map *map, ulong addr, u16int u)
77 int put4(Map *map, ulong addr, u32int u)
79 int put8(Map *map, ulong addr, u64int u)
82 int rget(Regs *regs, char *reg, ulong *u)
84 int fpformat(Map *map, char *reg, char *a, uint n, char code);
87 int rput(Regs *regs, char *name, ulong u)
92 Loc locaddr(ulong addr)
94 Loc locconst(ulong con)
98 Loc locindir(char *reg, long offset)
101 int loccmp(Loc *a, Loc *b)
103 int loceval(Map *map, Loc loc, ulong *addr)
107 int locsimplify(Map *map, Loc *regs, Loc loc, Loc *newloc)
110 int lget1(Map *map, Loc loc, uchar *a, uint n)
112 int lget2(Map *map, Loc loc, u16int *u)
114 int lget4(Map *map, Loc loc, u32int *u)
116 int lget8(Map *map, Loc loc, u64int *u)
119 int lput1(Map *map, Loc loc, uchar *a, uint n)
121 int lput2(Map *map, Loc loc, u16int u)
123 int lput4(Map *map, Loc loc, u32int u)
125 int lput8(Map *map, Loc loc, u64int u)
128 These functions provide
129 a processor-independent interface for accessing
130 executable files, core files, and running processes
133 data structures that provides access to an address space
135 The functions described in
137 are typically used to construct these maps.
138 Related library functions described in
140 provide similar access to symbol tables.
144 comprises an optional register set and one or more
146 each associating a non-overlapping range of
147 memory addresses with a logical section of
148 an executable file or of a running process's address space.
149 Other library functions then use a map
150 and the architecture-specific data structures
151 to provide a generic interface to the
152 processor-dependent data.
154 Each segment has a name (e.g.,
158 and may be associated with a particular file.
159 A segment represents a range of accessible address space.
160 Segments may be backed an arbitary access function
164 or by the contents of an open file
168 Each range has a starting address in the space
173 In segments mapped by files,
174 the range begins at byte
179 function is most commonly used to provide
180 access to executing processes via
182 and to zeroed segments.
185 creates an empty map;
190 adds the given segment to the map, resizing the map's
193 A negative return value indicates an allocation error.
196 returns the index of the segment with the given name (and, if
198 is non-nil, the given file),
199 or \-1 if no such segment is found.
202 returns the index of the segment containing
203 for the given address, or \-1 if that address is not mapped.
204 Segments may have overlapping address ranges:
206 appends segments to the end of the
208 array in the map, and
210 searches the map backwards from the end,
211 so the most recently mapped segment wins.
214 returns the index of the segment containing the lowest mapped
219 removes the segment at the given index.
226 retrieve the data stored at address
228 in the address space associated
234 bytes of data beginning at
242 retrieve 16-bit, 32-bit and 64-bit values respectively,
243 into the location pointed to by
245 The value is byte-swapped if the source
246 byte order differs from that of the current architecture.
247 This implies that the value returned by
252 may not be the same as the byte sequences
257 is two, four or eight; the former may be byte-swapped, the
258 latter reflects the byte order of the target architecture.
259 These functions return the number
260 of bytes read or a \-1 when there is an error.
268 the address space associated with
270 The address is translated using the
271 map parameters and multi-byte quantities are
272 byte-swapped, if necessary, before they are written.
282 write the 16-bit, 32-bit or 64-bit quantity contained in
284 respectively. The number of bytes transferred is returned.
285 A \-1 return value indicates an error.
287 When representing core files or running programs,
288 maps also provide access to the register set.
292 read or write the register
295 If the register is smaller than a
297 the high bits are ignored.
300 converts the contents of a floating-point register to a string.
302 is the address of a buffer of
304 bytes to hold the resulting string.
310 selecting double or single precision, respectively.
315 the contents of the specified register and the
316 following register are interpreted as a double-precision
317 floating-point number;
318 this is meaningful only for architectures that implement
319 double-precision floats by combining adjacent single-precision
324 represents a place in an executing image capable of
326 Note that locations are typically passed by value rather than by reference.
329 returns an unreadable, unwritable location.
331 returns a location representing the memory address
334 returns a location representing the register
337 returns an location representing the memory address
340 added to the value of
343 returns an imaginary unwritable location holding the constant
345 such locations are useful for passing specific constants to
346 functions expect locations, such as
352 compares two locations, returning negative, zero, or positive
355 is less than, equal to, or greater than
358 Register locations are ordered before memory addresses,
359 which are ordered before indirections.
370 Indirection locations are needed in some contexts (e.g., when
374 .IR mach-symbol (3))),
375 but bothersome in most.
377 rewrites indirections as absolute memory addresses, by evaluating
378 the register using the given map and adding the offset.
390 read and write the given locations, using the
396 function families as necessary.
398 .B /usr/local/plan9/src/libmach
406 This man page needs to describe