direct-io.hg

view tools/libxc/xc_linux_restore.c @ 2693:2584528df9e1

bitkeeper revision 1.1159.123.2 (4177d169N58TtQXn_XJO4xNBKbMQUw)

Merge freefall.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into freefall.cl.cam.ac.uk:/local/scratch/kaf24/xeno
author kaf24@freefall.cl.cam.ac.uk
date Thu Oct 21 15:10:33 2004 +0000 (2004-10-21)
parents e442cedb12d8 d8e27145f1eb
children 8aa9d487a8dd
line source
1 /******************************************************************************
2 * xc_linux_restore.c
3 *
4 * Restore the state of a Linux session.
5 *
6 * Copyright (c) 2003, K A Fraser.
7 */
9 #include "xc_private.h"
10 #include <asm-xen/suspend.h>
12 #define MAX_BATCH_SIZE 1024
14 #define DEBUG 0
16 #if DEBUG
17 #define DPRINTF(_f, _a...) printf ( _f , ## _a )
18 #else
19 #define DPRINTF(_f, _a...) ((void)0)
20 #endif
22 static int get_pfn_list(int xc_handle,
23 u32 domain_id,
24 unsigned long *pfn_buf,
25 unsigned long max_pfns)
26 {
27 dom0_op_t op;
28 int ret;
29 op.cmd = DOM0_GETMEMLIST;
30 op.u.getmemlist.domain = (domid_t)domain_id;
31 op.u.getmemlist.max_pfns = max_pfns;
32 op.u.getmemlist.buffer = pfn_buf;
34 if ( mlock(pfn_buf, max_pfns * sizeof(unsigned long)) != 0 )
35 {
36 PERROR("Could not lock pfn list buffer");
37 return -1;
38 }
40 ret = do_dom0_op(xc_handle, &op);
42 (void)munlock(pfn_buf, max_pfns * sizeof(unsigned long));
44 return (ret < 0) ? -1 : op.u.getmemlist.num_pfns;
45 }
47 /** Read the vmconfig string from the state input.
48 * It is stored as a 4-byte count 'n' followed by n bytes.
49 * The config data is stored in a new string in 'ioctxt->vmconfig',
50 * and is null-terminated. The count is stored in 'ioctxt->vmconfig_n'.
51 *
52 * @param ioctxt i/o context
53 * @return 0 on success, non-zero on error.
54 */
55 static int read_vmconfig(XcIOContext *ioctxt)
56 {
57 int err = -1;
59 if ( xcio_read(ioctxt, &ioctxt->vmconfig_n, sizeof(ioctxt->vmconfig_n)) )
60 goto exit;
62 ioctxt->vmconfig = malloc(ioctxt->vmconfig_n + 1);
63 if ( ioctxt->vmconfig == NULL )
64 goto exit;
66 if ( xcio_read(ioctxt, ioctxt->vmconfig, ioctxt->vmconfig_n) )
67 goto exit;
69 ioctxt->vmconfig[ioctxt->vmconfig_n] = '\0';
70 err = 0;
72 exit:
73 if ( err )
74 {
75 if ( ioctxt->vmconfig != NULL )
76 free(ioctxt->vmconfig);
77 ioctxt->vmconfig = NULL;
78 ioctxt->vmconfig_n = 0;
79 }
80 return err;
81 }
83 int xc_linux_restore(int xc_handle, XcIOContext *ioctxt)
84 {
85 dom0_op_t op;
86 int rc = 1, i, n, k;
87 unsigned long mfn, pfn, xpfn;
88 unsigned int prev_pc, this_pc;
89 u32 dom = 0;
90 int verify = 0;
92 /* Number of page frames in use by this Linux session. */
93 unsigned long nr_pfns;
95 /* The new domain's shared-info frame number. */
96 unsigned long shared_info_frame;
97 unsigned char shared_info[PAGE_SIZE]; /* saved contents from file */
99 /* A copy of the CPU context of the guest. */
100 full_execution_context_t ctxt;
102 /* First 16 bytes of the state file must contain 'LinuxGuestRecord'. */
103 char signature[16];
105 /* A table containg the type of each PFN (/not/ MFN!). */
106 unsigned long *pfn_type = NULL;
108 /* A table of MFNs to map in the current region */
109 unsigned long *region_mfn = NULL;
111 /* A temporary mapping, and a copy, of one frame of guest memory. */
112 unsigned long *ppage = NULL;
114 /* A copy of the pfn-to-mfn table frame list. */
115 unsigned long pfn_to_mfn_frame_list[1024];
117 /* A table mapping each PFN to its new MFN. */
118 unsigned long *pfn_to_mfn_table = NULL;
120 /* used by mapper for updating the domain's copy of the table */
121 unsigned long *live_pfn_to_mfn_table = NULL;
123 /* A temporary mapping of the guest's suspend record. */
124 suspend_record_t *p_srec;
126 char *region_base;
128 mmu_t *mmu = NULL;
130 /* used by debug verify code */
131 unsigned long buf[PAGE_SIZE/sizeof(unsigned long)];
133 if ( mlock(&ctxt, sizeof(ctxt) ) )
134 {
135 /* needed for when we do the build dom0 op,
136 but might as well do early */
137 PERROR("Unable to mlock ctxt");
138 return 1;
139 }
141 /* Start reading the saved-domain record. */
142 if ( xcio_read(ioctxt, signature, 16) ||
143 (memcmp(signature, "LinuxGuestRecord", 16) != 0) )
144 {
145 xcio_error(ioctxt, "Unrecognised state format -- no signature found");
146 goto out;
147 }
149 if ( xcio_read(ioctxt, &nr_pfns, sizeof(unsigned long)) ||
150 xcio_read(ioctxt, pfn_to_mfn_frame_list, PAGE_SIZE) )
151 {
152 xcio_error(ioctxt, "Error reading header");
153 goto out;
154 }
156 if ( read_vmconfig(ioctxt) )
157 {
158 xcio_error(ioctxt, "Error writing vmconfig");
159 goto out;
160 }
162 if ( nr_pfns > 1024*1024 )
163 {
164 xcio_error(ioctxt, "Invalid state file -- pfn count out of range");
165 goto out;
166 }
168 /* We want zeroed memory so use calloc rather than malloc. */
169 pfn_to_mfn_table = calloc(1, 4 * nr_pfns);
170 pfn_type = calloc(1, 4 * nr_pfns);
171 region_mfn = calloc(1, 4 * MAX_BATCH_SIZE);
173 if ( (pfn_to_mfn_table == NULL) ||
174 (pfn_type == NULL) ||
175 (region_mfn == NULL) )
176 {
177 errno = ENOMEM;
178 goto out;
179 }
181 if ( mlock(region_mfn, 4 * MAX_BATCH_SIZE ) )
182 {
183 xcio_error(ioctxt, "Could not mlock region_mfn");
184 goto out;
185 }
187 /* Create domain on CPU -1 so that it may auto load-balance in future. */
188 if ( xc_domain_create(xc_handle, nr_pfns * (PAGE_SIZE / 1024),
189 -1, 1, &dom) )
190 {
191 xcio_error(ioctxt, "Could not create domain. pfns=%d, %dKB",
192 nr_pfns,nr_pfns * (PAGE_SIZE / 1024));
193 goto out;
194 }
196 ioctxt->domain = dom;
197 printf("Created domain %ld\n",dom);
199 /* Get the domain's shared-info frame. */
200 op.cmd = DOM0_GETDOMAININFO;
201 op.u.getdomaininfo.domain = (domid_t)dom;
202 op.u.getdomaininfo.ctxt = NULL;
203 if ( do_dom0_op(xc_handle, &op) < 0 )
204 {
205 xcio_error(ioctxt, "Could not get information on new domain");
206 goto out;
207 }
208 shared_info_frame = op.u.getdomaininfo.shared_info_frame;
210 if(ioctxt->flags & XCFLAGS_CONFIGURE)
211 {
212 if(xcio_configure_domain(ioctxt))
213 {
214 xcio_error(ioctxt, "Configuring domain failed");
215 goto out;
216 }
217 }
219 /* Build the pfn-to-mfn table. We choose MFN ordering returned by Xen. */
220 if ( get_pfn_list(xc_handle, dom, pfn_to_mfn_table, nr_pfns) != nr_pfns )
221 {
222 xcio_error(ioctxt, "Did not read correct number of frame "
223 "numbers for new dom");
224 goto out;
225 }
227 if ( (mmu = init_mmu_updates(xc_handle, dom)) == NULL )
228 {
229 xcio_error(ioctxt, "Could not initialise for MMU updates");
230 goto out;
231 }
233 xcio_info(ioctxt, "Reloading memory pages: 0%%");
235 /*
236 * Now simply read each saved frame into its new machine frame.
237 * We uncanonicalise page tables as we go.
238 */
239 prev_pc = 0;
241 n = 0;
242 while ( 1 )
243 {
244 int j;
245 unsigned long region_pfn_type[MAX_BATCH_SIZE];
247 this_pc = (n * 100) / nr_pfns;
248 if ( (this_pc - prev_pc) >= 5 )
249 {
250 xcio_info(ioctxt, "\b\b\b\b%3d%%", this_pc);
251 prev_pc = this_pc;
252 }
254 if ( xcio_read(ioctxt, &j, sizeof(int)) )
255 {
256 xcio_error(ioctxt, "Error when reading from state file");
257 goto out;
258 }
260 DPRINTF("batch %d\n",j);
262 if ( j == -1 )
263 {
264 verify = 1;
265 printf("Entering page verify mode\n");
266 continue;
267 }
269 if ( j == 0 )
270 break; /* our work here is done */
272 if ( j > MAX_BATCH_SIZE )
273 {
274 xcio_error(ioctxt, "Max batch size exceeded. Giving up.");
275 goto out;
276 }
278 if ( xcio_read(ioctxt, region_pfn_type, j*sizeof(unsigned long)) ) {
279 xcio_error(ioctxt, "Error when reading from state file");
280 goto out;
281 }
283 for ( i = 0; i < j; i++ )
284 {
285 if ( (region_pfn_type[i] & LTAB_MASK) == XTAB)
286 {
287 region_mfn[i] = 0; /* we know map will fail, but don't care */
288 }
289 else
290 {
291 pfn = region_pfn_type[i] & ~LTAB_MASK;
292 region_mfn[i] = pfn_to_mfn_table[pfn];
293 }
294 }
296 if ( (region_base = xc_map_foreign_batch( xc_handle, dom,
297 PROT_WRITE,
298 region_mfn,
299 j )) == 0 )
300 {
301 xcio_error(ioctxt, "map batch failed");
302 goto out;
303 }
305 for ( i = 0; i < j; i++ )
306 {
307 unsigned long *ppage;
309 pfn = region_pfn_type[i] & ~LTAB_MASK;
311 if ( (region_pfn_type[i] & LTAB_MASK) == XTAB) continue;
313 if (pfn>nr_pfns)
314 {
315 xcio_error(ioctxt, "pfn out of range");
316 goto out;
317 }
319 region_pfn_type[i] &= LTAB_MASK;
321 pfn_type[pfn] = region_pfn_type[i];
323 mfn = pfn_to_mfn_table[pfn];
325 if ( verify )
326 ppage = (unsigned long*) buf; /* debug case */
327 else
328 ppage = (unsigned long*) (region_base + i*PAGE_SIZE);
330 if ( xcio_read(ioctxt, ppage, PAGE_SIZE) )
331 {
332 xcio_error(ioctxt, "Error when reading from state file");
333 goto out;
334 }
336 switch( region_pfn_type[i] & LTABTYPE_MASK )
337 {
338 case 0:
339 break;
341 case L1TAB:
342 {
343 for ( k = 0; k < 1024; k++ )
344 {
345 if ( ppage[k] & _PAGE_PRESENT )
346 {
347 xpfn = ppage[k] >> PAGE_SHIFT;
348 if ( xpfn >= nr_pfns )
349 {
350 xcio_error(ioctxt, "Frame number in type %lu page "
351 "table is out of range. i=%d k=%d "
352 "pfn=0x%lx nr_pfns=%lu",
353 region_pfn_type[i]>>28, i,
354 k, xpfn, nr_pfns);
355 goto out;
356 }
358 ppage[k] &= (PAGE_SIZE - 1) &
359 ~(_PAGE_GLOBAL | _PAGE_PAT);
360 ppage[k] |= pfn_to_mfn_table[xpfn] << PAGE_SHIFT;
361 }
362 }
363 }
364 break;
366 case L2TAB:
367 {
368 for ( k = 0;
369 k < (HYPERVISOR_VIRT_START>>L2_PAGETABLE_SHIFT);
370 k++ )
371 {
372 if ( ppage[k] & _PAGE_PRESENT )
373 {
374 xpfn = ppage[k] >> PAGE_SHIFT;
376 if ( xpfn >= nr_pfns )
377 {
378 xcio_error(ioctxt, "Frame number in type %lu page"
379 " table is out of range. i=%d k=%d "
380 "pfn=%lu nr_pfns=%lu",
381 region_pfn_type[i]>>28, i, k,
382 xpfn, nr_pfns);
383 goto out;
384 }
386 ppage[k] &= (PAGE_SIZE - 1) &
387 ~(_PAGE_GLOBAL | _PAGE_PSE);
388 ppage[k] |= pfn_to_mfn_table[xpfn] << PAGE_SHIFT;
389 }
390 }
391 }
392 break;
394 default:
395 xcio_error(ioctxt, "Bogus page type %lx page table is "
396 "out of range. i=%d nr_pfns=%lu",
397 region_pfn_type[i], i, nr_pfns);
398 goto out;
400 } /* end of page type switch statement */
402 if ( verify )
403 {
404 int res = memcmp(buf, (region_base + i*PAGE_SIZE), PAGE_SIZE );
405 if ( res )
406 {
407 int v;
408 printf("************** pfn=%lx type=%lx gotcs=%08lx "
409 "actualcs=%08lx\n", pfn, pfn_type[pfn],
410 csum_page(region_base + i*PAGE_SIZE),
411 csum_page(buf));
412 for ( v = 0; v < 4; v++ )
413 {
414 unsigned long *p = (unsigned long *)
415 (region_base + i*PAGE_SIZE);
416 if ( buf[v] != p[v] )
417 printf(" %d: %08lx %08lx\n",
418 v, buf[v], p[v] );
419 }
420 }
421 }
423 if ( add_mmu_update(xc_handle, mmu,
424 (mfn<<PAGE_SHIFT) | MMU_MACHPHYS_UPDATE, pfn) )
425 {
426 printf("machpys mfn=%ld pfn=%ld\n",mfn,pfn);
427 goto out;
428 }
430 } /* end of 'batch' for loop */
432 munmap( region_base, j*PAGE_SIZE );
433 n+=j; /* crude stats */
434 }
436 DPRINTF("Received all pages\n");
438 /*
439 * Pin page tables. Do this after writing to them as otherwise Xen
440 * will barf when doing the type-checking.
441 */
442 for ( i = 0; i < nr_pfns; i++ )
443 {
444 if ( pfn_type[i] == (L1TAB|LPINTAB) )
445 {
446 if ( add_mmu_update(xc_handle, mmu,
447 (pfn_to_mfn_table[i]<<PAGE_SHIFT) |
448 MMU_EXTENDED_COMMAND,
449 MMUEXT_PIN_L1_TABLE) ) {
450 printf("ERR pin L1 pfn=%lx mfn=%lx\n",
451 (unsigned long)i, pfn_to_mfn_table[i]);
452 goto out;
453 }
454 }
455 }
457 /* must pin all L1's before L2's (need consistent va back ptr) */
458 for ( i = 0; i < nr_pfns; i++ )
459 {
460 if ( pfn_type[i] == (L2TAB|LPINTAB) )
461 {
462 if ( add_mmu_update(xc_handle, mmu,
463 (pfn_to_mfn_table[i]<<PAGE_SHIFT) |
464 MMU_EXTENDED_COMMAND,
465 MMUEXT_PIN_L2_TABLE) )
466 {
467 printf("ERR pin L2 pfn=%lx mfn=%lx\n",
468 (unsigned long)i, pfn_to_mfn_table[i]);
469 goto out;
470 }
471 }
472 }
474 if ( finish_mmu_updates(xc_handle, mmu) ) goto out;
476 xcio_info(ioctxt, "\b\b\b\b100%%\nMemory reloaded.\n");
478 /* Get the list of PFNs that are not in the psuedo-phys map */
479 {
480 unsigned int count, *pfntab;
481 int rc;
483 if ( xcio_read(ioctxt, &count, sizeof(count)) )
484 {
485 xcio_error(ioctxt, "Error when reading from state file");
486 goto out;
487 }
489 pfntab = malloc( sizeof(unsigned int) * count );
490 if ( pfntab == NULL )
491 {
492 xcio_error(ioctxt, "Out of memory");
493 goto out;
494 }
496 if ( xcio_read(ioctxt, pfntab, sizeof(unsigned int)*count) )
497 {
498 xcio_error(ioctxt, "Error when reading pfntab from state file");
499 goto out;
500 }
502 for ( i = 0; i < count; i++ )
503 {
504 unsigned long pfn = pfntab[i];
505 pfntab[i]=pfn_to_mfn_table[pfn];
506 pfn_to_mfn_table[pfn] = 0x80000001; // not in pmap
507 }
509 if ( count > 0 )
510 {
511 if ( (rc = do_dom_mem_op( xc_handle,
512 MEMOP_decrease_reservation,
513 pfntab, count, 0, dom )) <0 )
514 {
515 xcio_error(ioctxt, "Could not decrease reservation : %d",rc);
516 goto out;
517 }
518 else
519 {
520 printf("Decreased reservation by %d pages\n", count);
521 }
522 }
523 }
525 if ( xcio_read(ioctxt, &ctxt, sizeof(ctxt)) ||
526 xcio_read(ioctxt, shared_info, PAGE_SIZE) )
527 {
528 xcio_error(ioctxt, "Error when reading from state file");
529 goto out;
530 }
532 /* Uncanonicalise the suspend-record frame number and poke resume rec. */
533 pfn = ctxt.cpu_ctxt.esi;
534 if ( (pfn >= nr_pfns) || (pfn_type[pfn] != NOTAB) )
535 {
536 xcio_error(ioctxt, "Suspend record frame number is bad");
537 goto out;
538 }
539 ctxt.cpu_ctxt.esi = mfn = pfn_to_mfn_table[pfn];
540 p_srec = xc_map_foreign_range(
541 xc_handle, dom, PAGE_SIZE, PROT_WRITE, mfn);
542 p_srec->resume_info.nr_pages = nr_pfns;
543 p_srec->resume_info.shared_info = shared_info_frame << PAGE_SHIFT;
544 p_srec->resume_info.flags = 0;
545 munmap(p_srec, PAGE_SIZE);
547 /* Uncanonicalise each GDT frame number. */
548 if ( ctxt.gdt_ents > 8192 )
549 {
550 xcio_error(ioctxt, "GDT entry count out of range");
551 goto out;
552 }
554 for ( i = 0; i < ctxt.gdt_ents; i += 512 )
555 {
556 pfn = ctxt.gdt_frames[i];
557 if ( (pfn >= nr_pfns) || (pfn_type[pfn] != NOTAB) )
558 {
559 xcio_error(ioctxt, "GDT frame number is bad");
560 goto out;
561 }
562 ctxt.gdt_frames[i] = pfn_to_mfn_table[pfn];
563 }
565 /* Uncanonicalise the page table base pointer. */
566 pfn = ctxt.pt_base >> PAGE_SHIFT;
567 if ( (pfn >= nr_pfns) || ((pfn_type[pfn]&LTABTYPE_MASK) != L2TAB) )
568 {
569 printf("PT base is bad. pfn=%lu nr=%lu type=%08lx %08lx\n",
570 pfn, nr_pfns, pfn_type[pfn], (unsigned long)L2TAB);
571 xcio_error(ioctxt, "PT base is bad.");
572 goto out;
573 }
574 ctxt.pt_base = pfn_to_mfn_table[pfn] << PAGE_SHIFT;
576 /* clear any pending events and the selector */
577 memset(&(((shared_info_t *)shared_info)->evtchn_pending[0]),
578 0, sizeof (((shared_info_t *)shared_info)->evtchn_pending)+
579 sizeof(((shared_info_t *)shared_info)->evtchn_pending_sel));
581 /* Copy saved contents of shared-info page. No checking needed. */
582 ppage = xc_map_foreign_range(
583 xc_handle, dom, PAGE_SIZE, PROT_WRITE, shared_info_frame);
584 memcpy(ppage, shared_info, sizeof(shared_info_t));
585 munmap(ppage, PAGE_SIZE);
587 /* Uncanonicalise the pfn-to-mfn table frame-number list. */
588 for ( i = 0; i < (nr_pfns+1023)/1024; i++ )
589 {
590 unsigned long pfn, mfn;
592 pfn = pfn_to_mfn_frame_list[i];
593 if ( (pfn >= nr_pfns) || (pfn_type[pfn] != NOTAB) )
594 {
595 xcio_error(ioctxt, "PFN-to-MFN frame number is bad");
596 goto out;
597 }
598 mfn = pfn_to_mfn_table[pfn];
599 pfn_to_mfn_frame_list[i] = mfn;
600 }
602 if ( (live_pfn_to_mfn_table =
603 xc_map_foreign_batch(xc_handle, dom,
604 PROT_WRITE,
605 pfn_to_mfn_frame_list,
606 (nr_pfns+1023)/1024 )) == 0 )
607 {
608 xcio_error(ioctxt, "Couldn't map pfn_to_mfn table");
609 goto out;
610 }
612 memcpy(live_pfn_to_mfn_table, pfn_to_mfn_table,
613 nr_pfns*sizeof(unsigned long) );
615 munmap(live_pfn_to_mfn_table, ((nr_pfns+1023)/1024)*PAGE_SIZE);
617 /*
618 * Safety checking of saved context:
619 * 1. cpu_ctxt is fine, as Xen checks that on context switch.
620 * 2. fpu_ctxt is fine, as it can't hurt Xen.
621 * 3. trap_ctxt needs the code selectors checked.
622 * 4. fast_trap_idx is checked by Xen.
623 * 5. ldt base must be page-aligned, no more than 8192 ents, ...
624 * 6. gdt already done, and further checking is done by Xen.
625 * 7. check that guestos_ss is safe.
626 * 8. pt_base is already done.
627 * 9. debugregs are checked by Xen.
628 * 10. callback code selectors need checking.
629 */
630 for ( i = 0; i < 256; i++ )
631 {
632 ctxt.trap_ctxt[i].vector = i;
633 if ( (ctxt.trap_ctxt[i].cs & 3) == 0 )
634 ctxt.trap_ctxt[i].cs = FLAT_GUESTOS_CS;
635 }
636 if ( (ctxt.guestos_ss & 3) == 0 )
637 ctxt.guestos_ss = FLAT_GUESTOS_DS;
638 if ( (ctxt.event_callback_cs & 3) == 0 )
639 ctxt.event_callback_cs = FLAT_GUESTOS_CS;
640 if ( (ctxt.failsafe_callback_cs & 3) == 0 )
641 ctxt.failsafe_callback_cs = FLAT_GUESTOS_CS;
642 if ( ((ctxt.ldt_base & (PAGE_SIZE - 1)) != 0) ||
643 (ctxt.ldt_ents > 8192) ||
644 (ctxt.ldt_base > HYPERVISOR_VIRT_START) ||
645 ((ctxt.ldt_base + ctxt.ldt_ents*8) > HYPERVISOR_VIRT_START) )
646 {
647 xcio_error(ioctxt, "Bad LDT base or size");
648 goto out;
649 }
651 op.cmd = DOM0_BUILDDOMAIN;
652 op.u.builddomain.domain = (domid_t)dom;
653 op.u.builddomain.ctxt = &ctxt;
654 rc = do_dom0_op(xc_handle, &op);
656 if ( rc != 0 )
657 {
658 xcio_error(ioctxt, "Couldn't build the domain");
659 goto out;
660 }
662 if ( ioctxt->flags & XCFLAGS_CONFIGURE )
663 {
664 op.cmd = DOM0_UNPAUSEDOMAIN;
665 op.u.unpausedomain.domain = (domid_t)dom;
666 rc = do_dom0_op(xc_handle, &op);
667 }
669 if ( rc == 0 )
670 {
671 /* Success: print the domain id. */
672 xcio_info(ioctxt, "DOM=%lu\n", dom);
673 return 0;
674 }
677 out:
678 if ( (rc != 0) && (dom != 0) )
679 xc_domain_destroy(xc_handle, dom);
680 if ( mmu != NULL )
681 free(mmu);
682 if ( pfn_to_mfn_table != NULL )
683 free(pfn_to_mfn_table);
684 if ( pfn_type != NULL )
685 free(pfn_type);
687 if ( rc == 0 )
688 ioctxt->domain = dom;
690 DPRINTF("Restore exit with rc=%d\n",rc);
691 return rc;
692 }