summaryrefslogtreecommitdiff
path: root/ports/rxv3/gnu/src
diff options
context:
space:
mode:
authorYuxin Zhou <[email protected]>2022-02-01 23:21:49 -0800
committerYuxin Zhou <[email protected]>2022-02-01 23:21:49 -0800
commitfd403521e9ef8c3c0bffed2910334c119dd11c80 (patch)
tree73177c87e0c92090d7a419064340f78f1add78ee /ports/rxv3/gnu/src
parentf7f0957188d48ec5278107dc8fbd2de747fda1b8 (diff)
Add rxv1, v2, v3 port: removed system state macro, added missing interrupt control defines, and added missing thread preemption logic.
Diffstat (limited to 'ports/rxv3/gnu/src')
-rw-r--r--ports/rxv3/gnu/src/tx_initialize_low_level.S4
-rw-r--r--ports/rxv3/gnu/src/tx_thread_context_restore.S4
-rw-r--r--ports/rxv3/gnu/src/tx_thread_context_save.S4
-rw-r--r--ports/rxv3/gnu/src/tx_thread_interrupt_control.S4
-rw-r--r--ports/rxv3/gnu/src/tx_thread_schedule.S4
-rw-r--r--ports/rxv3/gnu/src/tx_thread_stack_build.S4
-rw-r--r--ports/rxv3/gnu/src/tx_thread_system_return.S4
-rw-r--r--ports/rxv3/gnu/src/tx_timer_interrupt.S27
8 files changed, 47 insertions, 8 deletions
diff --git a/ports/rxv3/gnu/src/tx_initialize_low_level.S b/ports/rxv3/gnu/src/tx_initialize_low_level.S
index eb403fb2..54876912 100644
--- a/ports/rxv3/gnu/src/tx_initialize_low_level.S
+++ b/ports/rxv3/gnu/src/tx_initialize_low_level.S
@@ -29,7 +29,7 @@
;/* FUNCTION RELEASE */
;/* */
;/* _tx_initialize_low_level RXv3/GNURX */
-;/* 6.1.9 */
+;/* 6.1.10 */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Microsoft Corporation */
@@ -65,6 +65,8 @@
;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
;/* 10-15-2021 William E. Lamie Modified comment(s), */
;/* resulting in version 6.1.9 */
+;/* 01-31-2022 William E. Lamie Modified comment(s), */
+;/* resulting in version 6.1.10 */
;/* */
;/**************************************************************************/
.global __tx_initialize_low_level
diff --git a/ports/rxv3/gnu/src/tx_thread_context_restore.S b/ports/rxv3/gnu/src/tx_thread_context_restore.S
index ff7f740d..0785de15 100644
--- a/ports/rxv3/gnu/src/tx_thread_context_restore.S
+++ b/ports/rxv3/gnu/src/tx_thread_context_restore.S
@@ -46,7 +46,7 @@
;/* FUNCTION RELEASE */
;/* */
;/* _tx_thread_context_restore RXv3/GNURX */
-;/* 6.1.9 */
+;/* 6.1.10 */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Microsoft Corporation */
@@ -82,6 +82,8 @@
;/* 10-15-2021 William E. Lamie Modified comment(s), and */
;/* added FPU support, */
;/* resulting in version 6.1.9 */
+;/* 01-31-2022 William E. Lamie Modified comment(s), */
+;/* resulting in version 6.1.10 */
;/* */
;/**************************************************************************/
;VOID _tx_thread_context_restore(VOID)
diff --git a/ports/rxv3/gnu/src/tx_thread_context_save.S b/ports/rxv3/gnu/src/tx_thread_context_save.S
index 765a91bc..b9a53685 100644
--- a/ports/rxv3/gnu/src/tx_thread_context_save.S
+++ b/ports/rxv3/gnu/src/tx_thread_context_save.S
@@ -40,7 +40,7 @@
;/* FUNCTION RELEASE */
;/* */
;/* _tx_thread_context_save RXv3/GNURX */
-;/* 6.1.9 */
+;/* 6.1.10 */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Microsoft Corporation */
@@ -74,6 +74,8 @@
;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
;/* 10-15-2021 William E. Lamie Modified comment(s), */
;/* resulting in version 6.1.9 */
+;/* 01-31-2022 William E. Lamie Modified comment(s), */
+;/* resulting in version 6.1.10 */
;/* */
;/**************************************************************************/
;VOID _tx_thread_context_save(VOID)
diff --git a/ports/rxv3/gnu/src/tx_thread_interrupt_control.S b/ports/rxv3/gnu/src/tx_thread_interrupt_control.S
index fc44e754..9ffee489 100644
--- a/ports/rxv3/gnu/src/tx_thread_interrupt_control.S
+++ b/ports/rxv3/gnu/src/tx_thread_interrupt_control.S
@@ -35,7 +35,7 @@
;/* FUNCTION RELEASE */
;/* */
;/* _tx_thread_interrupt_control RXv3/GNURX */
-;/* 6.1.9 */
+;/* 6.1.10 */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Microsoft Corporation */
@@ -68,6 +68,8 @@
;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
;/* 10-15-2021 William E. Lamie Modified comment(s), */
;/* resulting in version 6.1.9 */
+;/* 01-31-2022 William E. Lamie Modified comment(s), */
+;/* resulting in version 6.1.10 */
;/* */
;/**************************************************************************/
;UINT _tx_thread_interrupt_control(UINT new_posture)
diff --git a/ports/rxv3/gnu/src/tx_thread_schedule.S b/ports/rxv3/gnu/src/tx_thread_schedule.S
index 904ca03e..61fc0d88 100644
--- a/ports/rxv3/gnu/src/tx_thread_schedule.S
+++ b/ports/rxv3/gnu/src/tx_thread_schedule.S
@@ -42,7 +42,7 @@
;/* FUNCTION RELEASE */
;/* */
;/* _tx_thread_schedule RXv3/GNURX */
-;/* 6.1.9 */
+;/* 6.1.10 */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Microsoft Corporation */
@@ -79,6 +79,8 @@
;/* 10-15-2021 William E. Lamie Modified comment(s), and */
;/* added FPU support, */
;/* resulting in version 6.1.9 */
+;/* 01-31-2022 William E. Lamie Modified comment(s), */
+;/* resulting in version 6.1.10 */
;/* */
;/**************************************************************************/
;VOID _tx_thread_schedule(VOID)
diff --git a/ports/rxv3/gnu/src/tx_thread_stack_build.S b/ports/rxv3/gnu/src/tx_thread_stack_build.S
index 7240d55c..90422211 100644
--- a/ports/rxv3/gnu/src/tx_thread_stack_build.S
+++ b/ports/rxv3/gnu/src/tx_thread_stack_build.S
@@ -36,7 +36,7 @@
;/* FUNCTION RELEASE */
;/* */
;/* _tx_thread_stack_build RXv3/GNURX */
-;/* 6.1.9 */
+;/* 6.1.10 */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Microsoft Corporation */
@@ -71,6 +71,8 @@
;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
;/* 10-15-2021 William E. Lamie Modified comment(s), */
;/* resulting in version 6.1.9 */
+;/* 01-31-2022 William E. Lamie Modified comment(s), */
+;/* resulting in version 6.1.10 */
;/* */
;/**************************************************************************/
;VOID _tx_thread_stack_build(TX_THREAD *thread_ptr, VOID (*function_ptr)(VOID))
diff --git a/ports/rxv3/gnu/src/tx_thread_system_return.S b/ports/rxv3/gnu/src/tx_thread_system_return.S
index 653be9b3..f995cbe4 100644
--- a/ports/rxv3/gnu/src/tx_thread_system_return.S
+++ b/ports/rxv3/gnu/src/tx_thread_system_return.S
@@ -40,7 +40,7 @@
;/* FUNCTION RELEASE */
;/* */
;/* _tx_thread_system_return RXv3/GNURX */
-;/* 6.1.9 */
+;/* 6.1.10 */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Microsoft Corporation */
@@ -76,6 +76,8 @@
;/* 10-15-2021 William E. Lamie Modified comment(s), and */
;/* removed unused code, */
;/* resulting in version 6.1.9 */
+;/* 01-31-2022 William E. Lamie Modified comment(s), */
+;/* resulting in version 6.1.10 */
;/* */
;/**************************************************************************/
;VOID _tx_thread_system_return(VOID)
diff --git a/ports/rxv3/gnu/src/tx_timer_interrupt.S b/ports/rxv3/gnu/src/tx_timer_interrupt.S
index f7b5e8b8..dcb30b2f 100644
--- a/ports/rxv3/gnu/src/tx_timer_interrupt.S
+++ b/ports/rxv3/gnu/src/tx_timer_interrupt.S
@@ -32,6 +32,7 @@
;
;Define Assembly language external references...
;
+ .equ SWI0, 872E0H
.global __tx_timer_time_slice
.global __tx_timer_system_clock
.global __tx_timer_current_ptr
@@ -43,6 +44,9 @@
.global __tx_thread_context_save
.global __tx_thread_time_slice
.global __tx_thread_context_restore
+ .global __tx_thread_preempt_disable
+ .global __tx_thread_execute_ptr
+ .global __tx_thread_current_ptr
;
.SECTION P,CODE
;/**************************************************************************/
@@ -50,7 +54,7 @@
;/* FUNCTION RELEASE */
;/* */
;/* _tx_timer_interrupt RXv3/GNURX */
-;/* 6.1.9 */
+;/* 6.1.10 */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Microsoft Corporation */
@@ -89,6 +93,10 @@
;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
;/* 10-15-2021 William E. Lamie Modified comment(s), */
;/* resulting in version 6.1.9 */
+;/* 01-31-2022 William E. Lamie Modified comment(s), and */
+;/* added missing thread */
+;/* preemption logic, */
+;/* resulting in version 6.1.10 */
;/* */
;/**************************************************************************/
;VOID _tx_timer_interrupt(VOID)
@@ -236,6 +244,23 @@ __tx_timer_dont_activate:
; _tx_thread_time_slice();
BSR __tx_thread_time_slice ; Call time-slice processing
+
+; /* Check if we must trigger a context switch. */
+ MOV.L #__tx_thread_preempt_disable, R1 ; Load prempt disable flag.
+ MOV.L [R1], R1
+ CMP #0, R1
+ BNE __tx_timer_not_ts_expiration ; Skip if prempt disabled.
+
+ MOV.L #__tx_thread_execute_ptr, R1
+ MOV.L [R1], R1
+ MOV.L #__tx_thread_current_ptr, R2
+ MOV.L [R2], R2
+ CMP R1, R2
+ BEQ __tx_timer_not_ts_expiration
+
+ MOV.L #SWI0, R1
+ MOV.L #1, [R1]
+
; }
;
__tx_timer_not_ts_expiration: