git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
physical page list mapping
[lunaix-os.git]
/
lunaix-os
/
arch
/
aarch64
/
exception
/
context.S
diff --git
a/lunaix-os/arch/aarch64/exception/context.S
b/lunaix-os/arch/aarch64/exception/context.S
index cbb7cf4a823cd4873893542eb88faad5eba0f61e..23e875b99639707de984273d346f1052f43f30be 100644
(file)
--- a/
lunaix-os/arch/aarch64/exception/context.S
+++ b/
lunaix-os/arch/aarch64/exception/context.S
@@
-1,6
+1,12
@@
#define __ASM__
#include <asm/aa64_msrs.h>
#define __ASM__
#include <asm/aa64_msrs.h>
-#include "hart_field.inc"
+#include <asm/bits.h>
+#include "hart_fields.inc"
+
+.section .data
+ .align 4
+ .skip 256
+ _aa64_csw_temp_stack:
.section .text
.section .text
@@
-8,10
+14,12
@@
.globl _aa64_switch_task
_aa64_evec_prehandle:
.globl _aa64_switch_task
_aa64_evec_prehandle:
- stp xzr, elr, [sp, #-16]! # push {xzr , elr}
- stp spsr, xzr, [sp, #-16]! # push {spsr, xzr}
+ // reservation for struct exec_param
+ sub sp, sp, #8 // push xzr
+ sub sp, sp, #16 // push {sp_el0, link}
+ sub sp, sp, #16 // push {spsr, parent_hart}
- stp lr, fp, [sp, #-16]!
#
push {x31-x1}
+ stp lr, fp, [sp, #-16]!
//
push {x31-x1}
stp x28, x27, [sp, #-16]!
stp x26, x25, [sp, #-16]!
stp x24, x23, [sp, #-16]!
stp x28, x27, [sp, #-16]!
stp x26, x25, [sp, #-16]!
stp x24, x23, [sp, #-16]!
@@
-26,21
+34,24
@@
stp x6, x5, [sp, #-16]!
stp x4, x3, [sp, #-16]!
stp x2, x1, [sp, #-16]!
stp x6, x5, [sp, #-16]!
stp x4, x3, [sp, #-16]!
stp x2, x1, [sp, #-16]!
- stp x0, xzr, [sp, #-16]!
#
push {x0, xzr}
+ stp x0, xzr, [sp, #-16]!
//
push {x0, xzr}
add x1, sp, #hart_execp
mrs x0, SP_EL0
str x0, [x1, #execp_spel0_saved]
add x1, sp, #hart_execp
mrs x0, SP_EL0
str x0, [x1, #execp_spel0_saved]
-
- sub x0, sp, #hart_end
- str x0, [x1, #execp_spel1_saved]
+
+ mrs x0, ELR_E1
+ str x0, [x1, #execp_link]
+
+ mrs x0, SPSR_EL1
+ str x0, [x1, #execp_spsr]
mov x0, sp
bl handle_exception
do_eret:
mov x0, sp
bl handle_exception
do_eret:
- mov sp, x0
+ add sp, x0, xzr
add x1, x0, #hart_execp
add x1, x0, #hart_execp
@@
-72,12
+83,30
@@
ldp x27, x28, [sp, #16]!
ldp fp, lr, [sp, #16]!
ldp x27, x28, [sp, #16]!
ldp fp, lr, [sp, #16]!
-
#
sp now point to the start of exec_param
+
//
sp now point to the start of exec_param
- ldr sp, [sp, #execp_spel1_saved]
+ sub sp, sp, #execp_end
eret
_aa64_switch_task:
eret
_aa64_switch_task:
- # TODO
- b do_eret
\ No newline at end of file
+ // TODO
+ adr sp, _aa64_csw_temp_stack
+
+ bl aa64_switch_ttbr
+
+ bl switch_signposting
+ cbnz x0, _aa64_handle_signal
+
+ b do_eret
+
+ _aa64_handle_signal:
+ mov x1, #SPSR_EL0_preset
+ msr SPSR_EL1, x1
+
+ ldr x1, [x0, #sigact]
+ msr ELR_E1, x1
+
+ msr SP_EL0, x0
+
+ eret
\ No newline at end of file