4.3 Addressing
Addresses are used in LDP commands to refer to memory locations, processes, buffers, breakpoints and other entities. Many of these entities are machine-dependent; some machines have named objects, some machines have multiple address spaces, the size of address spaces varies, etc. The format for specifying addresses needs to be general enough to handle all of these cases. This speaks for a large, hierarchically structured address format. However, the disadvantage of a large format is that it imposes extra overhead on communication with targets that have simpler address schemes.
LDP resolves this conflict by employing two address formats: a short three-word format for addressing simpler targets, and a long five-word format for others. Each target LDP is required to implement at least one of these formats. At the start of an LDP session, the target specifies the address format(s) it uses in the Flag field of the HELLO_REPLY message. In each address, the first bit of the mode octet is a format flag: 0 indicates LONG address format, and 1 indicates SHORT format.
4.3.1 Long Address Format
The long address format is five words long and consists of a three-word address descriptor and a two-word offset (see Figure 9). The descriptor specifies an address space to which the offset is applied. The descriptor is subdivided into several fields, as described below. The structuring of the descriptor is designed to support complex addressing modes. For example, on targets with multiple processes, descriptors may reference virtual addresses, registers, and other entities within a particular process.
The addressing modes defined below are intended as a base to which target-specific modes may be added. Modes up to 63. are reserved by the protocol. The range 64. to 127. may be used for target-specific address modes.
Long Format - Format bit is LONG=0
0 0 0 1 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-------------------------------+ +-+
|0| Mode | Mode Arg | |
+-------------------------------+ |
| (31-16) | | Descriptor
+---- ID ---+ |
| (15-0) | |
+-------------------------------+ +-+
| (31-16) | |
+---- Offset ---+ | Offset
| (15-0) | |
+-------------------------------+ +-+
Long Address Format
Figure 9
LONG ADDRESS FIELDS:
Mode
The address mode identifies the type of address space being referenced. The mode is qualified by the mode argument and the ID field. Implementation of modes other than physical and host is machine-dependent. Currently defined modes and the address space they reference are shown in Figure 10.
Mode | Symbol | Address space
-----+----------------------+---------------------------
0 HOST Host
1 PHYS_MACRO Macromemory
2 PHYS_MICRO Micromemory
3 PHYS_I/O I/O space
4 PHYS_MACRO_PTR Macro contains a pointer
5 PHYS_REG Register
6 PHYS_REG_OFFSET Register plus offset
7 PHYS_REG_INDIRECT Register contains address
of a pointer
8 PROCESS_CODE Process code space
9 PROCESS_DATA Process data space
10 PROCESS_DATA_PTR Process data contains a ptr
11 PROCESS_REG Process virtual register
12 PROCESS_REG_OFFSET Process register plus offset
13 PROCESS_REG_INDIRECT Process register contains
address of a pointer
14 OBJECT_OFFSET Memory object (queue, pool)
15 OBJECT_HEADER System header for an object
16 BREAKPOINT Breakpoint
17 WATCHPOINT Watchpoint
18 BPT_PTR_OFFSET Breakpoint ptr plus offset
19 BPT_PTR_INDIRECT Breakpoint ptr plus offset
gives address of a pointer
20 - <reserved>
63
Long Address Modes
Figure 10
Mode Argument
Provides a numeric argument to the mode field. Specifies the register in physical and process REG and REG_OFFSET modes.
ID Field
Identifies a particular process, buffer or object.
Offset
The offset into the linear address space defined by the mode. The size of the machine word determines the number of significant bits in the offset. Likewise, the addressing units of the target are the units of the offset.
The interpretation of the mode argument, ID field and offset for each address mode is given below:
HOST
The ID and offset fields are numbers assigned arbitrarily by the host side of the debugger. These numbers are used in MOVE and MOVE_DATA messages. MOVE_DATA responses containing this mode as the destination are sent by the target to the host. This may occur in debugging when data is sent to the host from the target breakpoint.
PHYS_MACRO
The offset contains the 32-bit physical address of a location in macromemory. The mode argument and ID field are not used. For example, mode=PHYS_MACRO and offset=1000 specifies location 1000 in physical memory.
PHYS_MICRO
Like PHYS_MACRO, but the location is in micromemory.
PHYS_I/O
Like PHYS_MACRO, but the location is in I/O space.
PHYS_MACRO_PTR
The offset contains the address of a pointer in macromemory. The location pointed to (the effective address) is also in macromemory. The mode argument and ID field are unused.
PHYS_REG
The mode argument gives the physical register. If the register is used by the LDP target process, then the saved copy from the previous context is used. This comment applies to PHYS_REG_OFFSET mode as well. The ID field is not used.
PHYS_REG_OFFSET
The offset is added to the contents of a register given as the mode argument. The result is used as a physical address in macromemory. ID is unused.
PHYS_REG_INDIRECT
The register specified in the mode arg contains the address of a pointer in macromemory. The effective address is the macromemory location specified in the pointer, plus the offset. The ID field is unused.
PROCESS_CODE
The ID is a process ID, the offset is into the code space for this process. Mode argument is not used.
PROCESS_DATA
The ID is a process ID, the offset is into the data space for this process. Mode argument is not used. On systems that do not distinguish between code and data space, these two modes are equivalent, and reference the virtual address space of the process.
PROCESS_DATA_PTR
The offset contains the address of a pointer in the data space of the process specified by the ID. The location pointed to (the effective address) is also in the data space. The mode argument is not used.
PROCESS_REG
Accesses the registers (and other system data) of the process given by the ID field. Mode argument 0 starts the registers. After the registers, the mode argument is an offset into the system area for the process.
PROCESS_REG_OFFSET
The offset plus the contents of the register given in the mode argument specifies a location in the data space of the process specified by the ID.
PROCESS_REG_INDIRECT
The register specified in the mode arg contains the address of a pointer in the data space of the process given by the ID. The effective address is the location in process data space specified in the pointer, plus the offset.
OBJECT_OFFSET (optional)
The offset is into the memory space defined by the object ID in ID. Recommended for remote control of parameter segments.
OBJECT_HEADER (optional)
The offset is into the system header for the object specified by the ID. Intended for use with the Butterfly.
BREAKPOINT
The descriptor specifies a breakpoint. The offset is never used, this type is only used in descriptors referring to breakpoints. (See Breakpoints and Watchpoints, below, for an explanation of breakpoint descriptors.)
WATCHPOINT
The descriptor specifies a watchpoint. The offset is never used, this type is only used in descriptors referring to watchpoints. (See Breakpoints and Watchpoints, below, for an explanation of watchpoint descriptors).
BPT_PTR_OFFSET
For this mode and BPT_PTR_INDIRECT, the mode argument specifies one of two breakpoint pointer variables local to the breakpoint in which this address occurs. These pointers and the SET_PTR command which manipulates them provide for an arbitrary amount of address indirection. They are intended for use in traversing data structures: for example, chasing queues. In BPT_PTR_OFFSET, the offset is added to the pointer variable to give the effective address. In targets which support multiple processes, the location is in the data space of the process given by the ID. Otherwise, the location is a physical address in macro-memory. BPT_PTR.* modes are valid only in breakpoints and watchpoints.
BPT_PTR_INDIRECT
Like BPT_PTR_OFFSET, except that it uses one more level of indirection. The pointer variable given by the mode argument plus the offset specify an address which points to the effective address. See the description of BPT_PTR_OFFSET for a discussion of usage, limitations and address space.
4.3.2 Short Address Format
The short address format is intended for use in implementations where protocol overhead must be minimized. This format is a subset of the long address format: it contains the same fields except for the ID field. Therefore, the short addressing format supports only HOST and PHYS_* address modes. Only the LOADER_DUMPER implementation level commands may be used with the short addressing format. The short address format is three words long, consisting of a 16-bit word describing the address space, and a 32-bit offset.
Short Format - Format bit is SHORT=1
0 0 0 1 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-------------------------------+
|1| Mode | Mode Argument |
+-------------------------------+ +-+
| (31-16) | |
+---- Offset ---+ | Offset
| (15-0) | |
+-------------------------------+ +-+
Short Address Format
Figure 11
SHORT ADDRESS FIELDS:
Mode
The high-order bit is 1, indicating the short address format. A list of the address modes supported is given below. The interpretation of the remaining fields is as described above for the long addressing format.
Mode | Symbol | Address space
-----+--------------------+---------------------------
0 HOST Host
1 PHYS_MACRO Macro-memory
2 PHYS_MICRO Micro-memory
3 PHYS_I/O I/O space
4 PHYS_MACRO_PTR Macro contains a pointer
5 PHYS_REG Register
6 PHYS_REG_OFFSET Register plus offset
7 PHYS_REG_INDIRECT Register contains address
of a pointer
8 -
32 <reserved>
Short Address Modes
Figure 12