mirror of https://github.com/ARMmbed/mbed-os.git
Call the pre-start event unprivileged
parent
1e18ea230a
commit
409ecf6be6
|
@ -505,10 +505,6 @@ osStatus svcKernelStart (void) {
|
||||||
|
|
||||||
if (os_running) { return osOK; }
|
if (os_running) { return osOK; }
|
||||||
|
|
||||||
if (osEventObs && osEventObs->pre_start) {
|
|
||||||
osEventObs->pre_start();
|
|
||||||
}
|
|
||||||
|
|
||||||
rt_tsk_prio(0U, os_tsk.run->prio_base); // Restore priority
|
rt_tsk_prio(0U, os_tsk.run->prio_base); // Restore priority
|
||||||
if (os_tsk.run->task_id == 0xFFU) { // Idle Thread
|
if (os_tsk.run->task_id == 0xFFU) { // Idle Thread
|
||||||
__set_PSP(os_tsk.run->tsk_stack + (8U*4U)); // Setup PSP
|
__set_PSP(os_tsk.run->tsk_stack + (8U*4U)); // Setup PSP
|
||||||
|
@ -567,6 +563,15 @@ osStatus osKernelStart (void) {
|
||||||
if (__get_IPSR() != 0U) {
|
if (__get_IPSR() != 0U) {
|
||||||
return osErrorISR; // Not allowed in ISR
|
return osErrorISR; // Not allowed in ISR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Call the pre-start event (from unprivileged mode) if the handler exists
|
||||||
|
* and the kernel is not running. */
|
||||||
|
/* FIXME osEventObs needs to be readable but not writable from unprivileged
|
||||||
|
* code. */
|
||||||
|
if (!osKernelRunning() && osEventObs && osEventObs->pre_start) {
|
||||||
|
osEventObs->pre_start();
|
||||||
|
}
|
||||||
|
|
||||||
switch (__get_CONTROL() & 0x03U) {
|
switch (__get_CONTROL() & 0x03U) {
|
||||||
case 0x00U: // Privileged Thread mode & MSP
|
case 0x00U: // Privileged Thread mode & MSP
|
||||||
__set_PSP((uint32_t)(stack + 8)); // Initial PSP
|
__set_PSP((uint32_t)(stack + 8)); // Initial PSP
|
||||||
|
|
|
@ -51,5 +51,11 @@ const OsEventObserver *osEventObs;
|
||||||
|
|
||||||
void osRegisterForOsEvents(const OsEventObserver *observer)
|
void osRegisterForOsEvents(const OsEventObserver *observer)
|
||||||
{
|
{
|
||||||
|
static uint8_t has_been_called = 0;
|
||||||
|
if (has_been_called) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
has_been_called = 1;
|
||||||
|
|
||||||
osEventObs = observer;
|
osEventObs = observer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue