Changeset e6a3bfee in mainline
- Timestamp:
- 2013-10-30T07:10:32Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bbb94545
- Parents:
- 817d939
- Location:
- kernel/arch/sparc32
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc32/Makefile.inc
r817d939 re6a3bfee 40 40 41 41 BITS = 32 42 ENDIANESS = LE42 ENDIANESS = BE 43 43 44 44 ARCH_SOURCES = \ 45 45 arch/$(KARCH)/src/start.S \ 46 46 arch/$(KARCH)/src/trap_table.S \ 47 arch/$(KARCH)/src/regwin_test.S \ 47 48 arch/$(KARCH)/src/context.S \ 48 49 arch/$(KARCH)/src/debug/stacktrace.c \ -
kernel/arch/sparc32/src/machine/leon3/leon3.c
r817d939 re6a3bfee 107 107 { 108 108 *start = LEON3_SDRAM_START; 109 *size = machine.bootinfo->memsize;109 *size = 64 * 1024 * 1024;//machine.bootinfo->memsize; 110 110 } 111 111 … … 142 142 static void leon3_input_init(void) 143 143 { 144 #if 0 144 145 grlib_uart_t *scons_inst; 145 146 146 147 if (machine.scons_dev) { 147 148 /* Create input device. */ … … 158 159 } 159 160 } 161 #endif 160 162 } 161 163 -
kernel/arch/sparc32/src/mm/frame.c
r817d939 re6a3bfee 36 36 37 37 #include <mm/frame.h> 38 #include <arch/machine_func.h> 38 39 #include <arch/mm/frame.h> 39 40 #include <config.h> -
kernel/arch/sparc32/src/sparc32.c
r817d939 re6a3bfee 78 78 } 79 79 80 extern void func1(void); 81 80 82 void arch_post_mm_init(void) 81 83 { 84 /* Test register windows */ 85 write_to_invalid(0xdeadbeef, 0xcafebabe, 0xfeedface); 86 func1(); 87 82 88 machine_init(&machine_bootinfo); 83 89 -
kernel/arch/sparc32/src/start.S
r817d939 re6a3bfee 54 54 sub %sp, 96, %sp 55 55 56 mov %o1, %i0 56 mov %o1, %l1 57 set 0xdeadbeef, %o0 58 set 0xdeadbeef, %o1 59 set 0, %o2 60 call write_to_invalid 61 nop 62 63 mov %l1, %o1 57 64 call arch_pre_main 58 65 nop -
kernel/arch/sparc32/src/trap_table.S
r817d939 re6a3bfee 43 43 clr \reg 44 44 mov %wim, %g5 45 1: inc \reg 45 1: andcc %g5, 1, %g0 46 bne 2f 47 nop 46 48 srl %g5, 1, %g5 47 andcc %g5, 1, %g0 48 bne 1b 49 nop 49 inc \reg 50 b 1b 51 2: nop 52 50 53 .endm 51 54 … … 60 63 mov %g0, %wim ! clear WIM 61 64 mov %psr, \saved_psr ! read PSR 62 or \saved_psr, %g6, %g6 ! set CWP 65 and \saved_psr, 0xfffffff0, %l0 66 or %l0, %g6, %g6 ! set CWP 63 67 mov %g6, %psr ! write PSR 64 68 nop … … 79 83 /* Save next window to kernel stack or UWB */ 80 84 .macro inline_save_kernel 85 set 0x80000100, %g2 86 set 'k', %g1 87 sta %g1, [%g2] 0x1c 81 88 save 82 89 std %l0, [%sp + 0] … … 92 99 93 100 .macro inline_save_uspace uwb 101 set 0x80000100, %g2 102 set 'u', %g1 103 sta %g1, [%g2] 0x1c 94 104 save 95 105 ld [\uwb], %g1 … … 144 154 145 155 write_to_invalid: 146 mov %o0, %g5 147 mov %o1, %g6 156 ! Write value 1 157 mov %o0, %g7 158 switch_to_invalid %g3, %g4 159 mov %g7, %l5 160 switch_back %g3, %g4 161 ! Write value 2 162 mov %o1, %g7 163 switch_to_invalid %g3, %g4 164 mov %g7, %l6 165 switch_back %g3, %g4 166 ! Write value 3 148 167 mov %o2, %g7 149 168 switch_to_invalid %g3, %g4 150 mov %g5, %l5151 mov %g6, %l6152 169 mov %g7, %l7 153 170 switch_back %g3, %g4 … … 173 190 nop; nop; nop 174 191 175 /* Check whether previous mode was usermode */176 mov %psr, %l0177 and %l0, (1 << 6), %l0178 cmp %l0, 0179 beq 1f180 nop181 182 192 /* Save invalid window data */ 183 193 mov %l5, %g5 ! kernel stack pointer 184 194 mov %l6, %g6 ! kernel wbuf 185 195 mov %l7, %g7 196 197 /* Check whether previous mode was usermode */ 198 and %l0, (1 << 6), %l0 199 cmp %l0, 0 200 beq 1f 201 nop 202 203 /* kernel: */ 204 /* we should check whether window needs to be saved 205 * to kernel stack or uwb 206 */ 207 cmp %g7, 0 208 bne 2f 209 nop 186 210 187 211 /* dump registers to stack */ … … 195 219 std %i4, [%sp + 48] 196 220 std %i6, [%sp + 56] 197 b 2f 198 nop 221 b 3f 222 nop 223 224 1: /* uspace: */ 225 /* set uspace window mark */ 226 mov %psr, %g7 227 and %g7, 0x7, %g7 228 inc %g7 199 229 200 230 /* dump registers to uwb */ 201 1: save231 2: save 202 232 std %l0, [%g4 + 0] 203 233 std %l2, [%g4 + 8] … … 210 240 add %g4, 64, %g4 211 241 212 2: /* back to where we should be */242 3: /* back to where we should be */ 213 243 mov %g5, %l5 214 244 mov %g6, %l6 … … 242 272 beq 1f 243 273 nop 244 245 /* Save invalid window data */246 mov %l5, %g5 ! kernel stack pointer247 mov %l6, %g6 ! kernel wbuf248 mov %l7, %g7249 274 250 275 /* load registers from stack */ … … 278 303 st %g1, [%g2] 279 304 280 2: /* back to where we should be */ 305 2: /* Save invalid window data */ 306 mov %l5, %g5 ! kernel stack pointer 307 mov %l6, %g6 ! kernel wbuf 308 mov %l7, %g7 309 save 310 save 311 312 /* Restore invalid window data */ 281 313 mov %g5, %l5 282 314 mov %g6, %l6 283 315 mov %g7, %l7 284 save 285 save 286 287 /* set new value of window */ 316 317 /* Set new value of window */ 288 318 mov %l3,%wim 289 319 nop; nop; nop … … 304 334 if_from_kernel 3f 305 335 336 /* Trap originated from uspace */ 337 /* Kernel stack pointer is at %l5, uwb is at %l6 */ 338 inline_save_uspace %l6 339 340 /* set uspace window mark */ 341 mov %psr, %l7 342 and %l7, 0x7, %l7 343 inc %l7 344 345 3: /* Trap originated from kernel */ 346 inline_save_kernel 347 348 4: /* Check whether previous mode was usermode */ 349 if_from_kernel 5f 350 351 /* Load kernel stack pointer from invalid window */ 352 switch_to_invalid %g5, %g6 353 save 354 /* set uspace window mark */ 355 mov %psr, %l7 356 and %l7, 0x7, %l7 357 inc %l7 358 /* Save stack pointer */ 359 mov %l5, %g7 360 switch_back %g5, %g6 361 mov %g7, %sp 362 mov %sp, %fp 363 364 /* Set secondary invalid window mark */ 365 add %g7, 1, %l7 366 367 5: /* Set up stack frame */ 368 sub %sp, 112, %sp 369 370 /* Save trap data on stack */ 371 mov %psr, %l0 372 st %l1, [%fp - 4] 373 st %l2, [%fp - 8] 374 st %l0, [%fp - 12] 375 376 /* Enable traps */ 377 mov %psr, %l0 378 or %l0, (1 << 5), %l0 379 mov %l0, %psr 380 nop 381 nop 382 nop 383 nop 384 385 /* Jump to actual subroutine */ 386 call %o2 387 sub %fp, 12, %o1 388 389 /* Return from handler */ 390 ld [%fp - 4], %l1 391 ld [%fp - 8], %l2 392 ld [%fp - 12], %l0 393 mov %l0, %psr 394 nop 395 nop 396 nop 397 nop 398 nop 399 400 /* If trap originated from uspace, clear uspace window mark */ 401 if_from_kernel 6f 402 switch_to_invalid %g5, %g6 403 clr %l7 404 switch_back %g5, %g6 405 406 6: jmp %l1 407 rett %l2 408 409 interrupt_trap: 410 mov %psr, %l0 411 412 /* Check whether previous mode was usermode */ 413 and %l0, (1 << 6), %l0 414 cmp %l0, 0 415 bne 1f 416 nop 417 418 /* Set up stack */ 419 set kernel_sp, %l4 420 ld [%l4], %sp 421 mov %sp, %fp 422 1: sub %sp, 112, %sp 423 424 /* Save trap data on stack */ 425 mov %psr, %l0 426 st %l1, [%fp - 4] 427 st %l2, [%fp - 8] 428 st %l0, [%fp - 12] 429 430 /* Enable traps */ 431 mov %psr, %l0 432 or %l0, (1 << 5), %l0 433 mov %l0, %psr 434 nop 435 nop 436 nop 437 nop 438 439 /* Jump to actual subroutine */ 440 mov %g2, %o0 441 call exc_dispatch 442 sub %fp, 12, %o1 443 444 /* Return from handler */ 445 ld [%fp - 4], %l1 446 ld [%fp - 8], %l2 447 ld [%fp - 12], %l0 448 mov %l0, %psr 449 nop 450 nop 451 nop 452 nop 453 nop 454 jmp %l1 455 rett %l2 456 457 syscall_trap: 458 /* Check whether we landed in invalid window */ 459 get_wim_number %g6 460 get_cwp %g7 461 cmp %g6, %g7 462 bne 4f 463 nop 464 465 /* We are in invalid window. Check whether previous mode was usermode */ 466 if_from_kernel 3f 467 306 468 /* Kernel stack pointer is at %l5, uwb is at %l6 */ 307 469 inline_save_uspace %l6 … … 313 475 /* Load kernel stack pointer from invalid window */ 314 476 switch_to_invalid %g5, %g6 477 save 315 478 mov %l5, %g7 ! stack pointer 316 479 switch_back %g5, %g6 … … 335 498 336 499 /* Jump to actual subroutine */ 337 call %o2 338 sub %fp, 12, %o1 339 340 /* Return from handler */ 341 ld [%fp - 4], %l1 342 ld [%fp - 8], %l2 343 ld [%fp - 12], %l0 344 mov %l0, %psr 345 nop 346 nop 347 nop 348 nop 349 nop 350 jmp %l1 351 rett %l2 352 353 interrupt_trap: 354 mov %psr, %l0 355 356 /* Check whether previous mode was usermode */ 357 and %l0, (1 << 6), %l0 358 cmp %l0, 0 359 bne 1f 360 nop 361 362 /* Set up stack */ 363 set kernel_sp, %l4 364 ld [%l4], %sp 365 mov %sp, %fp 366 1: sub %sp, 112, %sp 367 368 /* Save trap data on stack */ 369 mov %psr, %l0 370 st %l1, [%fp - 4] 371 st %l2, [%fp - 8] 372 st %l0, [%fp - 12] 373 374 /* Enable traps */ 375 mov %psr, %l0 376 or %l0, (1 << 5), %l0 377 mov %l0, %psr 378 nop 379 nop 380 nop 381 nop 382 383 /* Jump to actual subroutine */ 384 mov %g2, %o0 385 call exc_dispatch 386 sub %fp, 12, %o1 387 388 /* Return from handler */ 389 ld [%fp - 4], %l1 390 ld [%fp - 8], %l2 391 ld [%fp - 12], %l0 392 mov %l0, %psr 393 nop 394 nop 395 nop 396 nop 397 nop 398 jmp %l1 399 rett %l2 400 401 syscall_trap: 402 mov %psr, %l0 403 404 /* Set up stack */ 405 set kernel_sp, %l4 406 ld [%l4], %sp 407 mov %sp, %fp 408 sub %sp, 112, %sp 409 410 /* Save trap data on stack */ 411 mov %psr, %l0 412 st %l1, [%fp - 4] 413 st %l2, [%fp - 8] 414 st %l0, [%fp - 12] 415 416 /* Enable traps */ 417 mov %psr, %l0 418 or %l0, (1 << 5), %l0 419 mov %l0, %psr 420 nop 421 nop 422 nop 423 nop 424 425 /* Jump to actual subroutine */ 426 sub %g2, 0x80, %g2 427 st %g2, [ %sp + 92 ] 428 mov %i0, %o1 500 sub %o0, 0x80, %o0 501 st %o0, [ %sp + 92 ] 502 mov %i0, %o0 429 503 mov %i1, %o1 430 504 mov %i2, %o2 … … 463 537 #define SYSCALL(_vector) \ 464 538 .org trap_table + _vector * TRAP_ENTRY_SIZE; \ 465 set _vector, % g2; \539 set _vector, %o0 ; \ 466 540 b syscall_trap ; \ 467 541 nop ;
Note:
See TracChangeset
for help on using the changeset viewer.