Changes in kernel/generic/src/ipc/irq.c [01e39cbe:55b77d9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/irq.c
r01e39cbe r55b77d9 365 365 return IRQ_DECLINE; 366 366 367 #define CMD_MEM_READ(target) \ 368 do { \ 369 void *va = code->cmds[i].addr; \ 370 if (AS != irq->driver_as) \ 371 as_switch(AS, irq->driver_as); \ 372 memcpy_from_uspace(&target, va, (sizeof(target))); \ 373 if (dstarg) \ 374 scratch[dstarg] = target; \ 375 } while(0) 376 377 #define CMD_MEM_WRITE(val) \ 378 do { \ 379 void *va = code->cmds[i].addr; \ 380 if (AS != irq->driver_as) \ 381 as_switch(AS, irq->driver_as); \ 382 memcpy_to_uspace(va, &val, sizeof(val)); \ 383 } while (0) 384 367 385 as_t *current_as = AS; 368 if (current_as != irq->driver_as) 369 as_switch(AS, irq->driver_as); 370 371 for (size_t i = 0; i < code->cmdcount; i++) { 386 size_t i; 387 for (i = 0; i < code->cmdcount; i++) { 372 388 uint32_t dstval; 373 void *va;374 uint8_t val8;375 uint16_t val16;376 uint32_t val32;377 378 389 uintptr_t srcarg = code->cmds[i].srcarg; 379 390 uintptr_t dstarg = code->cmds[i].dstarg; … … 431 442 } 432 443 break; 433 case CMD_MEM_READ_8: 434 va = code->cmds[i].addr; 435 memcpy_from_uspace(&val8, va, sizeof(val8)); 436 if (dstarg) 437 scratch[dstarg] = val8; 438 break; 439 case CMD_MEM_READ_16: 440 va = code->cmds[i].addr; 441 memcpy_from_uspace(&val16, va, sizeof(val16)); 442 if (dstarg) 443 scratch[dstarg] = val16; 444 break; 445 case CMD_MEM_READ_32: 446 va = code->cmds[i].addr; 447 memcpy_from_uspace(&val32, va, sizeof(val32)); 448 if (dstarg) 449 scratch[dstarg] = val32; 450 break; 451 case CMD_MEM_WRITE_8: 452 val8 = code->cmds[i].value; 453 va = code->cmds[i].addr; 454 memcpy_to_uspace(va, &val8, sizeof(val8)); 455 break; 456 case CMD_MEM_WRITE_16: 457 val16 = code->cmds[i].value; 458 va = code->cmds[i].addr; 459 memcpy_to_uspace(va, &val16, sizeof(val16)); 460 break; 461 case CMD_MEM_WRITE_32: 462 val32 = code->cmds[i].value; 463 va = code->cmds[i].addr; 464 memcpy_to_uspace(va, &val32, sizeof(val32)); 465 break; 444 case CMD_MEM_READ_8: { 445 uint8_t val; 446 CMD_MEM_READ(val); 447 break; 448 } 449 case CMD_MEM_READ_16: { 450 uint16_t val; 451 CMD_MEM_READ(val); 452 break; 453 } 454 case CMD_MEM_READ_32: { 455 uint32_t val; 456 CMD_MEM_READ(val); 457 break; 458 } 459 case CMD_MEM_WRITE_8: { 460 uint8_t val = code->cmds[i].value; 461 CMD_MEM_WRITE(val); 462 break; 463 } 464 case CMD_MEM_WRITE_16: { 465 uint16_t val = code->cmds[i].value; 466 CMD_MEM_WRITE(val); 467 break; 468 } 469 case CMD_MEM_WRITE_32: { 470 uint32_t val = code->cmds[i].value; 471 CMD_MEM_WRITE(val); 472 break; 473 } 466 474 case CMD_MEM_WRITE_A_8: 467 475 if (srcarg) { 468 val8 = scratch[srcarg]; 469 va = code->cmds[i].addr; 470 memcpy_to_uspace(va, &val8, sizeof(val8)); 476 uint8_t val = scratch[srcarg]; 477 CMD_MEM_WRITE(val); 471 478 } 472 479 break; 473 480 case CMD_MEM_WRITE_A_16: 474 481 if (srcarg) { 475 val16 = scratch[srcarg]; 476 va = code->cmds[i].addr; 477 memcpy_to_uspace(va, &val16, sizeof(val16)); 482 uint16_t val = scratch[srcarg]; 483 CMD_MEM_WRITE(val); 478 484 } 479 485 break; 480 486 case CMD_MEM_WRITE_A_32: 481 487 if (srcarg) { 482 val32 = scratch[srcarg]; 483 va = code->cmds[i].addr; 484 memcpy_to_uspace(va, &val32, sizeof(val32)); 488 uint32_t val = scratch[srcarg]; 489 CMD_MEM_WRITE(val); 485 490 } 486 491 break; … … 508 513 } 509 514 } 510 511 515 if (AS != current_as) 512 516 as_switch(AS, current_as);
Note:
See TracChangeset
for help on using the changeset viewer.