Rev 3606 | Rev 3684 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3606 | Rev 3611 | ||
---|---|---|---|
Line 497... | Line 497... | ||
497 | } |
497 | } |
498 | 498 | ||
499 | state = t->udebug.uspace_state; |
499 | state = t->udebug.uspace_state; |
500 | if (state == NULL) { |
500 | if (state == NULL) { |
501 | _thread_op_end(t); |
501 | _thread_op_end(t); |
502 | printf("udebug_regs_read() - istate not available\n"); |
502 | LOG("udebug_regs_read() - istate not available\n"); |
503 | return EBUSY; |
503 | return EBUSY; |
504 | } |
504 | } |
505 | 505 | ||
506 | /* Copy to the allocated buffer */ |
506 | /* Copy to the allocated buffer */ |
507 | memcpy(buffer, state, sizeof(istate_t)); |
507 | memcpy(buffer, state, sizeof(istate_t)); |
Line 514... | Line 514... | ||
514 | int udebug_regs_write(thread_t *t, void *buffer) |
514 | int udebug_regs_write(thread_t *t, void *buffer) |
515 | { |
515 | { |
516 | int rc; |
516 | int rc; |
517 | istate_t *state; |
517 | istate_t *state; |
518 | 518 | ||
519 | printf("udebug_regs_write()\n"); |
519 | LOG("udebug_regs_write()\n"); |
520 | 520 | ||
521 | /* Try to change the thread's uspace_state */ |
521 | /* Try to change the thread's uspace_state */ |
522 | 522 | ||
523 | /* On success, this will lock t->udebug.lock */ |
523 | /* On success, this will lock t->udebug.lock */ |
524 | rc = _thread_op_begin(t, false); |
524 | rc = _thread_op_begin(t, false); |
525 | if (rc != EOK) { |
525 | if (rc != EOK) { |
526 | printf("error locking thread\n"); |
526 | LOG("error locking thread\n"); |
527 | return rc; |
527 | return rc; |
528 | } |
528 | } |
529 | 529 | ||
530 | state = t->udebug.uspace_state; |
530 | state = t->udebug.uspace_state; |
531 | if (state == NULL) { |
531 | if (state == NULL) { |
532 | _thread_op_end(t); |
532 | _thread_op_end(t); |
533 | printf("udebug_regs_write() - istate not available\n"); |
533 | LOG("udebug_regs_write() - istate not available\n"); |
534 | return EBUSY; |
534 | return EBUSY; |
535 | } |
535 | } |
536 | 536 | ||
537 | memcpy(t->udebug.uspace_state, buffer, sizeof(istate_t)); |
537 | memcpy(t->udebug.uspace_state, buffer, sizeof(istate_t)); |
538 | 538 | ||
Line 579... | Line 579... | ||
579 | 579 | ||
580 | int udebug_mem_write(unative_t uspace_addr, void *data, size_t n) |
580 | int udebug_mem_write(unative_t uspace_addr, void *data, size_t n) |
581 | { |
581 | { |
582 | int rc; |
582 | int rc; |
583 | 583 | ||
584 | printf("udebug_mem_write()\n"); |
584 | LOG("udebug_mem_write()\n"); |
585 | 585 | ||
586 | /* n must be positive */ |
586 | /* n must be positive */ |
587 | if (n < 1) |
587 | if (n < 1) |
588 | return EINVAL; |
588 | return EINVAL; |
589 | 589 | ||
Line 593... | Line 593... | ||
593 | if (TASK->udebug.dt_state != UDEBUG_TS_ACTIVE) { |
593 | if (TASK->udebug.dt_state != UDEBUG_TS_ACTIVE) { |
594 | mutex_unlock(&TASK->udebug.lock); |
594 | mutex_unlock(&TASK->udebug.lock); |
595 | return EBUSY; |
595 | return EBUSY; |
596 | } |
596 | } |
597 | 597 | ||
598 | printf("dst=%u, size=%u\n", uspace_addr, n); |
598 | LOG("dst=%u, size=%u\n", uspace_addr, n); |
599 | 599 | ||
600 | /* NOTE: this is not strictly from a syscall... but that shouldn't |
600 | /* NOTE: this is not strictly from a syscall... but that shouldn't |
601 | * be a problem */ |
601 | * be a problem */ |
602 | // rc = copy_to_uspace((void *)uspace_addr, data, n); |
602 | // rc = copy_to_uspace((void *)uspace_addr, data, n); |
603 | // if (rc) return rc; |
603 | // if (rc) return rc; |
604 | 604 | ||
605 | rc = as_debug_write(uspace_addr, data, n); |
605 | rc = as_debug_write(uspace_addr, data, n); |
606 | 606 | ||
607 | printf("rc=%d\n", rc); |
607 | LOG("rc=%d\n", rc); |
608 | 608 | ||
609 | mutex_unlock(&TASK->udebug.lock); |
609 | mutex_unlock(&TASK->udebug.lock); |
610 | 610 | ||
611 | return rc; |
611 | return rc; |
612 | } |
612 | } |