summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/risc-v64/gnu/inc/tx_port.h7
-rw-r--r--ports/risc-v64/gnu/src/tx_thread_context_restore.S14
-rw-r--r--ports/risc-v64/gnu/src/tx_thread_context_save.S2
-rw-r--r--ports/risc-v64/gnu/src/tx_thread_schedule.S10
-rw-r--r--ports/risc-v64/gnu/src/tx_thread_stack_build.S4
-rw-r--r--ports/risc-v64/gnu/src/tx_thread_system_return.S10
-rw-r--r--ports/risc-v64/gnu/src/tx_timer_interrupt.S8
7 files changed, 28 insertions, 27 deletions
diff --git a/ports/risc-v64/gnu/inc/tx_port.h b/ports/risc-v64/gnu/inc/tx_port.h
index 6a70c0fe..9bf16704 100644
--- a/ports/risc-v64/gnu/inc/tx_port.h
+++ b/ports/risc-v64/gnu/inc/tx_port.h
@@ -77,15 +77,16 @@ typedef char CHAR;
typedef unsigned char UCHAR;
typedef int INT;
typedef unsigned int UINT;
-typedef long LONG;
-typedef unsigned long ULONG;
+typedef int LONG;
+typedef unsigned int ULONG;
typedef unsigned long long ULONG64;
typedef short SHORT;
typedef unsigned short USHORT;
#define ULONG64_DEFINED
#endif /* __ASSEMBLER__ */
-
+#define ALIGN_TYPE_DEFINED
+typedef unsigned long long ALIGN_TYPE;
/* Define the priority levels for ThreadX. Legal values range
diff --git a/ports/risc-v64/gnu/src/tx_thread_context_restore.S b/ports/risc-v64/gnu/src/tx_thread_context_restore.S
index 9eea3df2..cebc8a06 100644
--- a/ports/risc-v64/gnu/src/tx_thread_context_restore.S
+++ b/ports/risc-v64/gnu/src/tx_thread_context_restore.S
@@ -78,9 +78,9 @@ _tx_thread_context_restore:
{ */
la t0, _tx_thread_system_state // Pickup addr of nested interrupt count
- ld t1, 0(t0) // Pickup nested interrupt count
+ lw t1, 0(t0) // Pickup nested interrupt count
addi t1, t1, -1 // Decrement the nested interrupt counter
- sd t1, 0(t0) // Store new nested count
+ sw t1, 0(t0) // Store new nested count
beqz t1, _tx_thread_not_nested_restore // If 0, not nested restore
/* Interrupts are nested. */
@@ -283,7 +283,7 @@ _tx_thread_no_preempt_restore:
/* Pickup the saved stack pointer. */
/* sp = _tx_thread_current_ptr -> tx_thread_stack_ptr; */
- ld sp, 16(t1) // Switch back to thread's stack
+ ld sp, 8(t1) // Switch back to thread's stack
/* Recover floating point registers. */
#if defined(__riscv_float_abi_single)
@@ -460,7 +460,7 @@ _tx_thread_preempt_restore:
/* Instead of directly activating the thread again, ensure we save the
entire stack frame by saving the remaining registers. */
- ld t0, 16(t1) // Pickup thread's stack pointer
+ ld t0, 8(t1) // Pickup thread's stack pointer
ori t3, zero, 1 // Build interrupt stack type
sd t3, 0(t0) // Store stack type
@@ -543,14 +543,14 @@ _tx_thread_preempt_restore:
{ */
la t0, _tx_timer_time_slice // Pickup time slice variable address
- ld t2, 0(t0) // Pickup time slice
+ lw t2, 0(t0) // Pickup time slice
beqz t2, _tx_thread_dont_save_ts // If 0, skip time slice processing
/* _tx_thread_current_ptr -> tx_thread_time_slice = _tx_timer_time_slice
_tx_timer_time_slice = 0; */
- sd t2, 48(t1) // Save current time slice
- sd x0, 0(t0) // Clear global time slice
+ sw t2, 36(t1) // Save current time slice
+ sw x0, 0(t0) // Clear global time slice
/* } */
diff --git a/ports/risc-v64/gnu/src/tx_thread_context_save.S b/ports/risc-v64/gnu/src/tx_thread_context_save.S
index 3ffcb6b6..7935bfee 100644
--- a/ports/risc-v64/gnu/src/tx_thread_context_save.S
+++ b/ports/risc-v64/gnu/src/tx_thread_context_save.S
@@ -312,7 +312,7 @@ _tx_thread_not_nested_save:
la t1, _tx_thread_current_ptr // Pickup current thread pointer address
ld t1, 0(t1) // Pickup current thread pointer
- sd sp, 16(t1) // Save stack pointer
+ sd sp, 8(t1) // Save stack pointer
#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
/* _tx_execution_isr_enter is called with thread stack pointer */
diff --git a/ports/risc-v64/gnu/src/tx_thread_schedule.S b/ports/risc-v64/gnu/src/tx_thread_schedule.S
index 401c7b1a..860adf0b 100644
--- a/ports/risc-v64/gnu/src/tx_thread_schedule.S
+++ b/ports/risc-v64/gnu/src/tx_thread_schedule.S
@@ -113,10 +113,10 @@ _tx_thread_schedule_loop:
/* Increment the run count for this thread. */
/* _tx_thread_current_ptr -> tx_thread_run_count++; */
- ld t2, 8(t1) // Pickup run count
- ld t3, 48(t1) // Pickup time slice value
+ lw t2, 4(t1) // Pickup run count
+ lw t3, 36(t1) // Pickup time slice value
addi t2, t2, 1 // Increment run count
- sd t2, 8(t1) // Store new run count
+ sw t2, 4(t1) // Store new run count
/* Setup time-slice, if present. */
/* _tx_timer_time_slice = _tx_thread_current_ptr -> tx_thread_time_slice; */
@@ -126,8 +126,8 @@ _tx_thread_schedule_loop:
/* Switch to the thread's stack. */
/* SP = _tx_thread_execute_ptr -> tx_thread_stack_ptr; */
- ld sp, 16(t1) // Switch to thread's stack
- sd t3, 0(t2) // Store new time-slice
+ ld sp, 8(t1) // Switch to thread's stack
+ sw t3, 0(t2) // Store new time-slice
#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
diff --git a/ports/risc-v64/gnu/src/tx_thread_stack_build.S b/ports/risc-v64/gnu/src/tx_thread_stack_build.S
index cc1cf2a3..86cab4f0 100644
--- a/ports/risc-v64/gnu/src/tx_thread_stack_build.S
+++ b/ports/risc-v64/gnu/src/tx_thread_stack_build.S
@@ -140,7 +140,7 @@ If vector extension support:
Stack Bottom: (higher memory address) */
- ld t0, 32(a0) // Pickup end of stack area
+ ld t0, 24(a0) // Pickup end of stack area
li t1, ~15 // Build 16-byte alignment mask
and t0, t0, t1 // Make sure 16-byte alignment
@@ -258,6 +258,6 @@ vector_clear_done:
/* Setup stack pointer. */
/* thread_ptr -> tx_thread_stack_ptr = t0; */
- sd t0, 16(a0) // Save stack pointer in thread's
+ sd t0, 8(a0) // Save stack pointer in thread's
ret // control block and return
/* } */
diff --git a/ports/risc-v64/gnu/src/tx_thread_system_return.S b/ports/risc-v64/gnu/src/tx_thread_system_return.S
index 8becb54b..583b3f3e 100644
--- a/ports/risc-v64/gnu/src/tx_thread_system_return.S
+++ b/ports/risc-v64/gnu/src/tx_thread_system_return.S
@@ -183,15 +183,15 @@ _tx_thread_system_return:
/* _tx_thread_current_ptr -> tx_thread_stack_ptr = SP;
SP = _tx_thread_system_stack_ptr; */
- sd sp, 16(t1) // Save stack pointer
- ld sp, 0(t2) // Switch to system stack
+ sd sp, 8(t1) // Save stack pointer
+ ld sp, 0(t2) // Switch to system stack
/* Determine if the time-slice is active. */
/* if (_tx_timer_time_slice)
{ */
la t4, _tx_timer_time_slice // Pickup time slice variable addr
- ld t3, 0(t4) // Pickup time slice value
+ lw t3, 0(t4) // Pickup time slice value
la t2, _tx_thread_schedule // Pickup address of scheduling loop
beqz t3, _tx_thread_dont_save_ts // If no time-slice, don't save it
@@ -199,8 +199,8 @@ _tx_thread_system_return:
/* _tx_thread_current_ptr -> tx_thread_time_slice = _tx_timer_time_slice;
_tx_timer_time_slice = 0; */
- sd t3, 48(t1) // Save current time-slice for thread
- sd zero, 0(t4) // Clear time-slice variable
+ sw t3, 36(t1) // Save current time-slice for thread
+ sw zero, 0(t4) // Clear time-slice variable
/* } */
_tx_thread_dont_save_ts:
diff --git a/ports/risc-v64/gnu/src/tx_timer_interrupt.S b/ports/risc-v64/gnu/src/tx_timer_interrupt.S
index 02b70461..53e572f3 100644
--- a/ports/risc-v64/gnu/src/tx_timer_interrupt.S
+++ b/ports/risc-v64/gnu/src/tx_timer_interrupt.S
@@ -66,11 +66,11 @@ _tx_timer_interrupt:
/* _tx_timer_system_clock++; */
la t0, _tx_timer_system_clock // Pickup address of system clock
- ld t1, 0(t0) // Pickup system clock
+ lw t1, 0(t0) // Pickup system clock
la t2, _tx_timer_time_slice // Pickup address of time slice
- ld t3, 0(t2) // Pickup time slice
+ lw t3, 0(t2) // Pickup time slice
addi t1, t1, 1 // Increment system clock
- sd t1, 0(t0) // Store new system clock
+ sw t1, 0(t0) // Store new system clock
li t6, 0 // Clear local expired flag
/* Test for time-slice expiration. */
@@ -83,7 +83,7 @@ _tx_timer_interrupt:
/* Decrement the time_slice. */
/* _tx_timer_time_slice--; */
- sd t3, 0(t2) // Store new time slice
+ sw t3, 0(t2) // Store new time slice
/* Check for expiration. */
/* if (_tx_timer_time_slice == 0) */