Changeset 679dc0c in mainline
- Timestamp:
- 2013-11-11T12:28:25Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bf677f6
- Parents:
- 3d1956b
- Location:
- kernel/arch/sparc32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc32/include/arch/exception.h
r3d1956b r679dc0c 67 67 extern void data_store_error(int n, istate_t *istate); 68 68 extern void mem_address_not_aligned(int n, istate_t *istate); 69 extern voidsyscall(sysarg_t a1, sysarg_t a2, sysarg_t a3, sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id);69 extern sysarg_t syscall(sysarg_t a1, sysarg_t a2, sysarg_t a3, sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id); 70 70 71 71 #endif /* !__ASM__ */ -
kernel/arch/sparc32/src/exception.c
r3d1956b r679dc0c 140 140 } 141 141 142 voidsyscall(sysarg_t a1, sysarg_t a2, sysarg_t a3, sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id)142 sysarg_t syscall(sysarg_t a1, sysarg_t a2, sysarg_t a3, sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id) 143 143 { 144 144 printf("syscall %d\n", id); 145 syscall_handler(a1, a2, a3, a4, a5, a6, id); 145 printf("args: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", a1, a2, a3, a4, a5, a6); 146 return syscall_handler(a1, a2, a3, a4, a5, a6, id); 146 147 } 147 148 -
kernel/arch/sparc32/src/trap_table.S
r3d1956b r679dc0c 83 83 /* Save next window to kernel stack or UWB */ 84 84 .macro inline_save_kernel 85 mov %wim, %g2 85 mov %wim, %l3 86 sll %l3, 7, %l4 87 srl %l3, 1, %l3 88 or %l3, %l4, %l3 89 and %l3, 0xff, %l3 90 86 91 mov %g0, %wim 87 92 save … … 95 100 std %i6, [%sp + 56] 96 101 restore 97 mov % g2, %wim102 mov %l3, %wim 98 103 .endm 99 104 100 105 .macro inline_save_uspace uwb 101 mov %wim, %g2 102 mov %g0, %wim 106 mov %wim, %l3 107 sll %l3, 7, %l4 108 srl %l3, 1, %l3 109 or %l3, %l4, %l3 110 and %l3, 0xff, %l3 111 mov \uwb, %g3 112 103 113 save 104 std %l0, [ \uwb+ 0]105 std %l2, [ \uwb+ 8]106 std %l4, [ \uwb+ 16]107 std %l6, [ \uwb+ 24]108 std %i0, [ \uwb+ 32]109 std %i2, [ \uwb+ 40]110 std %i4, [ \uwb+ 48]111 std %i6, [ \uwb+ 56]114 std %l0, [%g3 + 0] 115 std %l2, [%g3 + 8] 116 std %l4, [%g3 + 16] 117 std %l6, [%g3 + 24] 118 std %i0, [%g3 + 32] 119 std %i2, [%g3 + 40] 120 std %i4, [%g3 + 48] 121 std %i6, [%g3 + 56] 112 122 add \uwb, 64, \uwb 113 123 restore 114 mov % g2, %wim124 mov %l3, %wim 115 125 .endm 116 126 … … 165 175 save 166 176 177 sub \uwb, 64, \uwb 167 178 ldd [\uwb + 0], %l0 168 179 ldd [\uwb + 8], %l2 … … 173 184 ldd [\uwb + 48], %i4 174 185 ldd [\uwb + 56], %i6 175 sub \uwb, 64, \uwb176 186 save 177 187 … … 180 190 181 191 .macro if_from_kernel label 182 mov %psr, % g2183 and % g2, (1 << 6), %g2184 cmp % g2, 0192 mov %psr, %l3 193 and %l3, (1 << 6), %l3 194 cmp %l3, 0 185 195 bne \label 186 196 nop … … 245 255 /* dump registers to stack */ 246 256 save 247 st %l0, [%sp + 0] ! XXX248 257 std %l0, [%sp + 0] 249 258 std %l2, [%sp + 8] … … 261 270 mov %psr, %g7 262 271 and %g7, 0x7, %g7 263 inc%g7272 or %g7, 0x10, %g7 264 273 265 274 2: save … … 272 281 std %i4, [%g6 + 48] 273 282 std %i6, [%g6 + 56] 274 add %g 4, 64, %g4283 add %g6, 64, %g6 275 284 276 285 /* check whether it's the last user window to be saved */ 286 and %g7, 0x7, %l5 277 287 mov %psr, %l4 278 288 and %l4, 0x7, %l4 279 inc %l4 280 cmp %g7, %l4 289 cmp %l5, %l4 281 290 bne 3f 282 291 nop … … 384 393 /* set uspace window mark */ 385 394 mov %psr, %l7 395 inc %l7 386 396 and %l7, 0x7, %l7 387 inc %l7 397 or %l7, 0x10, %l7 398 b 4f 399 nop 388 400 389 401 3: /* Trap originated from kernel */ … … 397 409 /* set uspace window mark */ 398 410 mov %g6, %l7 411 inc %l7 399 412 and %l7, 0x7, %l7 400 inc%l7413 or %l7, 0x10, %l7 401 414 /* Save stack pointer */ 402 415 mov %l5, %g7 … … 406 419 407 420 5: /* Set up stack frame */ 408 sub %sp, 1 12, %sp421 sub %sp, 120, %sp 409 422 410 423 /* Save trap data on stack */ … … 413 426 st %l2, [%sp + 96] 414 427 st %l0, [%sp + 100] 428 st %g1, [%sp + 104] 429 st %g2, [%sp + 108] 430 st %g3, [%sp + 112] 431 st %g4, [%sp + 116] 415 432 416 433 /* Enable traps */ … … 431 448 ld [%sp + 96], %l2 432 449 ld [%sp + 100], %l0 450 ld [%sp + 104], %g1 451 ld [%sp + 108], %g2 452 ld [%sp + 112], %g3 453 ld [%sp + 116], %g4 433 454 mov %l0, %psr 434 455 nop … … 450 471 get_cwp %g7 451 472 inc %g7 473 and %g7, 0x7, %g7 452 474 cmp %g6, %g7 453 475 bne 8f … … 456 478 457 479 inline_restore_uspace %g1 480 switch_to_invalid %g5, %g6 481 mov %g1, %l6 482 switch_back %g5, %g6 458 483 b 8f 459 484 nop … … 528 553 529 554 inline_restore_uspace %g1 555 switch_to_invalid %g5, %g6 556 mov %g1, %l6 557 switch_back %g5, %g6 530 558 b 8f 531 559 nop … … 547 575 if_from_kernel 3f 548 576 577 /* Trap originated from uspace */ 549 578 /* Kernel stack pointer is at %l5, uwb is at %l6 */ 550 579 inline_save_uspace %l6 551 3: inline_save_kernel 580 581 /* set uspace window mark */ 582 mov %psr, %l7 583 inc %l7 584 and %l7, 0x7, %l7 585 or %l7, 0x10, %l7 586 b 4f 587 nop 588 589 3: /* Trap originated from kernel */ 590 inline_save_kernel 552 591 553 592 4: /* Check whether previous mode was usermode */ … … 556 595 /* Load kernel stack pointer from invalid window */ 557 596 switch_to_invalid %g5, %g6 597 558 598 /* set uspace window mark */ 559 599 mov %g6, %l7 600 inc %l7 560 601 and %l7, 0x7, %l7 561 inc %l7 602 or %l7, 0x10, %l7 603 562 604 /* Save stack pointer */ 563 605 mov %l5, %g7 564 606 switch_back %g5, %g6 565 607 mov %g7, %sp 566 mov %sp, %fp 567 5: sub %sp, 112, %sp 608 // mov %sp, %fp 609 610 5: /* Set up stack frame */ 611 sub %sp, 120, %sp 568 612 569 613 /* Save trap data on stack */ … … 572 616 st %l2, [%sp + 96] 573 617 st %l0, [%sp + 100] 618 st %g1, [%sp + 104] 619 st %g2, [%sp + 108] 620 st %g3, [%sp + 112] 621 st %g4, [%sp + 116] 574 622 575 623 /* Enable traps */ … … 597 645 ld [%sp + 96], %l2 598 646 ld [%sp + 100], %l0 647 ld [%sp + 104], %g1 648 ld [%sp + 108], %g2 649 ld [%sp + 112], %g3 650 ld [%sp + 116], %g4 651 652 mov %o0, %i0 599 653 mov %l0, %psr 600 654 nop … … 616 670 get_cwp %g7 617 671 inc %g7 672 and %g7, 0x7, %g7 618 673 cmp %g6, %g7 619 674 bne 8f … … 622 677 623 678 inline_restore_uspace %g1 679 switch_to_invalid %g5, %g6 680 mov %g1, %l6 681 switch_back %g5, %g6 624 682 b 8f 625 683 nop 626 684 627 685 7: inline_restore_kernel 628 629 686 630 687 8: jmp %l2
Note:
See TracChangeset
for help on using the changeset viewer.