Changed the default stack size for threads.

Fixed the critical section problems.

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>
This commit is contained in:
Himanshu Chauhan
2011-06-02 20:15:11 +05:30
parent b9931b4c38
commit 711ce0e469
4 changed files with 14 additions and 7 deletions

View File

@@ -32,6 +32,8 @@
.section .text
.extern atomCurrentContext
.extern at_preempt_count
/**
* Function that performs the contextSwitch. Whether its a voluntary release
* of CPU by thread or a pre-emption, under both conditions this function is
@@ -145,7 +147,15 @@ __unwind_int_context:
RESTORE_INT_CONTEXT
__ret_from_switch:
la k0, at_preempt_count
lw k1, (k0)
addi k1, k1, -1
sw k1, (k0)
bnez k1, __return_from_int
nop
enable_global_interrupts
ehb
__return_from_int:
eret
/**

View File

@@ -39,7 +39,7 @@
#define _STR
/* Default thread stack size (in bytes) */
#define TEST_THREAD_STACK_SIZE 128
#define TEST_THREAD_STACK_SIZE 8192
/* Uncomment to enable logging of stack usage to UART */
/* #define TESTS_LOG_STACK_USAGE */

View File

@@ -78,12 +78,9 @@ extern uint32_t at_preempt_count;
\
if (at_preempt_count == 0) { \
if (atomCurrentContext()) { \
printk("+"); \
__asm__ __volatile__("ei %0\t\n" \
"ehb\t\n" \
::"r"(status_reg));\
} else { \
printk("."); \
} \
} \
\

View File

@@ -48,7 +48,7 @@
* In this case, the idle stack is allocated on the BSS via the
* idle_thread_stack[] byte array.
*/
#define IDLE_STACK_SIZE_BYTES 4096
#define IDLE_STACK_SIZE_BYTES 8192
/*
@@ -122,10 +122,10 @@
static ATOM_TCB main_tcb;
/* Main thread's stack area */
static uint8_t main_thread_stack[MAIN_STACK_SIZE_BYTES] __attribute__((aligned (4)));
static uint8_t main_thread_stack[MAIN_STACK_SIZE_BYTES];
/* Idle thread's stack area */
static uint8_t idle_thread_stack[IDLE_STACK_SIZE_BYTES] __attribute__((aligned (4)));
static uint8_t idle_thread_stack[IDLE_STACK_SIZE_BYTES];
/* Forward declarations */
static void main_thread_func (uint32_t data);