Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep assembly functions in separate sections #1912

Merged
merged 4 commits into from
Nov 8, 2017

Conversation

jenswi-linaro
Copy link
Contributor

To get a more fine grained selection of which area (init, paged,
unpaged) an assembly function is assigned do the equivalent of
-ffunction-sections but in assembly.

Some functions has to be in specific places in the binary for a
successful boot, link script is updated accordingly.

Tested-by: Jens Wiklander jens.wiklander@linaro.org (QEMU v7/v8)
Signed-off-by: Jens Wiklander jens.wiklander@linaro.org

@@ -234,6 +233,7 @@ END_FUNC unhandled_cpu
.endif
.endm

.section .text.reset_vect_table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed?

@@ -817,6 +819,7 @@ UNWIND( .cantunwind)
UNWIND( .fnend)
END_FUNC thread_svc_handler

.section .text.thread_vect_table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed?

@@ -345,6 +346,7 @@ END_FUNC thread_unwind_user_mode
.endm


.section .text.thread_vect_table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed?

_core_pos:
.long get_core_pos - .

/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why move this block here? Just cosmetic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to avoid an assembler error, apparantly the adr instruction can only be performed on symbols in the same section.

@@ -244,6 +244,7 @@ UNWIND( .cantunwind)
UNWIND( .fnend)
END_FUNC sm_fiq_entry

.section .text.sm_vect_table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed?

@jenswi-linaro
Copy link
Contributor Author

"core: arm32: replace _start with reset() function" is needed also for this to have full effect.

@jenswi-linaro
Copy link
Contributor Author

Rebased

@@ -210,7 +211,7 @@ UNWIND( .cantunwind)
msr cpsr, r1
bx lr
UNWIND( .fnend)
END_FUNC thread_set_abt_sp
END_FUNC thread_set_und_sp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: unrelated fix, should be a separate commit


#else /* defined(CFG_WITH_ARM_TRUSTED_FW) */

LOCAL_FUNC reset_secondary , :
UNWIND( .fnstart)
UNWIND( .cantunwind)
ldr r0, =reset_vect_table
write_vbar r0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this an unrelated fix? (would deserve its own commit)

@jenswi-linaro
Copy link
Contributor Author

Split the commits

@jforissier
Copy link
Contributor

Thanks for splitting the commits.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>

Sets correct end tag for thread_set_und_sp()

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
To get a more fine grained selection of which area (init, paged,
unpaged) an assembly function is assigned do the equivalent of
-ffunction-sections but in assembly.

Some functions has to be in specific places in the binary for a
successful boot, link script is updated accordingly.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Renames _start to reset_vect_table and renames reset() to _start() in
order to avoid pulling in too much unpaged code via
reset_secondary()/cpu_on_handler().

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Sets reset vector in reset_secondary() to trap unexpected exceptions.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU v7/v8)
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
@jenswi-linaro
Copy link
Contributor Author

Tag applied

@jforissier jforissier merged commit 486754e into OP-TEE:master Nov 8, 2017
@jenswi-linaro jenswi-linaro deleted the asm_func_sections branch November 8, 2017 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants