diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-04-24 04:20:43 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-04-26 03:07:01 -0400 |
commit | dc7ee00d4771b3218b10e09e1071ee6eb176d381 (patch) | |
tree | 18eb16aa67cadf8d4bb880b8443563d2fb47cf43 /arch/s390/kernel/entry.S | |
parent | b8668fd0a7e1b59ff4fd33b65e7f6d46b2d3cf1c (diff) |
s390: lowcore stack pointer offsets
Store the stack pointers in the lowcore for the kernel stack, the async
stack and the panic stack with the offset required for the first user.
This avoids an unnecessary add instruction on the system call path.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/entry.S')
-rw-r--r-- | arch/s390/kernel/entry.S | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index 94feff7d6132..17d5cc057893 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S | |||
@@ -45,6 +45,7 @@ _TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \ | |||
45 | 45 | ||
46 | STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER | 46 | STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER |
47 | STACK_SIZE = 1 << STACK_SHIFT | 47 | STACK_SIZE = 1 << STACK_SHIFT |
48 | STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE | ||
48 | 49 | ||
49 | #define BASED(name) name-system_call(%r13) | 50 | #define BASED(name) name-system_call(%r13) |
50 | 51 | ||
@@ -97,10 +98,10 @@ STACK_SIZE = 1 << STACK_SHIFT | |||
97 | sra %r14,\shift | 98 | sra %r14,\shift |
98 | jnz 1f | 99 | jnz 1f |
99 | CHECK_STACK 1<<\shift,\savearea | 100 | CHECK_STACK 1<<\shift,\savearea |
101 | ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) | ||
100 | j 2f | 102 | j 2f |
101 | 1: l %r15,\stack # load target stack | 103 | 1: l %r15,\stack # load target stack |
102 | 2: ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) | 104 | 2: la %r11,STACK_FRAME_OVERHEAD(%r15) |
103 | la %r11,STACK_FRAME_OVERHEAD(%r15) | ||
104 | .endm | 105 | .endm |
105 | 106 | ||
106 | .macro ADD64 high,low,timer | 107 | .macro ADD64 high,low,timer |
@@ -150,7 +151,7 @@ ENTRY(__switch_to) | |||
150 | l %r4,__THREAD_info(%r2) # get thread_info of prev | 151 | l %r4,__THREAD_info(%r2) # get thread_info of prev |
151 | l %r5,__THREAD_info(%r3) # get thread_info of next | 152 | l %r5,__THREAD_info(%r3) # get thread_info of next |
152 | lr %r15,%r5 | 153 | lr %r15,%r5 |
153 | ahi %r15,STACK_SIZE # end of kernel stack of next | 154 | ahi %r15,STACK_INIT # end of kernel stack of next |
154 | st %r3,__LC_CURRENT # store task struct of next | 155 | st %r3,__LC_CURRENT # store task struct of next |
155 | st %r5,__LC_THREAD_INFO # store thread info of next | 156 | st %r5,__LC_THREAD_INFO # store thread info of next |
156 | st %r15,__LC_KERNEL_STACK # store end of kernel stack | 157 | st %r15,__LC_KERNEL_STACK # store end of kernel stack |
@@ -178,7 +179,6 @@ sysc_stm: | |||
178 | l %r13,__LC_SVC_NEW_PSW+4 | 179 | l %r13,__LC_SVC_NEW_PSW+4 |
179 | sysc_per: | 180 | sysc_per: |
180 | l %r15,__LC_KERNEL_STACK | 181 | l %r15,__LC_KERNEL_STACK |
181 | ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) | ||
182 | la %r11,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs | 182 | la %r11,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs |
183 | sysc_vtime: | 183 | sysc_vtime: |
184 | UPDATE_VTIME %r8,%r9,__LC_SYNC_ENTER_TIMER | 184 | UPDATE_VTIME %r8,%r9,__LC_SYNC_ENTER_TIMER |
@@ -359,11 +359,11 @@ ENTRY(pgm_check_handler) | |||
359 | tm __LC_PGM_ILC+3,0x80 # check for per exception | 359 | tm __LC_PGM_ILC+3,0x80 # check for per exception |
360 | jnz pgm_svcper # -> single stepped svc | 360 | jnz pgm_svcper # -> single stepped svc |
361 | 0: CHECK_STACK STACK_SIZE,__LC_SAVE_AREA_SYNC | 361 | 0: CHECK_STACK STACK_SIZE,__LC_SAVE_AREA_SYNC |
362 | ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) | ||
362 | j 2f | 363 | j 2f |
363 | 1: UPDATE_VTIME %r14,%r15,__LC_SYNC_ENTER_TIMER | 364 | 1: UPDATE_VTIME %r14,%r15,__LC_SYNC_ENTER_TIMER |
364 | l %r15,__LC_KERNEL_STACK | 365 | l %r15,__LC_KERNEL_STACK |
365 | 2: ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) | 366 | 2: la %r11,STACK_FRAME_OVERHEAD(%r15) |
366 | la %r11,STACK_FRAME_OVERHEAD(%r15) | ||
367 | stm %r0,%r7,__PT_R0(%r11) | 367 | stm %r0,%r7,__PT_R0(%r11) |
368 | mvc __PT_R8(32,%r11),__LC_SAVE_AREA_SYNC | 368 | mvc __PT_R8(32,%r11),__LC_SAVE_AREA_SYNC |
369 | stm %r8,%r9,__PT_PSW(%r11) | 369 | stm %r8,%r9,__PT_PSW(%r11) |
@@ -485,7 +485,6 @@ io_work: | |||
485 | # | 485 | # |
486 | io_work_user: | 486 | io_work_user: |
487 | l %r1,__LC_KERNEL_STACK | 487 | l %r1,__LC_KERNEL_STACK |
488 | ahi %r1,-(STACK_FRAME_OVERHEAD + __PT_SIZE) | ||
489 | mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) | 488 | mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) |
490 | xc __SF_BACKCHAIN(4,%r1),__SF_BACKCHAIN(%r1) | 489 | xc __SF_BACKCHAIN(4,%r1),__SF_BACKCHAIN(%r1) |
491 | la %r11,STACK_FRAME_OVERHEAD(%r1) | 490 | la %r11,STACK_FRAME_OVERHEAD(%r1) |
@@ -646,7 +645,6 @@ mcck_skip: | |||
646 | tm __PT_PSW+1(%r11),0x01 # returning to user ? | 645 | tm __PT_PSW+1(%r11),0x01 # returning to user ? |
647 | jno mcck_return | 646 | jno mcck_return |
648 | l %r1,__LC_KERNEL_STACK # switch to kernel stack | 647 | l %r1,__LC_KERNEL_STACK # switch to kernel stack |
649 | ahi %r1,-(STACK_FRAME_OVERHEAD + __PT_SIZE) | ||
650 | mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) | 648 | mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) |
651 | xc __SF_BACKCHAIN(4,%r1),__SF_BACKCHAIN(%r1) | 649 | xc __SF_BACKCHAIN(4,%r1),__SF_BACKCHAIN(%r1) |
652 | la %r11,STACK_FRAME_OVERHEAD(%r15) | 650 | la %r11,STACK_FRAME_OVERHEAD(%r15) |
@@ -674,6 +672,7 @@ mcck_panic: | |||
674 | sra %r14,PAGE_SHIFT | 672 | sra %r14,PAGE_SHIFT |
675 | jz 0f | 673 | jz 0f |
676 | l %r15,__LC_PANIC_STACK | 674 | l %r15,__LC_PANIC_STACK |
675 | j mcck_skip | ||
677 | 0: ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) | 676 | 0: ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) |
678 | j mcck_skip | 677 | j mcck_skip |
679 | 678 | ||
@@ -714,12 +713,10 @@ ENTRY(restart_int_handler) | |||
714 | */ | 713 | */ |
715 | stack_overflow: | 714 | stack_overflow: |
716 | l %r15,__LC_PANIC_STACK # change to panic stack | 715 | l %r15,__LC_PANIC_STACK # change to panic stack |
717 | ahi %r15,-__PT_SIZE # create pt_regs | 716 | la %r11,STACK_FRAME_OVERHEAD(%r15) |
718 | stm %r0,%r7,__PT_R0(%r15) | 717 | stm %r0,%r7,__PT_R0(%r11) |
719 | stm %r8,%r9,__PT_PSW(%r15) | 718 | stm %r8,%r9,__PT_PSW(%r11) |
720 | mvc __PT_R8(32,%r11),0(%r14) | 719 | mvc __PT_R8(32,%r11),0(%r14) |
721 | lr %r15,%r11 | ||
722 | ahi %r15,-STACK_FRAME_OVERHEAD | ||
723 | l %r1,BASED(1f) | 720 | l %r1,BASED(1f) |
724 | xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) | 721 | xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) |
725 | lr %r2,%r11 # pass pointer to pt_regs | 722 | lr %r2,%r11 # pass pointer to pt_regs |
@@ -799,15 +796,14 @@ cleanup_system_call: | |||
799 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER | 796 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER |
800 | # set up saved register 11 | 797 | # set up saved register 11 |
801 | l %r15,__LC_KERNEL_STACK | 798 | l %r15,__LC_KERNEL_STACK |
802 | ahi %r15,-__PT_SIZE | 799 | la %r9,STACK_FRAME_OVERHEAD(%r15) |
803 | st %r15,12(%r11) # r11 pt_regs pointer | 800 | st %r9,12(%r11) # r11 pt_regs pointer |
804 | # fill pt_regs | 801 | # fill pt_regs |
805 | mvc __PT_R8(32,%r15),__LC_SAVE_AREA_SYNC | 802 | mvc __PT_R8(32,%r9),__LC_SAVE_AREA_SYNC |
806 | stm %r0,%r7,__PT_R0(%r15) | 803 | stm %r0,%r7,__PT_R0(%r9) |
807 | mvc __PT_PSW(8,%r15),__LC_SVC_OLD_PSW | 804 | mvc __PT_PSW(8,%r9),__LC_SVC_OLD_PSW |
808 | mvc __PT_INT_CODE(4,%r15),__LC_SVC_ILC | 805 | mvc __PT_INT_CODE(4,%r9),__LC_SVC_ILC |
809 | # setup saved register 15 | 806 | # setup saved register 15 |
810 | ahi %r15,-STACK_FRAME_OVERHEAD | ||
811 | st %r15,28(%r11) # r15 stack pointer | 807 | st %r15,28(%r11) # r15 stack pointer |
812 | # set new psw address and exit | 808 | # set new psw address and exit |
813 | l %r9,BASED(cleanup_table+4) # sysc_do_svc + 0x80000000 | 809 | l %r9,BASED(cleanup_table+4) # sysc_do_svc + 0x80000000 |