-
Notifications
You must be signed in to change notification settings - Fork 18
/
ucos2-patch2.patch
67 lines (61 loc) · 1.7 KB
/
ucos2-patch2.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
This patch fixes an issue that can arise when using the AES opcodes
on a Rabbit 6000. AES opcodes on Rabbit 6000 require canonical
ordering of Px/Px' registers. We maintain the ordering as well as
possible, but need to ensure that task switching doesn't throw it off.
The Dynamic C 10.72F release includes the patched UCOS2.LIB file, but
the uC/OS-II source isn't included in the Open Source GitHub code
repository. If your Dynamic C installation is based on 10.72E or
earlier, you will need to manually apply this fix using `patch`:
patch -p1 --forward < ucos2-patch2.patch
Include the command-line option "--dry-run" to test the patch. The
"--forward" option ignores the patch if already applied.
--- a/Lib/Rabbit4000/UCOS2/UCOS2.LIB
+++ b/Lib/Rabbit4000/UCOS2/UCOS2.LIB
@@ -2652,6 +2652,15 @@ OSCtxSw::
ex af, af'
push af
exx
+#if _RAB6K
+ push jkhl
+ push bcde
+ push iy
+ alts push pw
+ alts push px
+ alts push py
+ alts push pz
+#else
exp
push jkhl
push bcde
@@ -2660,13 +2669,21 @@ OSCtxSw::
push px
push py
push pz
-
+#endif
; Suspend this task and start running the highest-priority task. We will
; resume the suspended task when this function or the periodic ISR swaps
; our stack back and performs an LRET.
lcall oscs_1
- ; Resuming current task, need to restore registers from stack.
+#if _RAB6K
+ altd pop pz
+ altd pop py
+ altd pop px
+ altd pop pw
+ pop iy
+ pop bcde
+ pop jkhl
+#else
pop pz
pop py
pop px
@@ -2675,6 +2692,8 @@ OSCtxSw::
pop bcde
pop jkhl
exp
+#endif
+ ; Resuming current task, need to restore registers from stack.
exx
pop af
ex af, af'