diff options
Diffstat (limited to 'arch/ia64/kernel/entry.S')
-rw-r--r-- | arch/ia64/kernel/entry.S | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index ccfdeee9d89f..8dc69669586a 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <asm/processor.h> | 47 | #include <asm/processor.h> |
48 | #include <asm/thread_info.h> | 48 | #include <asm/thread_info.h> |
49 | #include <asm/unistd.h> | 49 | #include <asm/unistd.h> |
50 | #include <asm/ftrace.h> | ||
50 | 51 | ||
51 | #include "minstate.h" | 52 | #include "minstate.h" |
52 | 53 | ||
@@ -1404,6 +1405,105 @@ GLOBAL_ENTRY(unw_init_running) | |||
1404 | br.ret.sptk.many rp | 1405 | br.ret.sptk.many rp |
1405 | END(unw_init_running) | 1406 | END(unw_init_running) |
1406 | 1407 | ||
1408 | #ifdef CONFIG_FUNCTION_TRACER | ||
1409 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
1410 | GLOBAL_ENTRY(_mcount) | ||
1411 | br ftrace_stub | ||
1412 | END(_mcount) | ||
1413 | |||
1414 | .here: | ||
1415 | br.ret.sptk.many b0 | ||
1416 | |||
1417 | GLOBAL_ENTRY(ftrace_caller) | ||
1418 | alloc out0 = ar.pfs, 8, 0, 4, 0 | ||
1419 | mov out3 = r0 | ||
1420 | ;; | ||
1421 | mov out2 = b0 | ||
1422 | add r3 = 0x20, r3 | ||
1423 | mov out1 = r1; | ||
1424 | br.call.sptk.many b0 = ftrace_patch_gp | ||
1425 | //this might be called from module, so we must patch gp | ||
1426 | ftrace_patch_gp: | ||
1427 | movl gp=__gp | ||
1428 | mov b0 = r3 | ||
1429 | ;; | ||
1430 | .global ftrace_call; | ||
1431 | ftrace_call: | ||
1432 | { | ||
1433 | .mlx | ||
1434 | nop.m 0x0 | ||
1435 | movl r3 = .here;; | ||
1436 | } | ||
1437 | alloc loc0 = ar.pfs, 4, 4, 2, 0 | ||
1438 | ;; | ||
1439 | mov loc1 = b0 | ||
1440 | mov out0 = b0 | ||
1441 | mov loc2 = r8 | ||
1442 | mov loc3 = r15 | ||
1443 | ;; | ||
1444 | adds out0 = -MCOUNT_INSN_SIZE, out0 | ||
1445 | mov out1 = in2 | ||
1446 | mov b6 = r3 | ||
1447 | |||
1448 | br.call.sptk.many b0 = b6 | ||
1449 | ;; | ||
1450 | mov ar.pfs = loc0 | ||
1451 | mov b0 = loc1 | ||
1452 | mov r8 = loc2 | ||
1453 | mov r15 = loc3 | ||
1454 | br ftrace_stub | ||
1455 | ;; | ||
1456 | END(ftrace_caller) | ||
1457 | |||
1458 | #else | ||
1459 | GLOBAL_ENTRY(_mcount) | ||
1460 | movl r2 = ftrace_stub | ||
1461 | movl r3 = ftrace_trace_function;; | ||
1462 | ld8 r3 = [r3];; | ||
1463 | ld8 r3 = [r3];; | ||
1464 | cmp.eq p7,p0 = r2, r3 | ||
1465 | (p7) br.sptk.many ftrace_stub | ||
1466 | ;; | ||
1467 | |||
1468 | alloc loc0 = ar.pfs, 4, 4, 2, 0 | ||
1469 | ;; | ||
1470 | mov loc1 = b0 | ||
1471 | mov out0 = b0 | ||
1472 | mov loc2 = r8 | ||
1473 | mov loc3 = r15 | ||
1474 | ;; | ||
1475 | adds out0 = -MCOUNT_INSN_SIZE, out0 | ||
1476 | mov out1 = in2 | ||
1477 | mov b6 = r3 | ||
1478 | |||
1479 | br.call.sptk.many b0 = b6 | ||
1480 | ;; | ||
1481 | mov ar.pfs = loc0 | ||
1482 | mov b0 = loc1 | ||
1483 | mov r8 = loc2 | ||
1484 | mov r15 = loc3 | ||
1485 | br ftrace_stub | ||
1486 | ;; | ||
1487 | END(_mcount) | ||
1488 | #endif | ||
1489 | |||
1490 | GLOBAL_ENTRY(ftrace_stub) | ||
1491 | mov r3 = b0 | ||
1492 | movl r2 = _mcount_ret_helper | ||
1493 | ;; | ||
1494 | mov b6 = r2 | ||
1495 | mov b7 = r3 | ||
1496 | br.ret.sptk.many b6 | ||
1497 | |||
1498 | _mcount_ret_helper: | ||
1499 | mov b0 = r42 | ||
1500 | mov r1 = r41 | ||
1501 | mov ar.pfs = r40 | ||
1502 | br b7 | ||
1503 | END(ftrace_stub) | ||
1504 | |||
1505 | #endif /* CONFIG_FUNCTION_TRACER */ | ||
1506 | |||
1407 | .rodata | 1507 | .rodata |
1408 | .align 8 | 1508 | .align 8 |
1409 | .globl sys_call_table | 1509 | .globl sys_call_table |