diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2017-04-27 11:36:40 +0200 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2018-06-12 10:31:14 +0200 |
commit | d55680993df9b6743506814d98b5cc1859828f8a (patch) | |
tree | 054dc45425fa1a6863f154b484036f26cc3ac13f /firmware/asm | |
parent | beef52c5f0832e2c36bb1523b51eb8721f851db5 (diff) |
Agptek Rocker: Initial commit
Change-Id: I26b51106c7b1c36a603fba6d521e917d79b5a95b
Diffstat (limited to 'firmware/asm')
-rw-r--r-- | firmware/asm/SOURCES | 4 | ||||
-rw-r--r-- | firmware/asm/mips/thread-mips32.c | 71 | ||||
-rw-r--r-- | firmware/asm/mips/thread.h | 17 |
3 files changed, 54 insertions, 38 deletions
diff --git a/firmware/asm/SOURCES b/firmware/asm/SOURCES index 5a1310ed65..eba5bd2cb6 100644 --- a/firmware/asm/SOURCES +++ b/firmware/asm/SOURCES @@ -15,9 +15,9 @@ mempcpy.c defined(CREATIVE_ZVx) || defined(SANSA_CONNECT) || defined(SANSA_FUZEPLUS) || \ defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \ defined(SAMSUNG_YPR1) || defined(DX50) || defined(DX90) || (defined(MROBE_500) && !defined(LCD_USE_DMA)) || \ - defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(SONY_NWZ_LINUX)) && \ + defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(SONY_NWZ_LINUX) || defined(AGPTEK_ROCKER)) && \ !defined(SIMULATOR) -#if LCD_DEPTH == 24 +#if LCD_DEPTH >= 24 lcd-as-memframe-24bit.c #else lcd-as-memframe.c diff --git a/firmware/asm/mips/thread-mips32.c b/firmware/asm/mips/thread-mips32.c index e754df7e29..19efb6eea9 100644 --- a/firmware/asm/mips/thread-mips32.c +++ b/firmware/asm/mips/thread-mips32.c @@ -26,24 +26,23 @@ *--------------------------------------------------------------------------- */ -void start_thread(void); /* Provide C access to ASM label */ -static void USED_ATTR _start_thread(void) +static void USED_ATTR start_thread(void *addr) { - /* t1 = context */ asm volatile ( - "start_thread: \n" ".set noreorder \n" ".set noat \n" - "lw $8, 4($9) \n" /* Fetch thread function pointer ($8 = t0, $9 = t1) */ - "lw $29, 36($9) \n" /* Set initial sp(=$29) */ - "jalr $8 \n" /* Start the thread */ - "sw $0, 44($9) \n" /* Clear start address */ + "lw $t9, 4(%0) \n" /* Fetch thread function pointer ($25 = t9) */ + "lw $sp, 40(%0) \n" /* Set initial sp(=$29) */ + "jalr $t9 \n" /* Start the thread */ + "sw $zero, 48(%0) \n" /* Clear start address */ ".set at \n" ".set reorder \n" + : : "r" (addr) : "t9" ); thread_exit(); } + /* Place context pointer in s0 slot, function pointer in s1 slot, and * start_thread pointer in context_start */ #define THREAD_STARTUP_INIT(core, thread, function) \ @@ -60,17 +59,18 @@ static inline void store_context(void* addr) asm volatile ( ".set noreorder \n" ".set noat \n" - "sw $16, 0(%0) \n" /* s0 */ - "sw $17, 4(%0) \n" /* s1 */ - "sw $18, 8(%0) \n" /* s2 */ - "sw $19, 12(%0) \n" /* s3 */ - "sw $20, 16(%0) \n" /* s4 */ - "sw $21, 20(%0) \n" /* s5 */ - "sw $22, 24(%0) \n" /* s6 */ - "sw $23, 28(%0) \n" /* s7 */ - "sw $30, 32(%0) \n" /* fp */ - "sw $29, 36(%0) \n" /* sp */ - "sw $31, 40(%0) \n" /* ra */ + "sw $s0, 0(%0) \n" /* s0 */ + "sw $s1, 4(%0) \n" /* s1 */ + "sw $s2, 8(%0) \n" /* s2 */ + "sw $s3, 12(%0) \n" /* s3 */ + "sw $s4, 16(%0) \n" /* s4 */ + "sw $s5, 20(%0) \n" /* s5 */ + "sw $s6, 24(%0) \n" /* s6 */ + "sw $s7, 28(%0) \n" /* s7 */ + "sw $gp, 32(%0) \n" /* gp */ + "sw $fp, 36(%0) \n" /* fp */ + "sw $sp, 40(%0) \n" /* sp */ + "sw $ra, 44(%0) \n" /* ra */ ".set at \n" ".set reorder \n" : : "r" (addr) @@ -86,26 +86,27 @@ static inline void load_context(const void* addr) asm volatile ( ".set noat \n" ".set noreorder \n" - "lw $8, 44(%0) \n" /* Get start address ($8 = t0) */ - "beqz $8, running \n" /* NULL -> already running */ + "lw $t9, 48(%0) \n" /* Get start address ($8 = t0) */ + "beqz $t9, running \n" /* NULL -> already running */ "nop \n" - "jr $8 \n" - "move $9, %0 \n" /* t1 = context */ + "jr $t9 \n" + "move $a0, %0 \n" /* a0 = context branch delay slot anyway */ "running: \n" - "lw $16, 0(%0) \n" /* s0 */ - "lw $17, 4(%0) \n" /* s1 */ - "lw $18, 8(%0) \n" /* s2 */ - "lw $19, 12(%0) \n" /* s3 */ - "lw $20, 16(%0) \n" /* s4 */ - "lw $21, 20(%0) \n" /* s5 */ - "lw $22, 24(%0) \n" /* s6 */ - "lw $23, 28(%0) \n" /* s7 */ - "lw $30, 32(%0) \n" /* fp */ - "lw $29, 36(%0) \n" /* sp */ - "lw $31, 40(%0) \n" /* ra */ + "lw $s0, 0(%0) \n" /* s0 */ + "lw $s1, 4(%0) \n" /* s1 */ + "lw $s2, 8(%0) \n" /* s2 */ + "lw $s3, 12(%0) \n" /* s3 */ + "lw $s4, 16(%0) \n" /* s4 */ + "lw $s5, 20(%0) \n" /* s5 */ + "lw $s6, 24(%0) \n" /* s6 */ + "lw $s7, 28(%0) \n" /* s7 */ + "lw $gp, 32(%0) \n" /* gp */ + "lw $fp, 36(%0) \n" /* fp */ + "lw $sp, 40(%0) \n" /* sp */ + "lw $ra, 44(%0) \n" /* ra */ ".set at \n" ".set reorder \n" - : : "r" (addr) : "t0", "t1" + : : "r" (addr) : "t9" ); } diff --git a/firmware/asm/mips/thread.h b/firmware/asm/mips/thread.h index ac37560a68..42b0f7049f 100644 --- a/firmware/asm/mips/thread.h +++ b/firmware/asm/mips/thread.h @@ -19,9 +19,24 @@ * ****************************************************************************/ +/* index offset register + * 0 0 $16 s0 + * 1 4 $17 s1 + * 2 8 $18 s2 + * 3 12 $19 s3 + * 4 16 $20 s4 + * 5 20 $21 s5 + * 6 24 $22 s6 + * 7 28 $23 s7 + * 8 32 $28 gp + * 9 36 $30 s8 (s8) + * 10 40 $29 sp + * 11 44 $31 ra + * 12 48 start + */ struct regs { - uint32_t r[9]; /* 0-32 - Registers s0-s7, fp */ + uint32_t r[10]; /* 0-32 - Registers s0-s7, gp, fp */ uint32_t sp; /* 36 - Stack pointer */ uint32_t ra; /* 40 - Return address */ uint32_t start; /* 44 - Thread start address, or NULL when started */ |