Rev 993 | Rev 1053 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 993 | Rev 1023 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | * |
27 | * |
28 | */ |
28 | */ |
29 | 29 | ||
30 | #include <fpu_context.h> |
30 | #include <fpu_context.h> |
- | 31 | #include <arch/register.h> |
|
31 | #include <print.h> |
32 | #include <print.h> |
32 | 33 | ||
33 | void fpu_context_save(fpu_context_t *fctx){ |
34 | void fpu_context_save(fpu_context_t *fctx){ |
34 | return; |
- | |
35 | asm volatile( |
35 | asm volatile( |
36 | "stf.spill [%2]=f2,0x80\n" |
36 | "stf.spill [%2]=f2,0x80\n" |
37 | "stf.spill [%3]=f3,0x80\n" |
37 | "stf.spill [%3]=f3,0x80\n" |
38 | "stf.spill [%4]=f4,0x80\n" |
38 | "stf.spill [%4]=f4,0x80\n" |
39 | "stf.spill [%5]=f5,0x80\n" |
39 | "stf.spill [%5]=f5,0x80\n" |
Line 186... | Line 186... | ||
186 | } |
186 | } |
187 | 187 | ||
188 | 188 | ||
189 | void fpu_context_restore(fpu_context_t *fctx) |
189 | void fpu_context_restore(fpu_context_t *fctx) |
190 | { |
190 | { |
191 | return; |
- | |
192 | asm volatile( |
191 | asm volatile( |
193 | "ldf.fill f2=[%2],0x80\n" |
192 | "ldf.fill f2=[%2],0x80\n" |
194 | "ldf.fill f3=[%3],0x80\n" |
193 | "ldf.fill f3=[%3],0x80\n" |
195 | "ldf.fill f4=[%4],0x80\n" |
194 | "ldf.fill f4=[%4],0x80\n" |
196 | "ldf.fill f5=[%5],0x80\n" |
195 | "ldf.fill f5=[%5],0x80\n" |
Line 341... | Line 340... | ||
341 | ); |
340 | ); |
342 | 341 | ||
343 | 342 | ||
344 | } |
343 | } |
345 | 344 | ||
- | 345 | void fpu_disable(void) |
|
- | 346 | { |
|
- | 347 | asm volatile( |
|
- | 348 | "ssm %0;;\n" |
|
- | 349 | "srlz.i\n" |
|
- | 350 | "srlz.d;;\n" |
|
- | 351 | : |
|
- | 352 | :"i" (PSR_DFL_MASK|PSR_DFH_MASK) |
|
- | 353 | ); |
|
- | 354 | ||
- | 355 | } |
|
- | 356 | ||
- | 357 | void fpu_enable(void) |
|
- | 358 | { |
|
- | 359 | asm volatile( |
|
- | 360 | "rsm %0;;\n" |
|
- | 361 | "srlz.i\n" |
|
- | 362 | "srlz.d;;\n" |
|
- | 363 | : |
|
- | 364 | :"i" (PSR_DFL_MASK|PSR_DFH_MASK) |
|
- | 365 | ); |
|
- | 366 | ||
- | 367 | } |
|
- | 368 | ||
- | 369 | void fpu_init(void) |
|
- | 370 | { |
|
- | 371 | __u64 a = 0; |
|
- | 372 | fpu_enable(); |
|
- | 373 | asm volatile |
|
- | 374 | ( |
|
- | 375 | "mov %0=ar.fpsr;;\n" |
|
- | 376 | "or %0=%0,%1;;\n" |
|
- | 377 | "mov ar.fpsr=%0;;\n" |
|
- | 378 | : "+r" (a) |
|
- | 379 | : "r" (0x38) |
|
- | 380 | ); |
|
- | 381 | ||
- | 382 | asm volatile( |
|
- | 383 | "mov f2=f0\n" |
|
- | 384 | "mov f3=f0\n" |
|
- | 385 | "mov f4=f0\n" |
|
- | 386 | "mov f5=f0\n" |
|
- | 387 | "mov f6=f0\n" |
|
- | 388 | "mov f7=f0\n" |
|
- | 389 | "mov f8=f0\n" |
|
- | 390 | "mov f9=f0\n" |
|
- | 391 | ||
- | 392 | "mov f10=f0\n" |
|
- | 393 | "mov f11=f0\n" |
|
- | 394 | "mov f12=f0\n" |
|
- | 395 | "mov f13=f0\n" |
|
- | 396 | "mov f14=f0\n" |
|
- | 397 | "mov f15=f0\n" |
|
- | 398 | "mov f16=f0\n" |
|
- | 399 | "mov f17=f0\n" |
|
- | 400 | "mov f18=f0\n" |
|
- | 401 | "mov f19=f0\n" |
|
- | 402 | ||
- | 403 | "mov f20=f0\n" |
|
- | 404 | "mov f21=f0\n" |
|
- | 405 | "mov f22=f0\n" |
|
- | 406 | "mov f23=f0\n" |
|
- | 407 | "mov f24=f0\n" |
|
- | 408 | "mov f25=f0\n" |
|
- | 409 | "mov f26=f0\n" |
|
- | 410 | "mov f27=f0\n" |
|
- | 411 | "mov f28=f0\n" |
|
- | 412 | "mov f29=f0\n" |
|
- | 413 | ||
- | 414 | "mov f30=f0\n" |
|
- | 415 | "mov f31=f0\n" |
|
- | 416 | "mov f32=f0\n" |
|
- | 417 | "mov f33=f0\n" |
|
- | 418 | "mov f34=f0\n" |
|
- | 419 | "mov f35=f0\n" |
|
- | 420 | "mov f36=f0\n" |
|
- | 421 | "mov f37=f0\n" |
|
- | 422 | "mov f38=f0\n" |
|
- | 423 | "mov f39=f0\n" |
|
- | 424 | ||
- | 425 | "mov f40=f0\n" |
|
- | 426 | "mov f41=f0\n" |
|
- | 427 | "mov f42=f0\n" |
|
- | 428 | "mov f43=f0\n" |
|
- | 429 | "mov f44=f0\n" |
|
- | 430 | "mov f45=f0\n" |
|
- | 431 | "mov f46=f0\n" |
|
- | 432 | "mov f47=f0\n" |
|
- | 433 | "mov f48=f0\n" |
|
- | 434 | "mov f49=f0\n" |
|
- | 435 | ||
- | 436 | "mov f50=f0\n" |
|
- | 437 | "mov f51=f0\n" |
|
- | 438 | "mov f52=f0\n" |
|
- | 439 | "mov f53=f0\n" |
|
- | 440 | "mov f54=f0\n" |
|
- | 441 | "mov f55=f0\n" |
|
- | 442 | "mov f56=f0\n" |
|
- | 443 | "mov f57=f0\n" |
|
- | 444 | "mov f58=f0\n" |
|
- | 445 | "mov f59=f0\n" |
|
- | 446 | ||
- | 447 | "mov f60=f0\n" |
|
- | 448 | "mov f61=f0\n" |
|
- | 449 | "mov f62=f0\n" |
|
- | 450 | "mov f63=f0\n" |
|
- | 451 | "mov f64=f0\n" |
|
- | 452 | "mov f65=f0\n" |
|
- | 453 | "mov f66=f0\n" |
|
- | 454 | "mov f67=f0\n" |
|
- | 455 | "mov f68=f0\n" |
|
- | 456 | "mov f69=f0\n" |
|
- | 457 | ||
- | 458 | "mov f70=f0\n" |
|
- | 459 | "mov f71=f0\n" |
|
- | 460 | "mov f72=f0\n" |
|
- | 461 | "mov f73=f0\n" |
|
- | 462 | "mov f74=f0\n" |
|
- | 463 | "mov f75=f0\n" |
|
- | 464 | "mov f76=f0\n" |
|
- | 465 | "mov f77=f0\n" |
|
- | 466 | "mov f78=f0\n" |
|
- | 467 | "mov f79=f0\n" |
|
- | 468 | ||
- | 469 | "mov f80=f0\n" |
|
- | 470 | "mov f81=f0\n" |
|
- | 471 | "mov f82=f0\n" |
|
- | 472 | "mov f83=f0\n" |
|
- | 473 | "mov f84=f0\n" |
|
- | 474 | "mov f85=f0\n" |
|
- | 475 | "mov f86=f0\n" |
|
- | 476 | "mov f87=f0\n" |
|
- | 477 | "mov f88=f0\n" |
|
- | 478 | "mov f89=f0\n" |
|
- | 479 | ||
- | 480 | "mov f90=f0\n" |
|
- | 481 | "mov f91=f0\n" |
|
- | 482 | "mov f92=f0\n" |
|
- | 483 | "mov f93=f0\n" |
|
- | 484 | "mov f94=f0\n" |
|
- | 485 | "mov f95=f0\n" |
|
- | 486 | "mov f96=f0\n" |
|
- | 487 | "mov f97=f0\n" |
|
- | 488 | "mov f98=f0\n" |
|
- | 489 | "mov f99=f0\n" |
|
- | 490 | ||
- | 491 | "mov f100=f0\n" |
|
- | 492 | "mov f101=f0\n" |
|
- | 493 | "mov f102=f0\n" |
|
- | 494 | "mov f103=f0\n" |
|
- | 495 | "mov f104=f0\n" |
|
- | 496 | "mov f105=f0\n" |
|
- | 497 | "mov f106=f0\n" |
|
- | 498 | "mov f107=f0\n" |
|
- | 499 | "mov f108=f0\n" |
|
- | 500 | "mov f109=f0\n" |
|
- | 501 | ||
- | 502 | "mov f110=f0\n" |
|
- | 503 | "mov f111=f0\n" |
|
- | 504 | "mov f112=f0\n" |
|
- | 505 | "mov f113=f0\n" |
|
- | 506 | "mov f114=f0\n" |
|
- | 507 | "mov f115=f0\n" |
|
- | 508 | "mov f116=f0\n" |
|
- | 509 | "mov f117=f0\n" |
|
- | 510 | "mov f118=f0\n" |
|
- | 511 | "mov f119=f0\n" |
|
- | 512 | ||
- | 513 | "mov f120=f0\n" |
|
- | 514 | "mov f121=f0\n" |
|
- | 515 | "mov f122=f0\n" |
|
- | 516 | "mov f123=f0\n" |
|
- | 517 | "mov f124=f0\n" |
|
- | 518 | "mov f125=f0\n" |
|
- | 519 | "mov f126=f0\n" |
|
- | 520 | "mov f127=f0\n" |
|
346 | 521 | ||
- | 522 | ); |
|
- | 523 | ||
- | 524 | fpu_enable(); |
|
- | 525 | } |
|
347 | 526 |