|
| 1 | +/* |
| 2 | + * Copyright (c) 2013-2016 ARM Limited. All rights reserved. |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + * |
| 6 | + * Licensed under the Apache License, Version 2.0 (the License); you may |
| 7 | + * not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| 14 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + * |
| 18 | + * ----------------------------------------------------------------------------- |
| 19 | + * |
| 20 | + * Project: CMSIS-RTOS RTX |
| 21 | + * Title: OS Event Observer |
| 22 | + * |
| 23 | + * ----------------------------------------------------------------------------- |
| 24 | + */ |
| 25 | +#include "rt_OsEventObserver.h" |
| 26 | + |
| 27 | +/* |
| 28 | + * _____ _____ ____ __ _____ |
| 29 | + * | ___|_ _\ \/ / \/ | ____| |
| 30 | + * | |_ | | \ /| |\/| | _| |
| 31 | + * | _| | | / \| | | | |___ |
| 32 | + * |_| |___/_/\_\_| |_|_____| |
| 33 | + * |
| 34 | + * FIXME: |
| 35 | + * The osEventObs variable must be in protected memory. If not every box |
| 36 | + * and box 0 can modify osEventObs to point to any handler to run code |
| 37 | + * privileged. This issue is tracked at |
| 38 | + * <https://github.com/ARMmbed/uvisor/issues/235>. |
| 39 | + */ |
| 40 | +const OsEventObserver *osEventObs; |
| 41 | + |
| 42 | +void osRegisterForOsEvents(const OsEventObserver *observer) |
| 43 | +{ |
| 44 | + static uint8_t has_been_called = 0; |
| 45 | + if (has_been_called) { |
| 46 | + return; |
| 47 | + } |
| 48 | + has_been_called = 1; |
| 49 | + |
| 50 | + osEventObs = observer; |
| 51 | +} |
0 commit comments