4 * (C) Copyright 1989-1995
12 * - errdmp: show s_id as string rather than array [NCPS]
13 * - relr: add support for 11 bit 8051 addressing
14 * 02-Apr-98 JLH: don't output empty hex records
23 * The module lkrloc.c contains the functions which
24 * perform the relocation calculations.
26 * lkrloc.c contains the following functions:
45 * lkrloc.c the local variable errmsg[].
49 /* Global which holds the upper 16 bits of the last 32 bit area adress
50 * output. Useful only for iHex mode.
52 int lastExtendedAddress=-1;
54 /* Static variable which holds the index of last processed area.
55 * Useful only for iHex mode.
57 static int lastAreaIndex = -1;
59 /*)Function VOID reloc(c)
63 * The function reloc() calls a particular relocation
64 * function determined by the process code.
70 * int lkerr error flag
73 * int fprintf() c_library
74 * VOID rele() lkrloc.c
75 * VOID relp() lkrloc.c
76 * VOID relr() lkrloc.c
77 * VOId relt() lkrloc.c
80 * Refer to the called relocation functions.
107 fprintf(stderr, "Undefined Relocation Operation\n");
115 /*)Function VOID relt()
117 * The function relt() evaluates a T line read by
118 * the linker. Each byte value read is saved in the
119 * rtval[] array, rtflg[] is set, and the number of
120 * evaluations is maintained in rtcnt.
124 * T xx xx nn nn nn nn nn ...
127 * In: "T n0 n1 n2 n3 ... nn"
129 * Out: 0 1 2 .. rtcnt
130 * +----+----+----+----+----+
131 * rtval | n0 | n1 | n2 | .. | nn |
132 * +----+----+----+----+----+
133 * rtflag| 1 | 1 | 1 | 1 | 1 |
134 * +----+----+----+----+----+
136 * The T line contains the assembled code output by the assem-
137 * bler with xx xx being the offset address from the current area
138 * base address and nn being the assembled instructions and data in
145 * int rtcnt number of values evaluated
146 * int rtflg[] array of evaluation flags
147 * int rtval[] array of evaluation values
150 * int eval() lkeval.c
154 * Linker input T line evaluated.
164 rtval[rtcnt] = eval();
171 /*)Function VOID relr()
173 * The function relr() evaluates a R line read by
174 * the linker. The R line data is combined with the
175 * previous T line data to perform the relocation of
176 * code and data bytes. The S19 / IHX output and
177 * translation of the LST files to RST files may be
182 * R 0 0 nn nn n1 n2 xx xx ...
184 * The R line provides the relocation information to the linker.
185 * The nn nn value is the current area index, i.e. which area the
186 * current values were assembled. Relocation information is en-
187 * coded in groups of 4 bytes:
189 * 1. n1 is the relocation mode and object format
190 * 1. bit 0 word(0x00)/byte(0x01)
191 * 2. bit 1 relocatable area(0x00)/symbol(0x02)
192 * 3. bit 2 normal(0x00)/PC relative(0x04) relocation
193 * 4. bit 3 1-byte(0x00)/2-byte(0x08) object format for
195 * 5. bit 4 signed(0x00)/unsigned(0x10) byte data
196 * 6. bit 5 normal(0x00)/page '0'(0x20) reference
197 * 7. bit 6 normal(0x00)/page 'nnn'(0x40) reference
199 * 2. n2 is a byte index into the corresponding (i.e. pre-
200 * ceeding) T line data (i.e. a pointer to the data to be
201 * updated by the relocation). The T line data may be
202 * 1-byte or 2-byte byte data format or 2-byte word
205 * 3. xx xx is the area/symbol index for the area/symbol be-
206 * ing referenced. the corresponding area/symbol is found
207 * in the header area/symbol lists.
209 * The groups of 4 bytes are repeated for each item requiring relo-
210 * cation in the preceeding T line.
213 * areax **a pointer to array of area pointers
214 * int aindex area index
215 * char *errmsg[] array of pointers to error strings
216 * int error error code
217 * int lkerr error flag
218 * int mode relocation mode
219 * adrr_t paga paging base area address
220 * Addr_T pags paging symbol address
221 * Addr_T pc relocated base address
222 * Addr_T r PCR relocation value
223 * Addr_T reli relocation initial value
224 * Addr_T relv relocation final value
225 * int rindex symbol / area index
226 * Addr_T rtbase base code address
227 * Addr_T rtofst rtval[] index offset
228 * int rtp index into T data
229 * sym **s pointer to array of symbol pointers
232 * head *hp pointer to the head structure
233 * rerr rerr linker error structure
234 * FILE *stderr standard error device
237 * Addr_T adb_b() lkrloc.c
238 * Addr_T adb_lo() lkrloc.c
239 * Addr_T adb_hi() lkrloc.c
240 * Addr_T adw_w() lkrloc.c
241 * Addr_T evword() lkrloc.c
242 * int eval() lkeval.c
243 * int fprintf() c_library
245 * int lkulist lklist.c
247 * VOID relerr() lkrloc.c
249 * int symval() lksym.c
252 * The R and T lines are combined to produce
253 * relocated code and data. Output S19 / IHX
254 * and relocated listing files may be produced.
262 register Addr_T reli, relv;
263 int aindex, rindex, rtp, error;
264 Addr_T r, rtbase, rtofst, paga, pags, pc;
269 * Get area and symbol lists
277 if (eval() != (R_WORD | R_AREA) || eval()) {
278 fprintf(stderr, "R input error\n");
286 if (aindex >= hp->h_narea) {
287 fprintf(stderr, "R area error\n");
295 rtbase = adw_w(0, 0);
301 pc = adw_w(a[aindex]->a_addr, 0);
304 printf("area %d base address: 0x%x size: 0x%x rtbase: 0x%x\n", aindex,
305 a[aindex]->a_addr, a[aindex]->a_size, rtbase);
308 * Do remaining relocations
314 if ((mode & R_ESCAPE_MASK) == R_ESCAPE_MASK)
316 mode = ((mode & ~R_ESCAPE_MASK) << 8) | eval();
317 /* printf("unescaping rmode\n"); */
324 * R_SYM or R_AREA references
327 if (rindex >= hp->h_nglob) {
328 fprintf(stderr, "R symbol error\n");
332 reli = symval(s[rindex]);
334 if (rindex >= hp->h_narea) {
335 fprintf(stderr, "R area error\n");
339 reli = a[rindex]->a_addr;
347 reli -= (pc + (rtp-rtofst) + 1);
349 reli -= (pc + (rtp-rtofst) + 2);
354 * R_PAG0 or R_PAG addressing
356 if (mode & (R_PAG0 | R_PAG)) {
357 paga = sdp.s_area->a_addr;
363 * R_BYTE or R_WORD operation
368 /* This is a three byte address, of which
369 * we will select one byte.
373 /* printf("24 bit address selecting hi byte.\n"); */
374 relv = adb_24_hi(reli, rtp);
376 else if (mode & R_MSB)
378 /* Note that in 24 bit mode, R_MSB
379 * is really the middle byte, not
380 * the most significant byte.
382 * This is ugly and I can only apologize
385 /* printf("24 bit address selecting middle byte.\n"); */
386 relv = adb_24_mid(reli, rtp);
390 /* printf("24 bit address selecting lo byte.\n"); */
391 relv = adb_24_lo(reli, rtp);
394 else if (mode & R_BYT2) {
395 /* This is a two byte address, of
396 * which we will select one byte.
399 relv = adb_hi(reli, rtp);
401 relv = adb_lo(reli, rtp);
404 relv = adb_b(reli, rtp);
406 } else if (IS_R_J11(mode)) {
407 /* JLH: 11 bit jump destination for 8051. Forms
408 / two byte instruction with op-code bits
410 / rtp points at 3 byte locus: first two
411 / will get the instructiion. third one
415 /* Calculate absolute destination
416 / relv must be on same 2K page as pc
418 relv = adw_w(reli, rtp);
420 if ((relv & ~0x7ff) != ((pc + rtp - rtofst) & ~0x7ff)) {
424 /* Merge MSB (byte 0) with op-code, ignoring
425 / top 5 bits of address. Then hide the op-code
427 rtval[rtp] = ((rtval[rtp] & 0x07)<<5) | rtval[rtp+2];
431 else if (IS_R_J19(mode)) {
432 /* 19 bit jump destination for DS80C390. Forms
433 / three byte instruction with op-code bits
435 / rtp points at 4 byte locus: first three
436 / will get the instructiion. fourth one
440 /* Calculate absolute destination
441 / relv must be on same 512K page as pc
443 relv = adw_24(reli, rtp);
445 if ((relv & ~0x7ffff) != ((pc + rtp - rtofst) & ~0x7ffff)) {
449 /* Merge MSB (byte 0) with op-code, ignoring
450 / top 5 bits of address. Then hide the op-code
452 rtval[rtp] = ((rtval[rtp] & 0x07)<<5) | rtval[rtp+3];
456 else if (IS_C24(mode))
459 relv = adw_24(reli, rtp);
463 /* 16 bit address. */
464 relv = adw_w(reli, rtp);
468 * R_BYTE with R_BYT2 offset adjust
477 * Unsigned Byte Checking
479 if (mode & R_USGN && mode & R_BYTE && relv & ~0xFF)
483 * PCR Relocation Error Checking
485 if (mode & R_PCR && mode & R_BYTE) {
487 if (r != (Addr_T) ~0x7F && r != 0)
492 * Page Relocation Error Checking
494 /* if (mode & R_PAG0 && (relv & ~0xFF || paga || pags))
496 if (mode & R_PAG && (relv & ~0xFF))
503 rerr.aindex = aindex;
505 rerr.rtbase = rtbase + rtp - rtofst - 1;
506 rerr.rindex = rindex;
507 rerr.rval = relv - reli;
508 relerr(errmsg[error-1]);
515 /* JLH: output only if data (beyond two byte address) */
516 if ((oflag == 1) && (rtcnt > 2)) {
517 int extendedAddress = (a[aindex]->a_addr >> 16) & 0xffff;
519 /* Boy, is this a hack: for ABS sections, the
520 * base address is stored as zero, and the T records
521 * indicate the offset from zero.
523 * Since T records can only indicate a 16 bit offset, this
524 * obviously creates a problem for ABS segments located
525 * above 64K (this is only meaningful in flat24 mode).
527 * However, the size of an ABS area is stored as
528 * base address + section size (I suspect this is a bug,
529 * but it's a handy one right now). So the upper 8 bits of
530 * the 24 bit address are stored in the size record.
533 * This is another reason why we can't have areas greater
534 * than 64K yet, even in flat24 mode.
536 // extendedAddress += ((a[aindex]->a_size) >> 16 & 0xffff);
537 // commented out by jr
539 if (lastAreaIndex != aindex) {
540 lastAreaIndex = aindex;
544 if (extendedAddress != lastExtendedAddress)
547 if (lastExtendedAddress!=-1) {
548 printf("output extended linear address record 0x%x 0x%x\n",
549 extendedAddress, lastExtendedAddress);
554 ihxEntendedLinearAddress(extendedAddress);
556 else if (extendedAddress)
558 /* Not allowed to generate extended address records,
559 * but one is called for here...
562 "warning: extended linear address encountered; "
563 "you probably want the -r flag.\n");
565 lastExtendedAddress = extendedAddress;
569 if ((oflag == 2) && (rtcnt > 2)) {
575 "Unsigned Byte error",
576 "Byte PCR relocation error",
577 "Page0 relocation error",
578 "Page Mode relocation error"
582 /*)Function VOID relp()
584 * The function relp() evaluates a P line read by
585 * the linker. The P line data is combined with the
586 * previous T line data to set the base page address
587 * and test the paging boundary and length.
591 * P 0 0 nn nn n1 n2 xx xx
593 * The P line provides the paging information to the linker as
594 * specified by a .setdp directive. The format of the relocation
595 * information is identical to that of the R line. The correspond-
596 * ing T line has the following information:
597 * T xx xx aa aa bb bb
599 * Where aa aa is the area reference number which specifies the
600 * selected page area and bb bb is the base address of the page.
601 * bb bb will require relocation processing if the 'n1 n2 xx xx' is
602 * specified in the P line. The linker will verify that the base
603 * address is on a 256 byte boundary and that the page length of an
604 * area defined with the PAG type is not larger than 256 bytes.
607 * areax **a pointer to array of area pointers
608 * int aindex area index
609 * int mode relocation mode
610 * Addr_T relv relocation value
611 * int rindex symbol / area index
612 * int rtp index into T data
613 * sym **s pointer to array of symbol pointers
616 * head *hp pointer to the head structure
617 * int lkerr error flag
618 * sdp sdp base page structure
619 * FILE *stderr standard error device
622 * Addr_T adw_w() lkrloc.c
623 * Addr_T evword() lkrloc.c
624 * int eval() lkeval.c
625 * int fprintf() c_library
627 * int symval() lksym.c
630 * The P and T lines are combined to set
631 * the base page address and report any
639 register int aindex, rindex;
646 * Get area and symbol lists
654 if (eval() != (R_WORD | R_AREA) || eval()) {
655 fprintf(stderr, "P input error\n");
663 if (aindex >= hp->h_narea) {
664 fprintf(stderr, "P area error\n");
670 * Do remaining relocations
678 * R_SYM or R_AREA references
681 if (rindex >= hp->h_nglob) {
682 fprintf(stderr, "P symbol error\n");
686 relv = symval(s[rindex]);
688 if (rindex >= hp->h_narea) {
689 fprintf(stderr, "P area error\n");
693 relv = a[rindex]->a_addr;
702 if (aindex >= hp->h_narea) {
703 fprintf(stderr, "P area error\n");
707 sdp.s_areax = a[aindex];
708 sdp.s_area = sdp.s_areax->a_bap;
709 sdp.s_addr = adw_w(0,4);
710 if (sdp.s_area->a_addr & 0xFF || sdp.s_addr & 0xFF)
711 relerp("Page Definition Boundary Error");
714 /*)Function VOID rele()
716 * The function rele() closes all open output files
717 * at the end of the linking process.
723 * int oflag output type flag
724 * int uflag relocation listing flag
728 * VOID lkulist() lklist.c
732 * All open output files are closed.
750 /*)Function Addr_T evword()
752 * The function evword() combines two byte values
753 * into a single word value.
756 * Addr_T v temporary evaluation variable
759 * hilo byte ordering parameter
762 * int eval() lkeval.c
765 * Relocation text line is scanned to combine
766 * two byte values into a single word value.
785 /*)Function Addr_T adb_b(v, i)
787 * int v value to add to byte
788 * int i rtval[] index
790 * The function adb_b() adds the value of v to
791 * the single byte value contained in rtval[i].
792 * The new value of rtval[i] is returned.
804 * The value of rtval[] is changed.
813 return(rtval[i] += v);
816 /*)Function Addr_T adb_lo(v, i)
818 * int v value to add to byte
819 * int i rtval[] index
821 * The function adb_lo() adds the value of v to the
822 * double byte value contained in rtval[i] and rtval[i+1].
823 * The new value of rtval[i] / rtval[i+1] is returned.
824 * The MSB rtflg[] is cleared.
827 * Addr_T j temporary evaluation variable
830 * hilo byte ordering parameter
836 * The value of rtval[] is changed.
837 * The rtflg[] value corresponding to the
838 * MSB of the word value is cleared to reflect
839 * the fact that the LSB is the selected byte.
862 /*)Function Addr_T adb_hi(v, i)
864 * int v value to add to byte
865 * int i rtval[] index
867 * The function adb_hi() adds the value of v to the
868 * double byte value contained in rtval[i] and rtval[i+1].
869 * The new value of rtval[i] / rtval[i+1] is returned.
870 * The LSB rtflg[] is cleared.
873 * Addr_T j temporary evaluation variable
876 * hilo byte ordering parameter
882 * The value of rtval[] is changed.
883 * The rtflg[] value corresponding to the
884 * LSB of the word value is cleared to reflect
885 * the fact that the MSB is the selected byte.
908 /*)Function Addr_T adb_24_hi(v, i)
910 * int v value to add to byte
911 * int i rtval[] index
913 * The function adb_24_hi() adds the value of v to the
914 * 24 bit value contained in rtval[i] - rtval[i+2].
915 * The new value of rtval[i] / rtval[i+1] is returned.
916 * The LSB & middle byte rtflg[] is cleared.
919 * Addr_T j temporary evaluation variable
922 * hilo byte ordering parameter
928 * The value of rtval[] is changed.
929 * The rtflg[] value corresponding to the
930 * LSB & middle byte of the word value is cleared to
931 * reflect the fact that the MSB is the selected byte.
936 adb_24_hi(Addr_T v, int i)
942 /* Remove the lower two bytes. */
956 /*)Function Addr_T adb_24_mid(v, i)
958 * int v value to add to byte
959 * int i rtval[] index
961 * The function adb_24_mid() adds the value of v to the
962 * 24 bit value contained in rtval[i] - rtval[i+2].
963 * The new value of rtval[i] / rtval[i+1] is returned.
964 * The LSB & MSB byte rtflg[] is cleared.
967 * Addr_T j temporary evaluation variable
970 * hilo byte ordering parameter
976 * The value of rtval[] is changed.
977 * The rtflg[] value corresponding to the
978 * LSB & MSB of the 24 bit value is cleared to reflect
979 * the fact that the middle byte is the selected byte.
984 adb_24_mid(Addr_T v, int i)
990 /* remove the MSB & LSB. */
997 /*)Function Addr_T adb_24_lo(v, i)
999 * int v value to add to byte
1000 * int i rtval[] index
1002 * The function adb_24_lo() adds the value of v to the
1003 * 24 bit value contained in rtval[i] - rtval[i+2].
1004 * The new value of rtval[i] / rtval[i+1] is returned.
1005 * The MSB & middle byte rtflg[] is cleared.
1008 * Addr_T j temporary evaluation variable
1011 * hilo byte ordering parameter
1017 * The value of rtval[] is changed.
1018 * The rtflg[] value corresponding to the
1019 * MSB & middle byte of the word value is cleared to
1020 * reflect the fact that the LSB is the selected byte.
1025 adb_24_lo(Addr_T v, int i)
1031 /* Remove the upper two bytes. */
1045 /*)Function Addr_T adw_w(v, i)
1047 * int v value to add to word
1048 * int i rtval[] index
1050 * The function adw_w() adds the value of v to the
1051 * word value contained in rtval[i] and rtval[i+1].
1052 * The new value of rtval[i] / rtval[i+1] is returned.
1055 * Addr_T j temporary evaluation variable
1058 * hilo byte ordering parameter
1064 * The word value of rtval[] is changed.
1076 j = v + (rtval[i] << 8) + (rtval[i+1] & 0xff);
1077 rtval[i] = (j >> 8) & 0xff;
1078 rtval[i+1] = j & 0xff;
1080 j = v + (rtval[i] & 0xff) + (rtval[i+1] << 8);
1081 rtval[i] = j & 0xff;
1082 rtval[i+1] = (j >> 8) & 0xff;
1087 /*)Function Addr_T adw_24(v, i)
1089 * int v value to add to word
1090 * int i rtval[] index
1092 * The function adw_w() adds the value of v to the
1093 * 24 bit value contained in rtval[i] - rtval[i+2].
1094 * The new value of rtval[i] - rtval[i+2] is returned.
1097 * Addr_T j temporary evaluation variable
1100 * hilo byte ordering parameter
1106 * The word value of rtval[] is changed.
1110 adw_24(Addr_T v, int i)
1115 j = v + ((rtval[i] & 0xff) << 16)
1116 + ((rtval[i+1] & 0xff) << 8)
1117 + (rtval[i+2] & 0xff);
1118 rtval[i] = (j >> 16) & 0xff;
1119 rtval[i+1] = (j >> 8) & 0xff;
1120 rtval[i+2] = j & 0xff;
1122 j = v + (rtval[i] & 0xff)
1123 + ((rtval[i+1] & 0xff) << 8)
1124 + ((rtval[i+2] & 0xff) << 16);
1125 rtval[i] = j & 0xff;
1126 rtval[i+1] = (j >> 8) & 0xff;
1127 rtval[i+2] = (j >> 16) & 0xff;
1132 /*)Function Addr_T adw_lo(v, i)
1134 * int v value to add to byte
1135 * int i rtval[] index
1137 * The function adw_lo() adds the value of v to the
1138 * double byte value contained in rtval[i] and rtval[i+1].
1139 * The new value of rtval[i] / rtval[i+1] is returned.
1140 * The MSB rtval[] is zeroed.
1143 * Addr_T j temporary evaluation variable
1146 * hilo byte ordering parameter
1152 * The value of rtval[] is changed.
1153 * The MSB of the word value is cleared to reflect
1154 * the fact that the LSB is the selected byte.
1177 /*)Function Addr_T adw_hi(v, i)
1179 * int v value to add to byte
1180 * int i rtval[] index
1182 * The function adw_hi() adds the value of v to the
1183 * double byte value contained in rtval[i] and rtval[i+1].
1184 * The new value of rtval[i] / rtval[i+1] is returned.
1185 * The MSB and LSB values are interchanged.
1186 * The MSB rtval[] is zeroed.
1189 * Addr_T j temporary evaluation variable
1192 * hilo byte ordering parameter
1198 * The value of rtval[] is changed.
1199 * The MSB and LSB values are interchanged and
1200 * then the MSB cleared.
1213 * LSB = MSB, Clear MSB
1216 rtval[i+1] = rtval[i];
1219 rtval[i] = rtval[i+1];
1225 /*)Function VOID relerr(str)
1227 * char *str error string
1229 * The function relerr() outputs the error string to
1230 * stderr and to the map file (if it is open).
1236 * FILE *mfp handle for the map file
1239 * VOID errdmp() lkrloc.c
1242 * Error message inserted into map file.
1250 errdmp(stderr, str);
1255 /*)Function VOID errdmp(fptr, str)
1257 * FILE *fptr output file handle
1258 * char *str error string
1260 * The function errdmp() outputs the error string str
1261 * to the device specified by fptr. Additional information
1262 * is output about the definition and referencing of
1263 * the symbol / area error.
1266 * int mode error mode
1267 * int aindex area index
1268 * int lkerr error flag
1269 * int rindex error index
1270 * sym **s pointer to array of symbol pointers
1271 * areax **a pointer to array of area pointers
1272 * areax *raxp error area extension pointer
1275 * sdp sdp base page structure
1278 * int fprintf() c_library
1279 * VOID prntval() lkrloc.c
1291 int mode, aindex, rindex;
1300 aindex = rerr.aindex;
1301 rindex = rerr.rindex;
1306 fprintf(fptr, "\n?ASlink-Warning-%s", str);
1310 * Print symbol if symbol based
1313 fprintf(fptr, " for symbol %s\n",
1314 &s[rindex]->s_id[0]);
1316 fprintf(fptr, "\n");
1323 " file module area offset\n");
1325 " Refby %-8.8s %-8.8s %-8.8s ",
1328 &a[aindex]->a_bap->a_id[0]);
1329 prntval(fptr, rerr.rtbase);
1335 raxp = s[rindex]->s_axp;
1340 " Defin %-8.8s %-8.8s %-8.8s ",
1341 raxp->a_bhp->h_lfile->f_idp,
1342 &raxp->a_bhp->m_id[0],
1343 &raxp->a_bap->a_id[0]);
1345 prntval(fptr, s[rindex]->s_addr);
1347 prntval(fptr, rerr.rval);
1351 /*)Function VOID prntval(fptr, v)
1353 * FILE *fptr output file handle
1354 * Addr_T v value to output
1356 * The function prntval() outputs the value v, in the
1357 * currently selected radix, to the device specified
1364 * int xflag current radix
1367 * int fprintf() c_library
1380 fprintf(fptr, "%04X\n", v);
1383 fprintf(fptr, "%06o\n", v);
1386 fprintf(fptr, "%05u\n", v);
1390 /*)Function VOID relerp(str)
1392 * char *str error string
1394 * The function relerp() outputs the paging error string to
1395 * stderr and to the map file (if it is open).
1401 * FILE *mfp handle for the map file
1404 * VOID erpdmp() lkrloc.c
1407 * Error message inserted into map file.
1415 erpdmp(stderr, str);
1420 /*)Function VOID erpdmp(fptr, str)
1422 * FILE *fptr output file handle
1423 * char *str error string
1425 * The function erpdmp() outputs the error string str
1426 * to the device specified by fptr.
1429 * head *thp pointer to head structure
1432 * int lkerr error flag
1433 * sdp sdp base page structure
1436 * int fprintf() c_library
1437 * VOID prntval() lkrloc.c
1449 register struct head *thp;
1451 thp = sdp.s_areax->a_bhp;
1456 fprintf(fptr, "\n?ASlink-Warning-%s\n", str);
1463 " file module pgarea pgoffset\n");
1465 " PgDef %-8.8s %-8.8s %-8.8s ",
1466 thp->h_lfile->f_idp,
1468 &sdp.s_area->a_id[0]);
1469 prntval(fptr, sdp.s_area->a_addr + sdp.s_addr);