Download project files.
project1.elf:  file format elf32-littlenios2
There are 21 section headers, starting at offset 0x231f8 (in project1.elf): Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .entry PROGBITS 00800000 000074 000020 00 AX 0 0 32 [ 2] .exceptions PROGBITS 00800020 000094 0001a8 00 AX 0 0 4 [ 3] .text PROGBITS 008001c8 00023c 003af0 00 AX 0 0 4 [ 4] .rodata PROGBITS 00803cb8 003d2c 0001bc 00 A 0 0 4 [ 5] .rwdata PROGBITS 00803e74 003ee8 001b3c 00 WAp 0 0 4 [ 6] .bss NOBITS 008059b0 005a24 000214 00 WAp 0 0 4 [ 7] .sdram PROGBITS 00805bc4 005a24 000000 00 W 0 0 1
The .entry section contains (_reset) which intializes instruction cache and jumps to _start at the beginning of the .text section. (both routines are defined in crt0.S).
The _start routine does the following:
See symbol table.
The alt_load routine does the following:
The alt_main routine does the following:
See crt0.S.
00800000 <__reset>:
/* Assume the instruction cache size is always a power of two. */
#if NIOS2_ICACHE_SIZE > 0x8000
movhi r2, %hi(NIOS2_ICACHE_SIZE)
#else
movui r2, NIOS2_ICACHE_SIZE
800000: 00840014 movui r2,4096
#endif
0:
initi r2
800004: 1001483a initi r2
addi r2, r2, -NIOS2_ICACHE_LINE_SIZE
800008: 10bff804 addi r2,r2,-32
bgt r2, zero, 0b
80000c: 00bffd16 blt zero,r2,800004 <__alt_mem_sdram+0x4>
1:
/*
* The following debug information tells the ISS not to run the loop above
* but to perform its actions using faster internal code.
*/
.pushsection .debug_alt_sim_info
.int 1, 1, 0b, 1b
.popsection
#endif /* Initialize Instruction Cache */
/*
* Jump to the _start entry point in the .text section if reset code
* is allowed or if optimizing for RTL simulation.
*/
#if defined(ALT_ALLOW_CODE_AT_RESET) || defined(ALT_SIM_OPTIMIZE)
/* Jump to the _start entry point in the .text section. */
movhi r1, %hi(_start)
800010: 00402034 movhi at,128
ori r1, r1, %lo(_start)
800014: 08407214 ori at,at,456
jmp r1
800018: 0800683a jmp at
80001c: 00000000 call 0 <__alt_mem_sdram-0x800000>
00800020 <alt_exception>:
* caller saved registers on the stack (See the Nios2 ABI
* documentation for details).
*/
addi sp, sp, -76
800020: deffed04 addi sp,sp,-76
#ifdef ALT_STACK_CHECK
bltu sp, et, .Lstack_overflow
#endif
#endif
stw ra, 0(sp)
800024: dfc00015 stw ra,0(sp)
/*
* Leave a gap in the stack frame at 4(sp) for the muldiv handler to
* store zero into.
*/
stw r1, 8(sp)
800028: d8400215 stw at,8(sp)
stw r2, 12(sp)
80002c: d8800315 stw r2,12(sp)
stw r3, 16(sp)
800030: d8c00415 stw r3,16(sp)
stw r4, 20(sp)
800034: d9000515 stw r4,20(sp)
stw r5, 24(sp)
800038: d9400615 stw r5,24(sp)
stw r6, 28(sp)
80003c: d9800715 stw r6,28(sp)
stw r7, 32(sp)
800040: d9c00815 stw r7,32(sp)
rdctl r5, estatus
800044: 000b307a rdctl r5,estatus
stw r8, 36(sp)
800048: da000915 stw r8,36(sp)
stw r9, 40(sp)
80004c: da400a15 stw r9,40(sp)
stw r10, 44(sp)
800050: da800b15 stw r10,44(sp)
stw r11, 48(sp)
800054: dac00c15 stw r11,48(sp)
stw r12, 52(sp)
800058: db000d15 stw r12,52(sp)
stw r13, 56(sp)
80005c: db400e15 stw r13,56(sp)
stw r14, 60(sp)
800060: db800f15 stw r14,60(sp)
stw r15, 64(sp)
800064: dbc01015 stw r15,64(sp)
stw r5, 68(sp)
800068: d9401115 stw r5,68(sp)
addi r15, ea, -4 /* re-issue the interrupted instruction */
80006c: ebffff04 addi r15,ea,-4
stw r15, 72(sp)
800070: dbc01215 stw r15,72(sp)
/*
* Test to see if the exception was a software exception or caused
* by an external interrupt, and vector accordingly.
*/
rdctl r4, ipending
800074: 0009313a rdctl r4,ipending
andi r2, r5, 1
800078: 2880004c andi r2,r5,1
beq r2, zero, .Lnot_irq
80007c: 10000326 beq r2,zero,80008c <__ram_exceptions_start+0x6c>
beq r4, zero, .Lnot_irq
800080: 20000226 beq r4,zero,80008c <__ram_exceptions_start+0x6c>
#endif /* ALT_CI_INTERRUPT_VECTOR_N */
.section .exceptions.irqhandler, "xa"
/*
* Now that all necessary registers have been preserved, call
* alt_irq_handler() to process the interrupts.
*/
call alt_irq_handler
800084: 08000ec0 call 8000ec <alt_irq_handler>
.section .exceptions.irqreturn, "xa"
br .Lexception_exit
800088: 00000306 br 800098 <__ram_exceptions_start+0x78>
/*
* The interrupt testing code goes here. If an interrupt is active
* then it stores ea-4 into 72(sp), handles the interrupt and jumps to
* .exceptions.exit. If there is no interrupt then it continues
*/
.section .exceptions.notirq, "xa"
stw ea, 72(sp) /* Return after the instruction which caused the exception */
80008c: df401215 stw ea,72(sp)
ldw r2, -4(ea)
800090: e8bfff17 ldw r2,-4(ea)
/*
* The other exception handling code goes here.
*/
.section .exceptions.unknown
/*
* If you get here then one of the following could have happened:
*
* - Your program could have been compiled for a full-featured Nios II
* core, but it is running on a smaller core, and instruction emulation
* has been disabled by defining ALT_NO_INSTRUCTION_EMULATION.
*
* You can work around the problem by re-enabling instruction emulation,
* or you can figure out why your program is being compiled for a system
* other than the one that it is running on.
*
* - Your program has executed a trap instruction, but has not implemented
* a handler for this instruction.
*
* - Your program has executed an illegal instruction (one which is not
* defined in the instruction set).
*
* - Your hardware is broken and is generating spurious interrupts (a
* peripheral which deasserts its interrupt output before its interrupt
* handler has been executed will cause spurious interrupts).
*
*/
#ifdef NIOS2_HAS_DEBUG_STUB
/*
* Either tell the user now (if there is a debugger attached) or go into
* the debug monitor which will loop until a debugger is attached.
*/
break
800094: 003da03a break 0
#else
/*
* If there is no debug stub then a BREAK will probably cause a reboot.
* An infinate loop will probably be more useful.
*/
0:
br 0b
#endif
.section .exceptions.exit, "xa"
/*
* Restore the saved registers, so that all general purpose registers
* have been restored to their state at the time the interrupt occured.
*/
ldw r5, 68(sp)
800098: d9401117 ldw r5,68(sp)
ldw ea, 72(sp)
80009c: df401217 ldw ea,72(sp)
ldw ra, 0(sp)
8000a0: dfc00017 ldw ra,0(sp)
wrctl estatus, r5
8000a4: 2801707a wrctl estatus,r5
ldw r1, 8(sp)
8000a8: d8400217 ldw at,8(sp)
ldw r2, 12(sp)
8000ac: d8800317 ldw r2,12(sp)
ldw r3, 16(sp)
8000b0: d8c00417 ldw r3,16(sp)
ldw r4, 20(sp)
8000b4: d9000517 ldw r4,20(sp)
ldw r5, 24(sp)
8000b8: d9400617 ldw r5,24(sp)
ldw r6, 28(sp)
8000bc: d9800717 ldw r6,28(sp)
ldw r7, 32(sp)
8000c0: d9c00817 ldw r7,32(sp)
#ifdef ALT_EXCEPTION_STACK
#ifdef ALT_STACK_CHECK
ldw et, %gprel(alt_exception_old_stack_limit)(gp)
#endif
#endif
ldw r8, 36(sp)
8000c4: da000917 ldw r8,36(sp)
ldw r9, 40(sp)
8000c8: da400a17 ldw r9,40(sp)
ldw r10, 44(sp)
8000cc: da800b17 ldw r10,44(sp)
ldw r11, 48(sp)
8000d0: dac00c17 ldw r11,48(sp)
ldw r12, 52(sp)
8000d4: db000d17 ldw r12,52(sp)
ldw r13, 56(sp)
8000d8: db400e17 ldw r13,56(sp)
ldw r14, 60(sp)
8000dc: db800f17 ldw r14,60(sp)
ldw r15, 64(sp)
8000e0: dbc01017 ldw r15,64(sp)
#ifdef ALT_EXCEPTION_STACK
#ifdef ALT_STACK_CHECK
stw et, %gprel(alt_stack_limit_value)(gp)
stw zero, %gprel(alt_exception_old_stack_limit)(gp)
#endif
ldw sp, 76(sp)
#else
addi sp, sp, 76
8000e4: dec01304 addi sp,sp,76
#endif
/*
* Return to the interrupted instruction.
*/
eret
8000e8: e800083a eret
008000ec <alt_irq_handler>:
*/
void alt_irq_handler (void) __attribute__ ((section (".exceptions")));
void alt_irq_handler (void)
{
8000ec: defff904 addi sp,sp,-28
8000f0: dfc00615 stw ra,24(sp)
8000f4: df000515 stw fp,20(sp)
8000f8: d839883a mov fp,sp
static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_irq_pending (void)
{
alt_u32 active;
NIOS2_READ_IPENDING (active);
8000fc: 0005313a rdctl r2,ipending
800100: e0800415 stw r2,16(fp)
800104: e0800417 ldw r2,16(fp)
800108: e0800315 stw r2,12(fp)
80010c: e0800317 ldw r2,12(fp)
800110: e0800015 stw r2,0(fp)
#ifdef ALT_CI_INTERRUPT_VECTOR
alt_32 offset;
char* alt_irq_base = (char*)alt_irq;
#else
alt_u32 active;
alt_u32 mask;
alt_u32 i;
#endif /* ALT_CI_INTERRUPT_VECTOR */
/*
* Notify the operating system that we are at interrupt level.
*/
ALT_OS_INT_ENTER();
#ifdef ALT_CI_INTERRUPT_VECTOR
/*
* Call the interrupt vector custom instruction using the
* ALT_CI_INTERRUPT_VECTOR macro.
* It returns the offset into the vector table of the lowest-valued pending
* interrupt (corresponds to highest priority) or a negative value if none.
* The custom instruction assumes that each table entry is eight bytes.
*/
while ((offset = ALT_CI_INTERRUPT_VECTOR) >= 0) {
struct ALT_IRQ_HANDLER* handler_entry =
(struct ALT_IRQ_HANDLER*)(alt_irq_base + offset);
handler_entry->handler(handler_entry->context, offset >> 3);
}
#else
/*
* Obtain from the interrupt controller a bit list of pending interrupts,
* and then process the highest priority interrupt. This process loops,
* loading the active interrupt list on each pass until alt_irq_pending()
* return zero.
*
* The maximum interrupt latency for the highest priority interrupt is
* reduced by finding out which interrupts are pending as late as possible.
* Consider the case where the high priority interupt is asserted during
* the interrupt entry sequence for a lower priority interrupt to see why
* this is the case.
*/
active = alt_irq_pending ();
do
{
i = 0;
800114: e0000215 stw zero,8(fp)
mask = 1;
800118: 00800044 movi r2,1
80011c: e0800115 stw r2,4(fp)
/*
* Test each bit in turn looking for an active interrupt. Once one is
* found, the interrupt handler asigned by a call to alt_irq_register() is
* called to clear the interrupt condition.
*/
do
{
if (active & mask)
800120: e0c00017 ldw r3,0(fp)
800124: e0800117 ldw r2,4(fp)
800128: 1884703a and r2,r3,r2
80012c: 1005003a cmpeq r2,r2,zero
800130: 1000101e bne r2,zero,800174 <alt_irq_handler+0x88>
{
alt_irq[i].handler(alt_irq[i].context, i);
800134: 00c02034 movhi r3,128
800138: 18d66e04 addi r3,r3,22968
80013c: e0800217 ldw r2,8(fp)
800140: 10800224 muli r2,r2,8
800144: 10c9883a add r4,r2,r3
800148: 00c02034 movhi r3,128
80014c: 18d66e04 addi r3,r3,22968
800150: e0800217 ldw r2,8(fp)
800154: 10800224 muli r2,r2,8
800158: 10c5883a add r2,r2,r3
80015c: 10800104 addi r2,r2,4
800160: 20c00017 ldw r3,0(r4)
800164: 11000017 ldw r4,0(r2)
800168: e1400217 ldw r5,8(fp)
80016c: 183ee83a callr r3
break;
800170: 00000706 br 800190 <alt_irq_handler+0xa4>
}
mask <<= 1;
800174: e0800117 ldw r2,4(fp)
800178: 1085883a add r2,r2,r2
80017c: e0800115 stw r2,4(fp)
i++;
800180: e0800217 ldw r2,8(fp)
800184: 10800044 addi r2,r2,1
800188: e0800215 stw r2,8(fp)
} while (1);
80018c: 003fe406 br 800120 <alt_irq_handler+0x34>
static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_irq_pending (void)
{
alt_u32 active;
NIOS2_READ_IPENDING (active);
800190: 0005313a rdctl r2,ipending
800194: e0800315 stw r2,12(fp)
800198: e0800317 ldw r2,12(fp)
80019c: e0800415 stw r2,16(fp)
8001a0: e0800417 ldw r2,16(fp)
8001a4: e0800015 stw r2,0(fp)
active = alt_irq_pending ();
} while (active);
8001a8: e0800017 ldw r2,0(fp)
8001ac: 1005003a cmpeq r2,r2,zero
8001b0: 1000011e bne r2,zero,8001b8 <alt_irq_handler+0xcc>
8001b4: 003fd706 br 800114 <alt_irq_handler+0x28>
#endif /* ALT_CI_INTERRUPT_VECTOR */
/*
* Notify the operating system that interrupt processing is complete.
*/
ALT_OS_INT_EXIT();
}
8001b8: dfc00617 ldw ra,24(sp)
8001bc: df000517 ldw fp,20(sp)
8001c0: dec00704 addi sp,sp,28
8001c4: f800283a ret
008001c8 <_start>:
.size __reset, . - __reset
#endif /* Jump to _start */
/*
* When not using exit, provide an _exit symbol to prevent unresolved
* references to _exit from the linker script.
*/
#ifdef ALT_NO_EXIT
.globl _exit
_exit:
#endif
/*************************************************************************\
| TEXT SECTION (.text) |
\*************************************************************************/
/*
* Start of the .text section, and also the code entry point when
* the code is executed by a bootloader rather than directly from reset.
*/
.section .text
.align 2
.globl _start
.type _start, @function
_start:
/*
* Initialize the data cache if present (i.e. size > 0) and not
* optimizing for RTL simulation.
* RTL simulations can ensure the data cache is already initialized
* so skipping this loop speeds up RTL simulation.
*/
#if NIOS2_DCACHE_SIZE > 0 && !defined(ALT_SIM_OPTIMIZE)
/* Assume the data cache size is always a power of two. */
#if NIOS2_DCACHE_SIZE > 0x8000
movhi r2, %hi(NIOS2_DCACHE_SIZE)
#else
movui r2, NIOS2_DCACHE_SIZE
8001c8: 00820014 movui r2,2048
#endif
0:
initd 0(r2)
8001cc: 10000033 initd 0(r2)
addi r2, r2, -NIOS2_DCACHE_LINE_SIZE
8001d0: 10bff804 addi r2,r2,-32
bgt r2, zero, 0b
8001d4: 00bffd16 blt zero,r2,8001cc <__ram_exceptions_end+0x4>
1:
/*
* The following debug information tells the ISS not to run the loop above
* but to perform its actions using faster internal code.
*/
.pushsection .debug_alt_sim_info
.int 2, 1, 0b, 1b
.popsection
#endif /* Initialize Data Cache */
/* Log that caches have been initialized. */
ALT_LOG_PUTS(alt_log_msg_cache)
/* Log that the stack pointer is about to be setup. */
ALT_LOG_PUTS(alt_log_msg_stackpointer)
/*
* Now that the caches are initialized, set up the stack pointer.
* The value provided by the linker is assumed to be correctly aligned.
*/
movhi sp, %hi(__alt_stack_pointer)
8001d8: 06c04034 movhi sp,256
ori sp, sp, %lo(__alt_stack_pointer)
8001dc: dec00014 ori sp,sp,0
/* Set up the global pointer. */
movhi gp, %hi(_gp)
8001e0: 06802034 movhi gp,128
ori gp, gp, %lo(_gp)
8001e4: d6b65214 ori gp,gp,55624
/*
* Clear the BSS if not optimizing for RTL simulation.
*
* This uses the symbols: __bss_start and __bss_end, which are defined
* by the linker script. They mark the begining and the end of the bss
* region. The linker script guarantees that these values are word aligned.
*/
#ifndef ALT_SIM_OPTIMIZE
/* Log that the BSS is about to be cleared. */
ALT_LOG_PUTS(alt_log_msg_bss)
movhi r2, %hi(__bss_start)
8001e8: 00802034 movhi r2,128
ori r2, r2, %lo(__bss_start)
8001ec: 10966c14 ori r2,r2,22960
movhi r3, %hi(__bss_end)
8001f0: 00c02034 movhi r3,128
ori r3, r3, %lo(__bss_end)
8001f4: 18d6f114 ori r3,r3,23492
beq r2, r3, 1f
8001f8: 10c00326 beq r2,r3,800208 <__ram_exceptions_end+0x40>
0:
stw zero, (r2)
8001fc: 10000015 stw zero,0(r2)
addi r2, r2, 4
800200: 10800104 addi r2,r2,4
bltu r2, r3, 0b
800204: 10fffd36 bltu r2,r3,8001fc <__ram_exceptions_end+0x34>
1:
/*
* The following debug information tells the ISS not to run the loop above
* but to perform its actions using faster internal code.
*/
.pushsection .debug_alt_sim_info
.int 3, 1, 0b, 1b
.popsection
#endif /* ALT_SIM_OPTIMIZE */
/*
* The alt_load() facility is normally used when there is no bootloader.
* It copies some sections into RAM so it acts like a mini-bootloader.
*/
#ifdef CALL_ALT_LOAD
#ifdef ALT_STACK_CHECK
/*
* If the user has selected stack checking then we need to set up a safe
* value in the stack limit register so that the relocation functions
* don't think the stack has overflowed (the contents of the rwdata
* section aren't defined until alt_load() has been called).
*/
mov et, zero
#endif
call alt_load
800208: 08002e40 call 8002e4 <alt_load>
#endif /* CALL_ALT_LOAD */
#ifdef ALT_STACK_CHECK
/*
* Set up the stack limit (if required). The linker has set up the
* copy of the variable which is in memory.
*/
ldw et, %gprel(alt_stack_limit_value)(gp)
#endif
/* Log that alt_main is about to be called. */
ALT_LOG_PUTS(alt_log_msg_alt_main)
/* Call the C entry point. It should never return. */
call alt_main
80020c: 08003c80 call 8003c8 <alt_main>
00800210 <alt_after_alt_main>:
/* Wait in infinite loop in case alt_main does return. */
alt_after_alt_main:
br alt_after_alt_main
800210: 003fff06 br 800210 <alt_after_alt_main>
See main2.c
00800214 <main>:
int a = 14;
int b = -8;
int main()
{
800214: defffd04 addi sp,sp,-12
800218: dfc00215 stw ra,8(sp)
80021c: df000115 stw fp,4(sp)
800220: d839883a mov fp,sp
int c;
c = sign(a,b);
800224: d1200017 ldw r4,-32768(gp)
800228: d1600117 ldw r5,-32764(gp)
80022c: 08002880 call 800288 <sign>
800230: e0800015 stw r2,0(fp)
return 0;
800234: 0005883a mov r2,zero
}
800238: dfc00217 ldw ra,8(sp)
80023c: df000117 ldw fp,4(sp)
800240: dec00304 addi sp,sp,12
800244: f800283a ret
00800248 <abs>:
int abs(int a)
{
800248: defffd04 addi sp,sp,-12
80024c: df000215 stw fp,8(sp)
800250: d839883a mov fp,sp
800254: e1000015 stw r4,0(fp)
return (a<0? -a: a);
800258: e0800017 ldw r2,0(fp)
80025c: e0800115 stw r2,4(fp)
800260: e0800017 ldw r2,0(fp)
800264: 1004403a cmpge r2,r2,zero
800268: 1000031e bne r2,zero,800278 <abs+0x30>
80026c: e0800117 ldw r2,4(fp)
800270: 0085c83a sub r2,zero,r2
800274: e0800115 stw r2,4(fp)
800278: e0800117 ldw r2,4(fp)
}
80027c: df000217 ldw fp,8(sp)
800280: dec00304 addi sp,sp,12
800284: f800283a ret
00800288 <sign>:
int sign(int x, int y)
{
800288: defffc04 addi sp,sp,-16
80028c: df000315 stw fp,12(sp)
800290: d839883a mov fp,sp
800294: e1000015 stw r4,0(fp)
800298: e1400115 stw r5,4(fp)
return (y<0? -abs(x): abs(x));
80029c: e0800017 ldw r2,0(fp)
8002a0: e0800215 stw r2,8(fp)
8002a4: e0c00217 ldw r3,8(fp)
8002a8: 1804403a cmpge r2,r3,zero
8002ac: 1000031e bne r2,zero,8002bc <sign+0x34>
8002b0: e0800217 ldw r2,8(fp)
8002b4: 0085c83a sub r2,zero,r2
8002b8: e0800215 stw r2,8(fp)
8002bc: e0800117 ldw r2,4(fp)
8002c0: 1004403a cmpge r2,r2,zero
8002c4: 1000031e bne r2,zero,8002d4 <sign+0x4c>
8002c8: e0c00217 ldw r3,8(fp)
8002cc: 00c7c83a sub r3,zero,r3
8002d0: e0c00215 stw r3,8(fp)
8002d4: e0800217 ldw r2,8(fp)
}
8002d8: df000317 ldw fp,12(sp)
8002dc: dec00404 addi sp,sp,16
8002e0: f800283a ret
See alt_load.c
008002e4 <alt_load>:
* RAM any sections that are required.
*/
void alt_load (void)
{
8002e4: defffe04 addi sp,sp,-8
8002e8: dfc00115 stw ra,4(sp)
8002ec: df000015 stw fp,0(sp)
8002f0: d839883a mov fp,sp
/*
* Copy the .rwdata section.
*/
alt_load_section (&__flash_rwdata_start,
8002f4: 01002034 movhi r4,128
8002f8: 210f9d04 addi r4,r4,15988
8002fc: 01402034 movhi r5,128
800300: 294f9d04 addi r5,r5,15988
800304: 01802034 movhi r6,128
800308: 31966c04 addi r6,r6,22960
80030c: 08003600 call 800360 <alt_load_section>
&__ram_rwdata_start,
&__ram_rwdata_end);
/*
* Copy the exception handler.
*/
alt_load_section (&__flash_exceptions_start,
800310: 01002034 movhi r4,128
800314: 21000804 addi r4,r4,32
800318: 01402034 movhi r5,128
80031c: 29400804 addi r5,r5,32
800320: 01802034 movhi r6,128
800324: 31807204 addi r6,r6,456
800328: 08003600 call 800360 <alt_load_section>
&__ram_exceptions_start,
&__ram_exceptions_end);
/*
* Copy the .rodata section.
*/
alt_load_section (&__flash_rodata_start,
80032c: 01002034 movhi r4,128
800330: 210f2e04 addi r4,r4,15544
800334: 01402034 movhi r5,128
800338: 294f2e04 addi r5,r5,15544
80033c: 01802034 movhi r6,128
800340: 318f9d04 addi r6,r6,15988
800344: 08003600 call 800360 <alt_load_section>
&__ram_rodata_start,
&__ram_rodata_end);
/*
* Now ensure that the caches are in synch.
*/
alt_dcache_flush_all();
800348: 0801e280 call 801e28 <alt_dcache_flush_all>
alt_icache_flush_all();
80034c: 08020380 call 802038 <alt_icache_flush_all>
}
800350: dfc00117 ldw ra,4(sp)
800354: df000017 ldw fp,0(sp)
800358: dec00204 addi sp,sp,8
80035c: f800283a ret
00800360 <alt_load_section>:
static void ALT_INLINE alt_load_section (alt_u32* from,
alt_u32* to,
alt_u32* end)
{
800360: defffc04 addi sp,sp,-16
800364: df000315 stw fp,12(sp)
800368: d839883a mov fp,sp
80036c: e1000015 stw r4,0(fp)
800370: e1400115 stw r5,4(fp)
800374: e1800215 stw r6,8(fp)
if (to != from)
800378: e0c00117 ldw r3,4(fp)
80037c: e0800017 ldw r2,0(fp)
800380: 18800e26 beq r3,r2,8003bc <alt_load_section+0x5c>
{
while( to != end )
800384: e0c00117 ldw r3,4(fp)
800388: e0800217 ldw r2,8(fp)
80038c: 18800b26 beq r3,r2,8003bc <alt_load_section+0x5c>
{
*to++ = *from++;
800390: e1400104 addi r5,fp,4
800394: 28c00017 ldw r3,0(r5)
800398: e0800017 ldw r2,0(fp)
80039c: 11000017 ldw r4,0(r2)
8003a0: 10800104 addi r2,r2,4
8003a4: e0800015 stw r2,0(fp)
8003a8: 1805883a mov r2,r3
8003ac: 11000015 stw r4,0(r2)
8003b0: 18c00104 addi r3,r3,4
8003b4: 28c00015 stw r3,0(r5)
8003b8: 003ff206 br 800384 <alt_load_section+0x24>
}
}
}
8003bc: df000317 ldw fp,12(sp)
8003c0: dec00404 addi sp,sp,16
8003c4: f800283a ret
008003c8 <alt_main>:
* the users application, i.e. main().
*/
See alt_main.c
void alt_main (void)
{
8003c8: defffd04 addi sp,sp,-12
8003cc: dfc00215 stw ra,8(sp)
8003d0: df000115 stw fp,4(sp)
8003d4: d839883a mov fp,sp
*/
static ALT_INLINE void ALT_ALWAYS_INLINE
alt_irq_init (const void* base)
{
8003d8: e0000015 stw zero,0(fp)
NIOS2_WRITE_IENABLE (0);
8003dc: 000170fa wrctl ienable,zero
NIOS2_WRITE_STATUS (NIOS2_STATUS_PIE_MSK);
8003e0: 00800044 movi r2,1
8003e4: 1001703a wrctl status,r2
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
8003e8: e0000015 stw zero,0(fp)
/* ALT LOG - please see HAL/sys/alt_log_printf.h for details */
ALT_LOG_PRINT_BOOT("[alt_main.c] Entering alt_main, calling alt_irq_init.\r\n");
/* Initialize the interrupt controller. */
alt_irq_init (ALT_IRQ_BASE);
/* Initialize the operating system */
ALT_LOG_PRINT_BOOT("[alt_main.c] Done alt_irq_init, calling alt_os_init.\r\n");
ALT_OS_INIT();
/*
* Initialize the semaphore used to control access to the file descriptor
* list.
*/
ALT_LOG_PRINT_BOOT("[alt_main.c] Done OS Init, calling alt_sem_create.\r\n");
ALT_SEM_CREATE (&alt_fd_list_lock, 1);
/* Initialize the device drivers/software components. */
ALT_LOG_PRINT_BOOT("[alt_main.c] Calling alt_sys_init.\r\n");
alt_sys_init();
8003ec: 08004340 call 800434 <alt_sys_init>
ALT_LOG_PRINT_BOOT("[alt_main.c] Done alt_sys_init.\r\n");
#if !defined(ALT_USE_DIRECT_DRIVERS) && (defined(ALT_STDIN_PRESENT) || defined(ALT_STDOUT_PRESENT) || defined(ALT_STDERR_PRESENT))
/*
* Redirect stdio to the apropriate devices now that the devices have
* been initialized. This is only done if the user has requested these
* devices be present (not equal to /dev/null) and if direct drivers
* aren't being used.
*/
ALT_LOG_PRINT_BOOT("[alt_main.c] Redirecting IO.\r\n");
alt_io_redirect(ALT_STDOUT, ALT_STDIN, ALT_STDERR);
8003f0: 01002034 movhi r4,128
8003f4: 210f2e04 addi r4,r4,15544
8003f8: 01402034 movhi r5,128
8003fc: 294f2e04 addi r5,r5,15544
800400: 01802034 movhi r6,128
800404: 318f2e04 addi r6,r6,15544
800408: 08021240 call 802124 <alt_io_redirect>
#endif
#ifndef ALT_NO_C_PLUS_PLUS
/*
* Call the C++ constructors
*/
ALT_LOG_PRINT_BOOT("[alt_main.c] Calling C++ constructors.\r\n");
_do_ctors ();
80040c: 0801f880 call 801f88 <_do_ctors>
#endif /* ALT_NO_C_PLUS_PLUS */
#if !defined(ALT_NO_C_PLUS_PLUS) && !defined(ALT_NO_CLEAN_EXIT) && !defined(ALT_NO_EXIT)
/*
* Set the C++ destructors to be called at system shutdown. This is only done
* if a clean exit has been requested (i.e. the exit() function has not been
* redefined as _exit()). This is in the interest of reducing code footprint,
* in that the atexit() overhead is removed when it's not needed.
*/
ALT_LOG_PRINT_BOOT("[alt_main.c] Calling atexit.\r\n");
atexit (_do_dtors);
800410: 01002034 movhi r4,128
800414: 2107f804 addi r4,r4,8160
800418: 0802bb40 call 802bb4 <atexit>
#endif
/*
* Finally, call main(). The return code is then passed to a subsequent
* call to exit() unless the application is never supposed to exit.
*/
ALT_LOG_PRINT_BOOT("[alt_main.c] Calling main.\r\n");
#ifdef ALT_NO_EXIT
main (alt_argc, alt_argv, alt_envp);
#else
exit (main (alt_argc, alt_argv, alt_envp));
80041c: d1200217 ldw r4,-32760(gp)
800420: d1600317 ldw r5,-32756(gp)
800424: d1a00417 ldw r6,-32752(gp)
800428: 08002140 call 800214 <main>
80042c: 1009883a mov r4,r2
800430: 0802c500 call 802c50 <exit>
00800434 <alt_sys_init>:
800434: defffe04 addi sp,sp,-8
800438: dfc00115 stw ra,4(sp)
80043c: df000015 stw fp,0(sp)
800440: d839883a mov fp,sp
800444: 01004034 movhi r4,256
800448: 21040004 addi r4,r4,4096
80044c: 000b883a mov r5,zero
800450: 0180fa04 movi r6,1000
800454: 0801c600 call 801c60 <alt_avalon_timer_sc_init>
800458: 01002034 movhi r4,128
80045c: 210fa704 addi r4,r4,16028
800460: 01400044 movi r5,1
800464: 08005c00 call 8005c0 <altera_avalon_jtag_uart_init>
800468: 01002034 movhi r4,128
80046c: 210f9d04 addi r4,r4,15988
800470: 080049c0 call 80049c <alt_dev_reg>
800474: 01002034 movhi r4,128
800478: 2113bf04 addi r4,r4,20220
80047c: 0801aac0 call 801aac <altera_avalon_lcd_16207_init>
800480: 01002034 movhi r4,128
800484: 2113b504 addi r4,r4,20180
800488: 080049c0 call 80049c <alt_dev_reg>
80048c: dfc00117 ldw ra,4(sp)
800490: df000017 ldw fp,0(sp)
800494: dec00204 addi sp,sp,8
800498: f800283a ret
0080049c <alt_dev_reg>:
extern int alt_fs_reg (alt_dev* dev);
static ALT_INLINE int alt_dev_reg (alt_dev* dev)
{
80049c: defffd04 addi sp,sp,-12
8004a0: dfc00215 stw ra,8(sp)
8004a4: df000115 stw fp,4(sp)
8004a8: d839883a mov fp,sp
8004ac: e1000015 stw r4,0(fp)
extern alt_llist alt_dev_list;
return alt_dev_llist_insert ((alt_dev_llist*) dev, &alt_dev_list);
8004b0: e1000017 ldw r4,0(fp)
8004b4: d1600804 addi r5,gp,-32736
8004b8: 0801e900 call 801e90 <alt_dev_llist_insert>
}
8004bc: dfc00217 ldw ra,8(sp)
8004c0: df000117 ldw fp,4(sp)
8004c4: dec00304 addi sp,sp,12
8004c8: f800283a ret
008004cc <altera_avalon_jtag_uart_read_fd>:
*/
int
altera_avalon_jtag_uart_read_fd(alt_fd* fd, char* buffer, int space)
{
8004cc: defffa04 addi sp,sp,-24
8004d0: dfc00515 stw ra,20(sp)
8004d4: df000415 stw fp,16(sp)
8004d8: d839883a mov fp,sp
8004dc: e1000015 stw r4,0(fp)
8004e0: e1400115 stw r5,4(fp)
8004e4: e1800215 stw r6,8(fp)
altera_avalon_jtag_uart_dev* dev = (altera_avalon_jtag_uart_dev*) fd->dev;
8004e8: e0800017 ldw r2,0(fp)
8004ec: 10800017 ldw r2,0(r2)
8004f0: e0800315 stw r2,12(fp)
return altera_avalon_jtag_uart_read(&dev->state, buffer, space,
8004f4: e0800317 ldw r2,12(fp)
8004f8: 11000a04 addi r4,r2,40
8004fc: e0800017 ldw r2,0(fp)
800500: e1400117 ldw r5,4(fp)
800504: e1800217 ldw r6,8(fp)
800508: 11c00217 ldw r7,8(r2)
80050c: 0800a480 call 800a48 <altera_avalon_jtag_uart_read>
fd->fd_flags);
}
800510: dfc00517 ldw ra,20(sp)
800514: df000417 ldw fp,16(sp)
800518: dec00604 addi sp,sp,24
80051c: f800283a ret
00800520 <altera_avalon_jtag_uart_write_fd>:
int
altera_avalon_jtag_uart_write_fd(alt_fd* fd, const char* buffer, int space)
{
800520: defffa04 addi sp,sp,-24
800524: dfc00515 stw ra,20(sp)
800528: df000415 stw fp,16(sp)
80052c: d839883a mov fp,sp
800530: e1000015 stw r4,0(fp)
800534: e1400115 stw r5,4(fp)
800538: e1800215 stw r6,8(fp)
altera_avalon_jtag_uart_dev* dev = (altera_avalon_jtag_uart_dev*) fd->dev;
80053c: e0800017 ldw r2,0(fp)
800540: 10800017 ldw r2,0(r2)
800544: e0800315 stw r2,12(fp)
return altera_avalon_jtag_uart_write(&dev->state, buffer, space,
800548: e0800317 ldw r2,12(fp)
80054c: 11000a04 addi r4,r2,40
800550: e0800017 ldw r2,0(fp)
800554: e1400117 ldw r5,4(fp)
800558: e1800217 ldw r6,8(fp)
80055c: 11c00217 ldw r7,8(r2)
800560: 0800c780 call 800c78 <altera_avalon_jtag_uart_write>
fd->fd_flags);
}
800564: dfc00517 ldw ra,20(sp)
800568: df000417 ldw fp,16(sp)
80056c: dec00604 addi sp,sp,24
800570: f800283a ret
00800574 <altera_avalon_jtag_uart_ioctl_fd>:
#ifndef ALTERA_AVALON_JTAG_UART_SMALL
int
altera_avalon_jtag_uart_ioctl_fd(alt_fd* fd, int req, void* arg)
{
800574: defffa04 addi sp,sp,-24
800578: dfc00515 stw ra,20(sp)
80057c: df000415 stw fp,16(sp)
800580: d839883a mov fp,sp
800584: e1000015 stw r4,0(fp)
800588: e1400115 stw r5,4(fp)
80058c: e1800215 stw r6,8(fp)
altera_avalon_jtag_uart_dev* dev = (altera_avalon_jtag_uart_dev*) fd->dev;
800590: e0800017 ldw r2,0(fp)
800594: 10800017 ldw r2,0(r2)
800598: e0800315 stw r2,12(fp)
return altera_avalon_jtag_uart_ioctl(&dev->state, req, arg);
80059c: e0800317 ldw r2,12(fp)
8005a0: 11000a04 addi r4,r2,40
8005a4: e1400117 ldw r5,4(fp)
8005a8: e1800217 ldw r6,8(fp)
8005ac: 08009500 call 800950 <altera_avalon_jtag_uart_ioctl>
}
8005b0: dfc00517 ldw ra,20(sp)
8005b4: df000417 ldw fp,16(sp)
8005b8: dec00604 addi sp,sp,24
8005bc: f800283a ret
008005c0 <altera_avalon_jtag_uart_init>:
*/
void
altera_avalon_jtag_uart_init(altera_avalon_jtag_uart_state* sp, int irq)
{
8005c0: defff804 addi sp,sp,-32
8005c4: dfc00715 stw ra,28(sp)
8005c8: df000615 stw fp,24(sp)
8005cc: d839883a mov fp,sp
8005d0: e1000015 stw r4,0(fp)
8005d4: e1400115 stw r5,4(fp)
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
8005d8: e0000215 stw zero,8(fp)
8005dc: e0000315 stw zero,12(fp)
8005e0: e0000415 stw zero,16(fp)
ALT_FLAG_CREATE(&sp->events, 0);
ALT_SEM_CREATE(&sp->read_lock, 1);
ALT_SEM_CREATE(&sp->write_lock, 1);
/* enable read interrupts at the device */
sp->irq_enable = ALTERA_AVALON_JTAG_UART_CONTROL_RE_MSK;
8005e4: e0c00017 ldw r3,0(fp)
8005e8: 00800044 movi r2,1
8005ec: 18800815 stw r2,32(r3)
IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(sp->base, sp->irq_enable);
8005f0: e0800017 ldw r2,0(fp)
8005f4: 10800017 ldw r2,0(r2)
8005f8: 10800104 addi r2,r2,4
8005fc: 1007883a mov r3,r2
800600: e0800017 ldw r2,0(fp)
800604: 10800817 ldw r2,32(r2)
800608: 18800035 stwio r2,0(r3)
/* register the interrupt handler */
alt_irq_register(irq, sp, altera_avalon_jtag_uart_irq);
80060c: e1000117 ldw r4,4(fp)
800610: e1400017 ldw r5,0(fp)
800614: 01802034 movhi r6,128
800618: 31819d04 addi r6,r6,1652
80061c: 08021980 call 802198 <alt_irq_register>
/* Register an alarm to go off every second to check for presence of host */
sp->host_inactive = 0;
800620: e0800017 ldw r2,0(fp)
800624: 10000915 stw zero,36(r2)
*/
static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_ticks_per_second (void)
{
return _alt_tick_rate;
800628: d0a00e17 ldw r2,-32712(gp)
80062c: e0800515 stw r2,20(fp)
800630: e1400517 ldw r5,20(fp)
800634: e0800017 ldw r2,0(fp)
800638: 11000204 addi r4,r2,8
80063c: 01802034 movhi r6,128
800640: 31822304 addi r6,r6,2188
800644: e1c00017 ldw r7,0(fp)
800648: 0801ce00 call 801ce0 <alt_alarm_start>
80064c: 1004403a cmpge r2,r2,zero
800650: 1000041e bne r2,zero,800664 <altera_avalon_jtag_uart_init+0xa4>
if (alt_alarm_start(&sp->alarm, alt_ticks_per_second(),
&altera_avalon_jtag_uart_timeout, sp) < 0)
{
/* If we can't set the alarm then record "don't know if host present"
* and behave as though the host is present.
*/
sp->timeout = INT_MAX;
800654: e0c00017 ldw r3,0(fp)
800658: 00a00034 movhi r2,32768
80065c: 10bfffc4 addi r2,r2,-1
800660: 18800115 stw r2,4(r3)
}
/* ALT_LOG - see altera_hal/HAL/inc/sys/alt_log_printf.h */
ALT_LOG_JTAG_UART_ALARM_REGISTER(sp, sp->base);
}
800664: dfc00717 ldw ra,28(sp)
800668: df000617 ldw fp,24(sp)
80066c: dec00804 addi sp,sp,32
800670: f800283a ret
00800674 <altera_avalon_jtag_uart_irq>:
/*
* Interrupt routine
*/
static void
altera_avalon_jtag_uart_irq(void* context, alt_u32 id)
{
800674: defff704 addi sp,sp,-36
800678: df000815 stw fp,32(sp)
80067c: d839883a mov fp,sp
800680: e1000015 stw r4,0(fp)
800684: e1400115 stw r5,4(fp)
altera_avalon_jtag_uart_state* sp = (altera_avalon_jtag_uart_state*) context;
800688: e0800017 ldw r2,0(fp)
80068c: e0800215 stw r2,8(fp)
unsigned int base = sp->base;
800690: e0800217 ldw r2,8(fp)
800694: 10800017 ldw r2,0(r2)
800698: e0800315 stw r2,12(fp)
/* ALT_LOG - see altera_hal/HAL/inc/sys/alt_log_printf.h */
ALT_LOG_JTAG_UART_ISR_FUNCTION(base, sp);
for ( ; ; )
{
unsigned int control = IORD_ALTERA_AVALON_JTAG_UART_CONTROL(base);
80069c: e0800317 ldw r2,12(fp)
8006a0: 10800104 addi r2,r2,4
8006a4: 10800037 ldwio r2,0(r2)
8006a8: e0800415 stw r2,16(fp)
/* Return once nothing more to do */
if ((control & (ALTERA_AVALON_JTAG_UART_CONTROL_RI_MSK | ALTERA_AVALON_JTAG_UART_CONTROL_WI_MSK)) == 0)
8006ac: e0800417 ldw r2,16(fp)
8006b0: 1080c00c andi r2,r2,768
8006b4: 1004c03a cmpne r2,r2,zero
8006b8: 1000011e bne r2,zero,8006c0 <altera_avalon_jtag_uart_irq+0x4c>
break;
8006bc: 00007006 br 800880 <altera_avalon_jtag_uart_irq+0x20c>
if (control & ALTERA_AVALON_JTAG_UART_CONTROL_RI_MSK)
8006c0: e0800417 ldw r2,16(fp)
8006c4: 1004d23a srli r2,r2,8
8006c8: 1080004c andi r2,r2,1
8006cc: 1005003a cmpeq r2,r2,zero
8006d0: 1000361e bne r2,zero,8007ac <altera_avalon_jtag_uart_irq+0x138>
{
/* process a read irq. Start by assuming that there is data in the
* receive FIFO (otherwise why would we have been interrupted?)
*/
unsigned int data = 1 << ALTERA_AVALON_JTAG_UART_DATA_RAVAIL_OFST;
8006d4: 00800074 movhi r2,1
8006d8: 10800004 addi r2,r2,0
8006dc: e0800515 stw r2,20(fp)
for ( ; ; )
{
/* Check whether there is space in the buffer. If not then we must not
* read any characters from the buffer as they will be lost.
*/
unsigned int next = (sp->rx_in + 1) % ALTERA_AVALON_JTAG_UART_BUF_LEN;
8006e0: e0800217 ldw r2,8(fp)
8006e4: 10800a17 ldw r2,40(r2)
8006e8: 10800044 addi r2,r2,1
8006ec: 1081ffcc andi r2,r2,2047
8006f0: e0800615 stw r2,24(fp)
if (next == sp->rx_out)
8006f4: e0800217 ldw r2,8(fp)
8006f8: 10c00b17 ldw r3,44(r2)
8006fc: e0800617 ldw r2,24(fp)
800700: 1880011e bne r3,r2,800708 <altera_avalon_jtag_uart_irq+0x94>
break;
800704: 00001906 br 80076c <altera_avalon_jtag_uart_irq+0xf8>
/* Try to remove a character from the FIFO and find out whether there
* are any more characters remaining.
*/
data = IORD_ALTERA_AVALON_JTAG_UART_DATA(base);
800708: e0800317 ldw r2,12(fp)
80070c: 10800037 ldwio r2,0(r2)
800710: e0800515 stw r2,20(fp)
if ((data & ALTERA_AVALON_JTAG_UART_DATA_RVALID_MSK) == 0)
800714: e0800517 ldw r2,20(fp)
800718: 1004d3fa srli r2,r2,15
80071c: 1080005c xori r2,r2,1
800720: 1080004c andi r2,r2,1
800724: 1005003a cmpeq r2,r2,zero
800728: 1000011e bne r2,zero,800730 <altera_avalon_jtag_uart_irq+0xbc>
break;
80072c: 00000f06 br 80076c <altera_avalon_jtag_uart_irq+0xf8>
sp->rx_buf[sp->rx_in] = (data & ALTERA_AVALON_JTAG_UART_DATA_DATA_MSK) >> ALTERA_AVALON_JTAG_UART_DATA_DATA_OFST;
800730: e0c00217 ldw r3,8(fp)
800734: e0800217 ldw r2,8(fp)
800738: 10800a17 ldw r2,40(r2)
80073c: 1885883a add r2,r3,r2
800740: 10c00e04 addi r3,r2,56
800744: e0800517 ldw r2,20(fp)
800748: 18800005 stb r2,0(r3)
sp->rx_in = (sp->rx_in + 1) % ALTERA_AVALON_JTAG_UART_BUF_LEN;
80074c: e0c00217 ldw r3,8(fp)
800750: e0800217 ldw r2,8(fp)
800754: 10800a17 ldw r2,40(r2)
800758: 10800044 addi r2,r2,1
80075c: 1081ffcc andi r2,r2,2047
800760: 18800a15 stw r2,40(r3)
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
800764: e0000715 stw zero,28(fp)
800768: 003fdd06 br 8006e0 <altera_avalon_jtag_uart_irq+0x6c>
/* Post an event to notify jtag_uart_read that a character has been read */
ALT_FLAG_POST (sp->events, ALT_JTAG_UART_READ_RDY, OS_FLAG_SET);
}
if (data & ALTERA_AVALON_JTAG_UART_DATA_RAVAIL_MSK)
80076c: e0800517 ldw r2,20(fp)
800770: 10bfffec andhi r2,r2,65535
800774: 1005003a cmpeq r2,r2,zero
800778: 10000c1e bne r2,zero,8007ac <altera_avalon_jtag_uart_irq+0x138>
{
/* If there is still data available here then the buffer is full
* so turn off receive interrupts until some space becomes available.
*/
sp->irq_enable &= ~ALTERA_AVALON_JTAG_UART_CONTROL_RE_MSK;
80077c: e1000217 ldw r4,8(fp)
800780: e0800217 ldw r2,8(fp)
800784: 10c00817 ldw r3,32(r2)
800788: 00bfff84 movi r2,-2
80078c: 1884703a and r2,r3,r2
800790: 20800815 stw r2,32(r4)
IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(base, sp->irq_enable);
800794: e0800317 ldw r2,12(fp)
800798: 10800104 addi r2,r2,4
80079c: 1007883a mov r3,r2
8007a0: e0800217 ldw r2,8(fp)
8007a4: 10800817 ldw r2,32(r2)
8007a8: 18800035 stwio r2,0(r3)
}
}
if (control & ALTERA_AVALON_JTAG_UART_CONTROL_WI_MSK)
8007ac: e0800417 ldw r2,16(fp)
8007b0: 1004d27a srli r2,r2,9
8007b4: 1080004c andi r2,r2,1
8007b8: 1005003a cmpeq r2,r2,zero
8007bc: 103fb71e bne r2,zero,80069c <altera_avalon_jtag_uart_irq+0x28>
{
/* process a write irq */
unsigned int space = (control & ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_MSK) >> ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_OFST;
8007c0: e0800417 ldw r2,16(fp)
8007c4: 10bfffec andhi r2,r2,65535
8007c8: 1004d43a srli r2,r2,16
8007cc: e0800715 stw r2,28(fp)
while (space > 0 && sp->tx_out != sp->tx_in)
8007d0: e0800717 ldw r2,28(fp)
8007d4: 1005003a cmpeq r2,r2,zero
8007d8: 1000181e bne r2,zero,80083c <altera_avalon_jtag_uart_irq+0x1c8>
8007dc: e0800217 ldw r2,8(fp)
8007e0: e0c00217 ldw r3,8(fp)
8007e4: 11000d17 ldw r4,52(r2)
8007e8: 18800c17 ldw r2,48(r3)
8007ec: 20801326 beq r4,r2,80083c <altera_avalon_jtag_uart_irq+0x1c8>
{
IOWR_ALTERA_AVALON_JTAG_UART_DATA(base, sp->tx_buf[sp->tx_out]);
8007f0: e1000317 ldw r4,12(fp)
8007f4: e0c00217 ldw r3,8(fp)
8007f8: e0800217 ldw r2,8(fp)
8007fc: 10800d17 ldw r2,52(r2)
800800: 1885883a add r2,r3,r2
800804: 10820e04 addi r2,r2,2104
800808: 10800007 ldb r2,0(r2)
80080c: 20800035 stwio r2,0(r4)
sp->tx_out = (sp->tx_out + 1) % ALTERA_AVALON_JTAG_UART_BUF_LEN;
800810: e0c00217 ldw r3,8(fp)
800814: e0800217 ldw r2,8(fp)
800818: 10800d17 ldw r2,52(r2)
80081c: 10800044 addi r2,r2,1
800820: 1081ffcc andi r2,r2,2047
800824: 18800d15 stw r2,52(r3)
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
800828: e0000615 stw zero,24(fp)
/* Post an event to notify jtag_uart_write that a character has been written */
ALT_FLAG_POST (sp->events, ALT_JTAG_UART_WRITE_RDY, OS_FLAG_SET);
space--;
80082c: e0800717 ldw r2,28(fp)
800830: 10bfffc4 addi r2,r2,-1
800834: e0800715 stw r2,28(fp)
800838: 003fe506 br 8007d0 <altera_avalon_jtag_uart_irq+0x15c>
}
if (space > 0)
80083c: e0800717 ldw r2,28(fp)
800840: 1005003a cmpeq r2,r2,zero
800844: 103f951e bne r2,zero,80069c <altera_avalon_jtag_uart_irq+0x28>
{
/* If we don't have any more data available then turn off the TX interrupt */
sp->irq_enable &= ~ALTERA_AVALON_JTAG_UART_CONTROL_WE_MSK;
800848: e1000217 ldw r4,8(fp)
80084c: e0800217 ldw r2,8(fp)
800850: 10c00817 ldw r3,32(r2)
800854: 00bfff44 movi r2,-3
800858: 1884703a and r2,r3,r2
80085c: 20800815 stw r2,32(r4)
IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(sp->base, sp->irq_enable);
800860: e0800217 ldw r2,8(fp)
800864: 10800017 ldw r2,0(r2)
800868: 10800104 addi r2,r2,4
80086c: 1007883a mov r3,r2
800870: e0800217 ldw r2,8(fp)
800874: 10800817 ldw r2,32(r2)
800878: 18800035 stwio r2,0(r3)
80087c: 003f8706 br 80069c <altera_avalon_jtag_uart_irq+0x28>
}
}
}
}
800880: df000817 ldw fp,32(sp)
800884: dec00904 addi sp,sp,36
800888: f800283a ret
0080088c <altera_avalon_jtag_uart_timeout>:
/*
* Timeout routine is called every second
*/
static alt_u32
altera_avalon_jtag_uart_timeout(void* context)
{
80088c: defffb04 addi sp,sp,-20
800890: df000415 stw fp,16(sp)
800894: d839883a mov fp,sp
800898: e1000015 stw r4,0(fp)
altera_avalon_jtag_uart_state* sp = (altera_avalon_jtag_uart_state *) context;
80089c: e0800017 ldw r2,0(fp)
8008a0: e0800115 stw r2,4(fp)
unsigned int control = IORD_ALTERA_AVALON_JTAG_UART_CONTROL(sp->base);
8008a4: e0800117 ldw r2,4(fp)
8008a8: 10800017 ldw r2,0(r2)
8008ac: 10800104 addi r2,r2,4
8008b0: 10800037 ldwio r2,0(r2)
8008b4: e0800215 stw r2,8(fp)
if (control & ALTERA_AVALON_JTAG_UART_CONTROL_AC_MSK)
8008b8: e0800217 ldw r2,8(fp)
8008bc: 1004d2ba srli r2,r2,10
8008c0: 1080004c andi r2,r2,1
8008c4: 1005003a cmpeq r2,r2,zero
8008c8: 10000b1e bne r2,zero,8008f8 <altera_avalon_jtag_uart_timeout+0x6c>
{
IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(sp->base, sp->irq_enable | ALTERA_AVALON_JTAG_UART_CONTROL_AC_MSK);
8008cc: e0800117 ldw r2,4(fp)
8008d0: 10800017 ldw r2,0(r2)
8008d4: 10800104 addi r2,r2,4
8008d8: 1007883a mov r3,r2
8008dc: e0800117 ldw r2,4(fp)
8008e0: 10800817 ldw r2,32(r2)
8008e4: 10810014 ori r2,r2,1024
8008e8: 18800035 stwio r2,0(r3)
sp->host_inactive = 0;
8008ec: e0800117 ldw r2,4(fp)
8008f0: 10000915 stw zero,36(r2)
8008f4: 00001006 br 800938 <altera_avalon_jtag_uart_timeout+0xac>
}
else if (sp->host_inactive < INT_MAX - 2) {
8008f8: e0800117 ldw r2,4(fp)
8008fc: 10c00917 ldw r3,36(r2)
800900: 00a00034 movhi r2,32768
800904: 10bfff04 addi r2,r2,-4
800908: 10c00b36 bltu r2,r3,800938 <altera_avalon_jtag_uart_timeout+0xac>
sp->host_inactive++;
80090c: e0c00117 ldw r3,4(fp)
800910: e0800117 ldw r2,4(fp)
800914: 10800917 ldw r2,36(r2)
800918: 10800044 addi r2,r2,1
80091c: 18800915 stw r2,36(r3)
if (sp->host_inactive >= sp->timeout) {
800920: e0800117 ldw r2,4(fp)
800924: e0c00117 ldw r3,4(fp)
800928: 11000917 ldw r4,36(r2)
80092c: 18800117 ldw r2,4(r3)
800930: 20800136 bltu r4,r2,800938 <altera_avalon_jtag_uart_timeout+0xac>
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
800934: e0000315 stw zero,12(fp)
*/
static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_ticks_per_second (void)
{
return _alt_tick_rate;
800938: d0a00e17 ldw r2,-32712(gp)
80093c: e0800315 stw r2,12(fp)
800940: e0800317 ldw r2,12(fp)
/* Post an event to indicate host is inactive (for jtag_uart_read */
ALT_FLAG_POST (sp->events, ALT_JTAG_UART_TIMEOUT, OS_FLAG_SET);
}
}
return alt_ticks_per_second();
}
800944: df000417 ldw fp,16(sp)
800948: dec00504 addi sp,sp,20
80094c: f800283a ret
00800950 <altera_avalon_jtag_uart_ioctl>:
int
altera_avalon_jtag_uart_ioctl(altera_avalon_jtag_uart_state* sp, int req,
void* arg)
{
800950: defff704 addi sp,sp,-36
800954: df000815 stw fp,32(sp)
800958: d839883a mov fp,sp
80095c: e1000015 stw r4,0(fp)
800960: e1400115 stw r5,4(fp)
800964: e1800215 stw r6,8(fp)
int rc = -ENOTTY;
800968: 00bff9c4 movi r2,-25
80096c: e0800315 stw r2,12(fp)
switch (req)
800970: e0800117 ldw r2,4(fp)
800974: e0800715 stw r2,28(fp)
800978: e0c00717 ldw r3,28(fp)
80097c: 189a8060 cmpeqi r2,r3,27137
800980: 1000041e bne r2,zero,800994 <altera_avalon_jtag_uart_ioctl+0x44>
800984: e0c00717 ldw r3,28(fp)
800988: 189a80a0 cmpeqi r2,r3,27138
80098c: 10001d1e bne r2,zero,800a04 <altera_avalon_jtag_uart_ioctl+0xb4>
800990: 00002906 br 800a38 <altera_avalon_jtag_uart_ioctl+0xe8>
{
case TIOCSTIMEOUT:
/* Set the time to wait until assuming host is not connected */
if (sp->timeout != INT_MAX)
800994: e0800017 ldw r2,0(fp)
800998: 10c00117 ldw r3,4(r2)
80099c: 00a00034 movhi r2,32768
8009a0: 10bfffc4 addi r2,r2,-1
8009a4: 18802426 beq r3,r2,800a38 <altera_avalon_jtag_uart_ioctl+0xe8>
{
int timeout = *((int *)arg);
8009a8: e0800217 ldw r2,8(fp)
8009ac: 10800017 ldw r2,0(r2)
8009b0: e0800415 stw r2,16(fp)
sp->timeout = (timeout >= 2 && timeout < INT_MAX) ? timeout : INT_MAX - 1;
8009b4: e0800017 ldw r2,0(fp)
8009b8: e0800515 stw r2,20(fp)
8009bc: e0800417 ldw r2,16(fp)
8009c0: 10800090 cmplti r2,r2,2
8009c4: 1000071e bne r2,zero,8009e4 <altera_avalon_jtag_uart_ioctl+0x94>
8009c8: e0c00417 ldw r3,16(fp)
8009cc: 00a00034 movhi r2,32768
8009d0: 10bfffc4 addi r2,r2,-1
8009d4: 18800326 beq r3,r2,8009e4 <altera_avalon_jtag_uart_ioctl+0x94>
8009d8: e0c00417 ldw r3,16(fp)
8009dc: e0c00615 stw r3,24(fp)
8009e0: 00000306 br 8009f0 <altera_avalon_jtag_uart_ioctl+0xa0>
8009e4: 00a00034 movhi r2,32768
8009e8: 10bfff84 addi r2,r2,-2
8009ec: e0800615 stw r2,24(fp)
8009f0: e0c00617 ldw r3,24(fp)
8009f4: e0800517 ldw r2,20(fp)
8009f8: 10c00115 stw r3,4(r2)
rc = 0;
8009fc: e0000315 stw zero,12(fp)
}
break;
800a00: 00000d06 br 800a38 <altera_avalon_jtag_uart_ioctl+0xe8>
case TIOCGCONNECTED:
/* Find out whether host is connected */
if (sp->timeout != INT_MAX)
800a04: e0800017 ldw r2,0(fp)
800a08: 10c00117 ldw r3,4(r2)
800a0c: 00a00034 movhi r2,32768
800a10: 10bfffc4 addi r2,r2,-1
800a14: 18800826 beq r3,r2,800a38 <altera_avalon_jtag_uart_ioctl+0xe8>
{
*((int *)arg) = (sp->host_inactive < sp->timeout) ? 1 : 0;
800a18: e1400217 ldw r5,8(fp)
800a1c: e0800017 ldw r2,0(fp)
800a20: e0c00017 ldw r3,0(fp)
800a24: 11000917 ldw r4,36(r2)
800a28: 18800117 ldw r2,4(r3)
800a2c: 2085803a cmpltu r2,r4,r2
800a30: 28800015 stw r2,0(r5)
rc = 0;
800a34: e0000315 stw zero,12(fp)
}
break;
default:
break;
}
return rc;
800a38: e0800317 ldw r2,12(fp)
}
800a3c: df000817 ldw fp,32(sp)
800a40: dec00904 addi sp,sp,36
800a44: f800283a ret
00800a48 <altera_avalon_jtag_uart_read>:
int
altera_avalon_jtag_uart_read(altera_avalon_jtag_uart_state* sp,
char * buffer, int space, int flags)
{
800a48: defff204 addi sp,sp,-56
800a4c: dfc00d15 stw ra,52(sp)
800a50: df000c15 stw fp,48(sp)
800a54: d839883a mov fp,sp
800a58: e1000015 stw r4,0(fp)
800a5c: e1400115 stw r5,4(fp)
800a60: e1800215 stw r6,8(fp)
800a64: e1c00315 stw r7,12(fp)
char * ptr = buffer;
800a68: e0800117 ldw r2,4(fp)
800a6c: e0800415 stw r2,16(fp)
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
800a70: e0000715 stw zero,28(fp)
alt_irq_context context;
unsigned int n;
/*
* When running in a multi threaded environment, obtain the "read_lock"
* semaphore. This ensures that reading from the device is thread-safe.
*/
ALT_SEM_PEND (sp->read_lock, 0);
while (space > 0)
800a74: e0800217 ldw r2,8(fp)
800a78: 10800050 cmplti r2,r2,1
800a7c: 10004c1e bne r2,zero,800bb0 <altera_avalon_jtag_uart_read+0x168>
{
unsigned int in, out;
/* Read as much data as possible */
do
{
in = sp->rx_in;
800a80: e0800017 ldw r2,0(fp)
800a84: 10800a17 ldw r2,40(r2)
800a88: e0800815 stw r2,32(fp)
out = sp->rx_out;
800a8c: e0800017 ldw r2,0(fp)
800a90: 10800b17 ldw r2,44(r2)
800a94: e0800915 stw r2,36(fp)
if (in >= out)
800a98: e0c00817 ldw r3,32(fp)
800a9c: e0800917 ldw r2,36(fp)
800aa0: 18800536 bltu r3,r2,800ab8 <altera_avalon_jtag_uart_read+0x70>
n = in - out;
800aa4: e0800817 ldw r2,32(fp)
800aa8: e0c00917 ldw r3,36(fp)
800aac: 10c5c83a sub r2,r2,r3
800ab0: e0800615 stw r2,24(fp)
800ab4: 00000406 br 800ac8 <altera_avalon_jtag_uart_read+0x80>
else
n = ALTERA_AVALON_JTAG_UART_BUF_LEN - out;
800ab8: 00820004 movi r2,2048
800abc: e0c00917 ldw r3,36(fp)
800ac0: 10c5c83a sub r2,r2,r3
800ac4: e0800615 stw r2,24(fp)
if (n == 0)
800ac8: e0800617 ldw r2,24(fp)
800acc: 1004c03a cmpne r2,r2,zero
800ad0: 1000011e bne r2,zero,800ad8 <altera_avalon_jtag_uart_read+0x90>
break; /* No more data available */
800ad4: 00001e06 br 800b50 <altera_avalon_jtag_uart_read+0x108>
if (n > space)
800ad8: e0c00217 ldw r3,8(fp)
800adc: e0800617 ldw r2,24(fp)
800ae0: 1880022e bgeu r3,r2,800aec <altera_avalon_jtag_uart_read+0xa4>
n = space;
800ae4: e0800217 ldw r2,8(fp)
800ae8: e0800615 stw r2,24(fp)
memcpy(ptr, sp->rx_buf + out, n);
800aec: e0c00017 ldw r3,0(fp)
800af0: e0800917 ldw r2,36(fp)
800af4: 1885883a add r2,r3,r2
800af8: 11400e04 addi r5,r2,56
800afc: e1000417 ldw r4,16(fp)
800b00: e1800617 ldw r6,24(fp)
800b04: 08034840 call 803484 <memcpy>
ptr += n;
800b08: e0c00417 ldw r3,16(fp)
800b0c: e0800617 ldw r2,24(fp)
800b10: 1885883a add r2,r3,r2
800b14: e0800415 stw r2,16(fp)
space -= n;
800b18: e0c00217 ldw r3,8(fp)
800b1c: e0800617 ldw r2,24(fp)
800b20: 1885c83a sub r2,r3,r2
800b24: e0800215 stw r2,8(fp)
sp->rx_out = (out + n) % ALTERA_AVALON_JTAG_UART_BUF_LEN;
800b28: e1000017 ldw r4,0(fp)
800b2c: e0c00917 ldw r3,36(fp)
800b30: e0800617 ldw r2,24(fp)
800b34: 1885883a add r2,r3,r2
800b38: 1081ffcc andi r2,r2,2047
800b3c: 20800b15 stw r2,44(r4)
}
800b40: e0800217 ldw r2,8(fp)
800b44: 10800050 cmplti r2,r2,1
800b48: 1000011e bne r2,zero,800b50 <altera_avalon_jtag_uart_read+0x108>
800b4c: 003fcc06 br 800a80 <altera_avalon_jtag_uart_read+0x38>
while (space > 0);
/* If we read any data then return it */
if (ptr != buffer)
800b50: e0c00417 ldw r3,16(fp)
800b54: e0800117 ldw r2,4(fp)
800b58: 18800126 beq r3,r2,800b60 <altera_avalon_jtag_uart_read+0x118>
break;
800b5c: 00001406 br 800bb0 <altera_avalon_jtag_uart_read+0x168>
/* If in non-blocking mode then return error */
if (flags & O_NONBLOCK)
800b60: e0800317 ldw r2,12(fp)
800b64: 1004d3ba srli r2,r2,14
800b68: 1080004c andi r2,r2,1
800b6c: 1005003a cmpeq r2,r2,zero
800b70: 1000011e bne r2,zero,800b78 <altera_avalon_jtag_uart_read+0x130>
break;
800b74: 00000e06 br 800bb0 <altera_avalon_jtag_uart_read+0x168>
#ifdef __ucosii__
/* OS Present: Pend on a flag if the OS is running, otherwise spin */
if(OSRunning == OS_TRUE) {
/*
* When running in a multi-threaded mode, we pend on the read event
* flag set and timeout event flag set in the isr. This avoids wasting CPU
* cycles waiting in this thread, when we could be doing something more
* profitable elsewhere.
*/
ALT_FLAG_PEND (sp->events,
ALT_JTAG_UART_READ_RDY | ALT_JTAG_UART_TIMEOUT,
OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME,
0);
}
else {
/* Spin until more data arrives or until host disconnects */
while (in == sp->rx_in && sp->host_inactive < sp->timeout)
;
}
#else
/* No OS: Always spin */
while (in == sp->rx_in && sp->host_inactive < sp->timeout)
800b78: e0800017 ldw r2,0(fp)
800b7c: 10c00a17 ldw r3,40(r2)
800b80: e0800817 ldw r2,32(fp)
800b84: 1880061e bne r3,r2,800ba0 <altera_avalon_jtag_uart_read+0x158>
800b88: e0800017 ldw r2,0(fp)
800b8c: e0c00017 ldw r3,0(fp)
800b90: 11000917 ldw r4,36(r2)
800b94: 18800117 ldw r2,4(r3)
800b98: 2080012e bgeu r4,r2,800ba0 <altera_avalon_jtag_uart_read+0x158>
800b9c: 003ff606 br 800b78 <altera_avalon_jtag_uart_read+0x130>
;
#endif /* __ucosii__ */
if (in == sp->rx_in)
800ba0: e0800017 ldw r2,0(fp)
800ba4: 10c00a17 ldw r3,40(r2)
800ba8: e0800817 ldw r2,32(fp)
800bac: 18bfb11e bne r3,r2,800a74 <altera_avalon_jtag_uart_read+0x2c>
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
800bb0: e0000915 stw zero,36(fp)
break;
}
/*
* Now that access to the circular buffer is complete, release the read
* semaphore so that other threads can access the buffer.
*/
ALT_SEM_POST (sp->read_lock);
if (ptr != buffer)
800bb4: e0c00417 ldw r3,16(fp)
800bb8: e0800117 ldw r2,4(fp)
800bbc: 18801726 beq r3,r2,800c1c <altera_avalon_jtag_uart_read+0x1d4>
alt_irq_disable_all (void)
{
alt_irq_context context;
NIOS2_READ_STATUS (context);
800bc0: 0005303a rdctl r2,status
800bc4: e0800a15 stw r2,40(fp)
NIOS2_WRITE_STATUS (0);
800bc8: 0001703a wrctl status,zero
800bcc: e0800a17 ldw r2,40(fp)
800bd0: e0800815 stw r2,32(fp)
800bd4: e0800817 ldw r2,32(fp)
800bd8: e0800515 stw r2,20(fp)
{
/* If we read any data then there is space in the buffer so enable interrupts */
context = alt_irq_disable_all();
sp->irq_enable |= ALTERA_AVALON_JTAG_UART_CONTROL_RE_MSK;
800bdc: e0c00017 ldw r3,0(fp)
800be0: e0800017 ldw r2,0(fp)
800be4: 10800817 ldw r2,32(r2)
800be8: 10800054 ori r2,r2,1
800bec: 18800815 stw r2,32(r3)
IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(sp->base, sp->irq_enable);
800bf0: e0800017 ldw r2,0(fp)
800bf4: 10800017 ldw r2,0(r2)
800bf8: 10800104 addi r2,r2,4
800bfc: 1007883a mov r3,r2
800c00: e0800017 ldw r2,0(fp)
800c04: 10800817 ldw r2,32(r2)
800c08: 18800035 stwio r2,0(r3)
*/
static ALT_INLINE void ALT_ALWAYS_INLINE
alt_irq_enable_all (alt_irq_context context)
{
800c0c: e0800517 ldw r2,20(fp)
800c10: e0800a15 stw r2,40(fp)
NIOS2_WRITE_STATUS (context);
800c14: e0800a17 ldw r2,40(fp)
800c18: 1001703a wrctl status,r2
alt_irq_enable_all(context);
}
if (ptr != buffer)
800c1c: e0c00417 ldw r3,16(fp)
800c20: e0800117 ldw r2,4(fp)
800c24: 18800526 beq r3,r2,800c3c <altera_avalon_jtag_uart_read+0x1f4>
return ptr - buffer;
800c28: e0800417 ldw r2,16(fp)
800c2c: e0c00117 ldw r3,4(fp)
800c30: 10c5c83a sub r2,r2,r3
800c34: e0800b15 stw r2,44(fp)
800c38: 00000a06 br 800c64 <altera_avalon_jtag_uart_read+0x21c>
else if (flags & O_NONBLOCK)
800c3c: e0800317 ldw r2,12(fp)
800c40: 1004d3ba srli r2,r2,14
800c44: 1080004c andi r2,r2,1
800c48: 1005003a cmpeq r2,r2,zero
800c4c: 1000031e bne r2,zero,800c5c <altera_avalon_jtag_uart_read+0x214>
return -EWOULDBLOCK;
800c50: 00bffd44 movi r2,-11
800c54: e0800b15 stw r2,44(fp)
800c58: 00000206 br 800c64 <altera_avalon_jtag_uart_read+0x21c>
else
return -EIO;
800c5c: 00bffec4 movi r2,-5
800c60: e0800b15 stw r2,44(fp)
}
800c64: e0800b17 ldw r2,44(fp)
800c68: dfc00d17 ldw ra,52(sp)
800c6c: df000c17 ldw fp,48(sp)
800c70: dec00e04 addi sp,sp,56
800c74: f800283a ret
00800c78 <altera_avalon_jtag_uart_write>:
int
altera_avalon_jtag_uart_write(altera_avalon_jtag_uart_state* sp,
const char * ptr, int count, int flags)
{
800c78: defff104 addi sp,sp,-60
800c7c: dfc00e15 stw ra,56(sp)
800c80: df000d15 stw fp,52(sp)
800c84: d839883a mov fp,sp
800c88: e1000015 stw r4,0(fp)
800c8c: e1400115 stw r5,4(fp)
800c90: e1800215 stw r6,8(fp)
800c94: e1c00315 stw r7,12(fp)
/* Remove warning at optimisation level 03 by seting out to 0 */
unsigned int in, out=0;
800c98: e0000515 stw zero,20(fp)
unsigned int n;
alt_irq_context context;
const char * start = ptr;
800c9c: e0800117 ldw r2,4(fp)
800ca0: e0800815 stw r2,32(fp)
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
800ca4: e0000915 stw zero,36(fp)
/*
* When running in a multi threaded environment, obtain the "write_lock"
* semaphore. This ensures that writing to the device is thread-safe.
*/
ALT_SEM_PEND (sp->write_lock, 0);
do
{
/* Copy as much as we can into the transmit buffer */
while (count > 0)
800ca8: e0800217 ldw r2,8(fp)
800cac: 10800050 cmplti r2,r2,1
800cb0: 10003a1e bne r2,zero,800d9c <altera_avalon_jtag_uart_write+0x124>
{
/* We need a stable value of the out pointer to calculate the space available */
in = sp->tx_in;
800cb4: e0800017 ldw r2,0(fp)
800cb8: 10800c17 ldw r2,48(r2)
800cbc: e0800415 stw r2,16(fp)
out = sp->tx_out;
800cc0: e0800017 ldw r2,0(fp)
800cc4: 10800d17 ldw r2,52(r2)
800cc8: e0800515 stw r2,20(fp)
if (in < out)
800ccc: e0c00417 ldw r3,16(fp)
800cd0: e0800517 ldw r2,20(fp)
800cd4: 1880062e bgeu r3,r2,800cf0 <altera_avalon_jtag_uart_write+0x78>
n = out - 1 - in;
800cd8: e0c00517 ldw r3,20(fp)
800cdc: e0800417 ldw r2,16(fp)
800ce0: 1885c83a sub r2,r3,r2
800ce4: 10bfffc4 addi r2,r2,-1
800ce8: e0800615 stw r2,24(fp)
800cec: 00000c06 br 800d20 <altera_avalon_jtag_uart_write+0xa8>
else if (out > 0)
800cf0: e0800517 ldw r2,20(fp)
800cf4: 1005003a cmpeq r2,r2,zero
800cf8: 1000051e bne r2,zero,800d10 <altera_avalon_jtag_uart_write+0x98>
n = ALTERA_AVALON_JTAG_UART_BUF_LEN - in;
800cfc: 00820004 movi r2,2048
800d00: e0c00417 ldw r3,16(fp)
800d04: 10c5c83a sub r2,r2,r3
800d08: e0800615 stw r2,24(fp)
800d0c: 00000406 br 800d20 <altera_avalon_jtag_uart_write+0xa8>
else
n = ALTERA_AVALON_JTAG_UART_BUF_LEN - 1 - in;
800d10: 0081ffc4 movi r2,2047
800d14: e0c00417 ldw r3,16(fp)
800d18: 10c5c83a sub r2,r2,r3
800d1c: e0800615 stw r2,24(fp)
if (n == 0)
800d20: e0800617 ldw r2,24(fp)
800d24: 1004c03a cmpne r2,r2,zero
800d28: 1000011e bne r2,zero,800d30 <altera_avalon_jtag_uart_write+0xb8>
break;
800d2c: 00001b06 br 800d9c <altera_avalon_jtag_uart_write+0x124>
if (n > count)
800d30: e0c00217 ldw r3,8(fp)
800d34: e0800617 ldw r2,24(fp)
800d38: 1880022e bgeu r3,r2,800d44 <altera_avalon_jtag_uart_write+0xcc>
n = count;
800d3c: e0800217 ldw r2,8(fp)
800d40: e0800615 stw r2,24(fp)
memcpy(sp->tx_buf + in, ptr, n);
800d44: e0c00017 ldw r3,0(fp)
800d48: e0800417 ldw r2,16(fp)
800d4c: 1885883a add r2,r3,r2
800d50: 11020e04 addi r4,r2,2104
800d54: e1400117 ldw r5,4(fp)
800d58: e1800617 ldw r6,24(fp)
800d5c: 08034840 call 803484 <memcpy>
ptr += n;
800d60: e0c00117 ldw r3,4(fp)
800d64: e0800617 ldw r2,24(fp)
800d68: 1885883a add r2,r3,r2
800d6c: e0800115 stw r2,4(fp)
count -= n;
800d70: e0c00217 ldw r3,8(fp)
800d74: e0800617 ldw r2,24(fp)
800d78: 1885c83a sub r2,r3,r2
800d7c: e0800215 stw r2,8(fp)
sp->tx_in = (in + n) % ALTERA_AVALON_JTAG_UART_BUF_LEN;
800d80: e1000017 ldw r4,0(fp)
800d84: e0c00417 ldw r3,16(fp)
800d88: e0800617 ldw r2,24(fp)
800d8c: 1885883a add r2,r3,r2
800d90: 1081ffcc andi r2,r2,2047
800d94: 20800c15 stw r2,48(r4)
800d98: 003fc306 br 800ca8 <altera_avalon_jtag_uart_write+0x30>
alt_irq_disable_all (void)
{
alt_irq_context context;
NIOS2_READ_STATUS (context);
800d9c: 0005303a rdctl r2,status
800da0: e0800b15 stw r2,44(fp)
NIOS2_WRITE_STATUS (0);
800da4: 0001703a wrctl status,zero
800da8: e0800b17 ldw r2,44(fp)
800dac: e0800a15 stw r2,40(fp)
800db0: e0800a17 ldw r2,40(fp)
800db4: e0800715 stw r2,28(fp)
}
/*
* TODO: if interrupts are disabled then we could transmit here, we only need to enable
* interrupts if there is no space left in the FIFO
*/
/* For now kick the interrupt routine every time to make it transmit the data */
context = alt_irq_disable_all();
sp->irq_enable |= ALTERA_AVALON_JTAG_UART_CONTROL_WE_MSK;
800db8: e0c00017 ldw r3,0(fp)
800dbc: e0800017 ldw r2,0(fp)
800dc0: 10800817 ldw r2,32(r2)
800dc4: 10800094 ori r2,r2,2
800dc8: 18800815 stw r2,32(r3)
IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(sp->base, sp->irq_enable);
800dcc: e0800017 ldw r2,0(fp)
800dd0: 10800017 ldw r2,0(r2)
800dd4: 10800104 addi r2,r2,4
800dd8: 1007883a mov r3,r2
800ddc: e0800017 ldw r2,0(fp)
800de0: 10800817 ldw r2,32(r2)
800de4: 18800035 stwio r2,0(r3)
*/
static ALT_INLINE void ALT_ALWAYS_INLINE
alt_irq_enable_all (alt_irq_context context)
{
800de8: e0800717 ldw r2,28(fp)
800dec: e0800b15 stw r2,44(fp)
NIOS2_WRITE_STATUS (context);
800df0: e0800b17 ldw r2,44(fp)
800df4: 1001703a wrctl status,r2
alt_irq_enable_all(context);
/* If there is any data left then either return now or block until some has been sent */
/* TODO: test whether there is anything there while doing this and delay for at most 2s. */
if (count > 0)
800df8: e0800217 ldw r2,8(fp)
800dfc: 10800050 cmplti r2,r2,1
800e00: 1000151e bne r2,zero,800e58 <altera_avalon_jtag_uart_write+0x1e0>
{
if (flags & O_NONBLOCK)
800e04: e0800317 ldw r2,12(fp)
800e08: 1004d3ba srli r2,r2,14
800e0c: 1080004c andi r2,r2,1
800e10: 1005003a cmpeq r2,r2,zero
800e14: 1000011e bne r2,zero,800e1c <altera_avalon_jtag_uart_write+0x1a4>
break;
800e18: 00001306 br 800e68 <altera_avalon_jtag_uart_write+0x1f0>
#ifdef __ucosii__
/* OS Present: Pend on a flag if the OS is running, otherwise spin */
if(OSRunning == OS_TRUE) {
/*
* When running in a multi-threaded mode, we pend on the write event
* flag set or the timeout flag in the isr. This avoids wasting CPU
* cycles waiting in this thread, when we could be doing something
* more profitable elsewhere.
*/
ALT_FLAG_PEND (sp->events,
ALT_JTAG_UART_WRITE_RDY | ALT_JTAG_UART_TIMEOUT,
OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME,
0);
}
else {
/*
* OS not running: Wait for data to be removed from buffer.
* Once the interrupt routine has removed some data then we
* will be able to insert some more.
*/
while (out == sp->tx_out && sp->host_inactive < sp->timeout)
;
}
#else
/*
* No OS present: Always wait for data to be removed from buffer. Once
* the interrupt routine has removed some data then we will be able to
* insert some more.
*/
while (out == sp->tx_out && sp->host_inactive < sp->timeout)
800e1c: e0800017 ldw r2,0(fp)
800e20: 10c00d17 ldw r3,52(r2)
800e24: e0800517 ldw r2,20(fp)
800e28: 1880061e bne r3,r2,800e44 <altera_avalon_jtag_uart_write+0x1cc>
800e2c: e0800017 ldw r2,0(fp)
800e30: e0c00017 ldw r3,0(fp)
800e34: 11000917 ldw r4,36(r2)
800e38: 18800117 ldw r2,4(r3)
800e3c: 2080012e bgeu r4,r2,800e44 <altera_avalon_jtag_uart_write+0x1cc>
800e40: 003ff606 br 800e1c <altera_avalon_jtag_uart_write+0x1a4>
;
#endif /* __ucosii__ */
if (out == sp->tx_out)
800e44: e0800017 ldw r2,0(fp)
800e48: 10c00d17 ldw r3,52(r2)
800e4c: e0800517 ldw r2,20(fp)
800e50: 1880011e bne r3,r2,800e58 <altera_avalon_jtag_uart_write+0x1e0>
break;
800e54: 00000406 br 800e68 <altera_avalon_jtag_uart_write+0x1f0>
}
}
800e58: e0800217 ldw r2,8(fp)
800e5c: 10800050 cmplti r2,r2,1
800e60: 1000011e bne r2,zero,800e68 <altera_avalon_jtag_uart_write+0x1f0>
800e64: 003f9006 br 800ca8 <altera_avalon_jtag_uart_write+0x30>
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
800e68: e0000b15 stw zero,44(fp)
while (count > 0);
/*
* Now that access to the circular buffer is complete, release the write
* semaphore so that other threads can access the buffer.
*/
ALT_SEM_POST (sp->write_lock);
if (ptr != start)
800e6c: e0c00117 ldw r3,4(fp)
800e70: e0800817 ldw r2,32(fp)
800e74: 18800526 beq r3,r2,800e8c <altera_avalon_jtag_uart_write+0x214>
return ptr - start;
800e78: e0800117 ldw r2,4(fp)
800e7c: e0c00817 ldw r3,32(fp)
800e80: 10c5c83a sub r2,r2,r3
800e84: e0800c15 stw r2,48(fp)
800e88: 00000a06 br 800eb4 <altera_avalon_jtag_uart_write+0x23c>
else if (flags & O_NONBLOCK)
800e8c: e0800317 ldw r2,12(fp)
800e90: 1004d3ba srli r2,r2,14
800e94: 1080004c andi r2,r2,1
800e98: 1005003a cmpeq r2,r2,zero
800e9c: 1000031e bne r2,zero,800eac <altera_avalon_jtag_uart_write+0x234>
return -EWOULDBLOCK;
800ea0: 00bffd44 movi r2,-11
800ea4: e0800c15 stw r2,48(fp)
800ea8: 00000206 br 800eb4 <altera_avalon_jtag_uart_write+0x23c>
else
return -EIO; /* Host not connected */
800eac: 00bffec4 movi r2,-5
800eb0: e0800c15 stw r2,48(fp)
}
800eb4: e0800c17 ldw r2,48(fp)
800eb8: dfc00e17 ldw ra,56(sp)
800ebc: df000d17 ldw fp,52(sp)
800ec0: dec00f04 addi sp,sp,60
800ec4: f800283a ret
00800ec8 <lcd_write_command>:
/* --------------------------------------------------------------------- */
static void lcd_write_command(altera_avalon_lcd_16207_state* sp,
unsigned char command)
{
800ec8: defffa04 addi sp,sp,-24
800ecc: dfc00515 stw ra,20(sp)
800ed0: df000415 stw fp,16(sp)
800ed4: d839883a mov fp,sp
800ed8: e1000015 stw r4,0(fp)
800edc: e1400105 stb r5,4(fp)
unsigned int base = sp->base;
800ee0: e0800017 ldw r2,0(fp)
800ee4: 10800017 ldw r2,0(r2)
800ee8: e0800215 stw r2,8(fp)
/* We impose a timeout on the driver in case the LCD panel isn't connected.
* The first time we call this function the timeout is approx 25ms
* (assuming 5 cycles per loop and a 200MHz clock). Obviously systems
* with slower clocks, or debug builds, or slower memory will take longer.
*/
int i = 1000000;
800eec: 008003f4 movhi r2,15
800ef0: 10909004 addi r2,r2,16960
800ef4: e0800315 stw r2,12(fp)
/* Don't bother if the LCD panel didn't work before */
if (sp->broken)
800ef8: e0800017 ldw r2,0(fp)
800efc: 10800807 ldb r2,32(r2)
800f00: 1005003a cmpeq r2,r2,zero
800f04: 1000011e bne r2,zero,800f0c <lcd_write_command+0x44>
return;
800f08: 00001506 br 800f60 <lcd_write_command+0x98>
/* Wait until LCD isn't busy. */
while (IORD_ALTERA_AVALON_LCD_16207_STATUS(base) & ALTERA_AVALON_LCD_16207_STATUS_BUSY_MSK)
800f0c: e0800217 ldw r2,8(fp)
800f10: 10800104 addi r2,r2,4
800f14: 10800037 ldwio r2,0(r2)
800f18: 1004d1fa srli r2,r2,7
800f1c: 1080004c andi r2,r2,1
800f20: 1005003a cmpeq r2,r2,zero
800f24: 1000091e bne r2,zero,800f4c <lcd_write_command+0x84>
if (--i == 0)
800f28: e0800317 ldw r2,12(fp)
800f2c: 10bfffc4 addi r2,r2,-1
800f30: e0800315 stw r2,12(fp)
800f34: 1004c03a cmpne r2,r2,zero
800f38: 103ff41e bne r2,zero,800f0c <lcd_write_command+0x44>
{
sp->broken = 1;
800f3c: e0c00017 ldw r3,0(fp)
800f40: 00800044 movi r2,1
800f44: 18800805 stb r2,32(r3)
return;
800f48: 00000506 br 800f60 <lcd_write_command+0x98>
}
/* Despite what it says in the datasheet, the LCD isn't ready to accept
* a write immediately after it returns BUSY=0. Wait for 100us more.
*/
usleep(100);
800f4c: 01001904 movi r4,100
800f50: 08027940 call 802794 <usleep>
IOWR_ALTERA_AVALON_LCD_16207_COMMAND(base, command);
800f54: e0c00217 ldw r3,8(fp)
800f58: e0800103 ldbu r2,4(fp)
800f5c: 18800035 stwio r2,0(r3)
}
800f60: dfc00517 ldw ra,20(sp)
800f64: df000417 ldw fp,16(sp)
800f68: dec00604 addi sp,sp,24
800f6c: f800283a ret
00800f70 <lcd_write_data>:
/* --------------------------------------------------------------------- */
static void lcd_write_data(altera_avalon_lcd_16207_state* sp,
unsigned char data)
{
800f70: defffa04 addi sp,sp,-24
800f74: dfc00515 stw ra,20(sp)
800f78: df000415 stw fp,16(sp)
800f7c: d839883a mov fp,sp
800f80: e1000015 stw r4,0(fp)
800f84: e1400105 stb r5,4(fp)
unsigned int base = sp->base;
800f88: e0800017 ldw r2,0(fp)
800f8c: 10800017 ldw r2,0(r2)
800f90: e0800215 stw r2,8(fp)
/* We impose a timeout on the driver in case the LCD panel isn't connected.
* The first time we call this function the timeout is approx 25ms
* (assuming 5 cycles per loop and a 200MHz clock). Obviously systems
* with slower clocks, or debug builds, or slower memory will take longer.
*/
int i = 1000000;
800f94: 008003f4 movhi r2,15
800f98: 10909004 addi r2,r2,16960
800f9c: e0800315 stw r2,12(fp)
/* Don't bother if the LCD panel didn't work before */
if (sp->broken)
800fa0: e0800017 ldw r2,0(fp)
800fa4: 10800807 ldb r2,32(r2)
800fa8: 1005003a cmpeq r2,r2,zero
800fac: 1000011e bne r2,zero,800fb4 <lcd_write_data+0x44>
return;
800fb0: 00001c06 br 801024 <lcd_write_data+0xb4>
/* Wait until LCD isn't busy. */
while (IORD_ALTERA_AVALON_LCD_16207_STATUS(base) & ALTERA_AVALON_LCD_16207_STATUS_BUSY_MSK)
800fb4: e0800217 ldw r2,8(fp)
800fb8: 10800104 addi r2,r2,4
800fbc: 10800037 ldwio r2,0(r2)
800fc0: 1004d1fa srli r2,r2,7
800fc4: 1080004c andi r2,r2,1
800fc8: 1005003a cmpeq r2,r2,zero
800fcc: 1000091e bne r2,zero,800ff4 <lcd_write_data+0x84>
if (--i == 0)
800fd0: e0800317 ldw r2,12(fp)
800fd4: 10bfffc4 addi r2,r2,-1
800fd8: e0800315 stw r2,12(fp)
800fdc: 1004c03a cmpne r2,r2,zero
800fe0: 103ff41e bne r2,zero,800fb4 <lcd_write_data+0x44>
{
sp->broken = 1;
800fe4: e0c00017 ldw r3,0(fp)
800fe8: 00800044 movi r2,1
800fec: 18800805 stb r2,32(r3)
return;
800ff0: 00000c06 br 801024 <lcd_write_data+0xb4>
}
/* Despite what it says in the datasheet, the LCD isn't ready to accept
* a write immediately after it returns BUSY=0. Wait for 100us more.
*/
usleep(100);
800ff4: 01001904 movi r4,100
800ff8: 08027940 call 802794 <usleep>
IOWR_ALTERA_AVALON_LCD_16207_DATA(base, data);
800ffc: e0800217 ldw r2,8(fp)
801000: 10800204 addi r2,r2,8
801004: 1007883a mov r3,r2
801008: e0800103 ldbu r2,4(fp)
80100c: 18800035 stwio r2,0(r3)
sp->address++;
801010: e0c00017 ldw r3,0(fp)
801014: e0800017 ldw r2,0(fp)
801018: 108008c3 ldbu r2,35(r2)
80101c: 10800044 addi r2,r2,1
801020: 188008c5 stb r2,35(r3)
}
801024: dfc00517 ldw ra,20(sp)
801028: df000417 ldw fp,16(sp)
80102c: dec00604 addi sp,sp,24
801030: f800283a ret
00801034 <lcd_clear_screen>:
/* --------------------------------------------------------------------- */
static void lcd_clear_screen(altera_avalon_lcd_16207_state* sp)
{
801034: defffc04 addi sp,sp,-16
801038: dfc00315 stw ra,12(sp)
80103c: df000215 stw fp,8(sp)
801040: d839883a mov fp,sp
801044: e1000015 stw r4,0(fp)
int y;
lcd_write_command(sp, LCD_CMD_CLEAR);
801048: e1000017 ldw r4,0(fp)
80104c: 01400044 movi r5,1
801050: 0800ec80 call 800ec8 <lcd_write_command>
sp->x = 0;
801054: e0800017 ldw r2,0(fp)
801058: 10000845 stb zero,33(r2)
sp->y = 0;
80105c: e0800017 ldw r2,0(fp)
801060: 10000885 stb zero,34(r2)
sp->address = 0;
801064: e0800017 ldw r2,0(fp)
801068: 100008c5 stb zero,35(r2)
for (y = 0 ; y < ALT_LCD_HEIGHT ; y++)
80106c: e0000115 stw zero,4(fp)
801070: e0800117 ldw r2,4(fp)
801074: 10800088 cmpgei r2,r2,2
801078: 10001a1e bne r2,zero,8010e4 <lcd_clear_screen+0xb0>
{
memset(sp->line[y].data, ' ', sizeof(sp->line[0].data));
80107c: e0800117 ldw r2,4(fp)
801080: 10c018e4 muli r3,r2,99
801084: e0800017 ldw r2,0(fp)
801088: 1885883a add r2,r3,r2
80108c: 11001004 addi r4,r2,64
801090: 01400804 movi r5,32
801094: 01801444 movi r6,81
801098: 08035400 call 803540 <memset>
memset(sp->line[y].visible, ' ', sizeof(sp->line[0].visible));
80109c: e0800117 ldw r2,4(fp)
8010a0: 10c018e4 muli r3,r2,99
8010a4: e0800017 ldw r2,0(fp)
8010a8: 1885883a add r2,r3,r2
8010ac: 11000c04 addi r4,r2,48
8010b0: 01400804 movi r5,32
8010b4: 01800404 movi r6,16
8010b8: 08035400 call 803540 <memset>
sp->line[y].width = 0;
8010bc: e0c00017 ldw r3,0(fp)
8010c0: e0800117 ldw r2,4(fp)
8010c4: 108018e4 muli r2,r2,99
8010c8: 10c5883a add r2,r2,r3
8010cc: 10802404 addi r2,r2,144
8010d0: 10000045 stb zero,1(r2)
8010d4: e0800117 ldw r2,4(fp)
8010d8: 10800044 addi r2,r2,1
8010dc: e0800115 stw r2,4(fp)
8010e0: 003fe306 br 801070 <lcd_clear_screen+0x3c>
}
}
8010e4: dfc00317 ldw ra,12(sp)
8010e8: df000217 ldw fp,8(sp)
8010ec: dec00404 addi sp,sp,16
8010f0: f800283a ret
008010f4 <lcd_repaint_screen>:
/* --------------------------------------------------------------------- */
static void lcd_repaint_screen(altera_avalon_lcd_16207_state* sp)
{
8010f4: defff604 addi sp,sp,-40
8010f8: dfc00915 stw ra,36(sp)
8010fc: df000815 stw fp,32(sp)
801100: dc000715 stw r16,28(sp)
801104: d839883a mov fp,sp
801108: e1000015 stw r4,0(fp)
int y, x;
/* scrollpos controls how much the lines have scrolled round. The speed
* each line scrolls at is controlled by its speed variable - while
* scrolline lines will wrap at the position set by width
*/
int scrollpos = sp->scrollpos;
80110c: e0800017 ldw r2,0(fp)
801110: 10800947 ldb r2,37(r2)
801114: e0800315 stw r2,12(fp)
for (y = 0 ; y < ALT_LCD_HEIGHT ; y++)
801118: e0000115 stw zero,4(fp)
80111c: e0800117 ldw r2,4(fp)
801120: 10800088 cmpgei r2,r2,2
801124: 10005a1e bne r2,zero,801290 <lcd_repaint_screen+0x19c>
{
int width = sp->line[y].width;
801128: e0c00017 ldw r3,0(fp)
80112c: e0800117 ldw r2,4(fp)
801130: 108018e4 muli r2,r2,99
801134: 10c5883a add r2,r2,r3
801138: 10802404 addi r2,r2,144
80113c: 10800047 ldb r2,1(r2)
801140: e0800415 stw r2,16(fp)
int offset = (scrollpos * sp->line[y].speed) >> 8;
801144: e0c00017 ldw r3,0(fp)
801148: e0800117 ldw r2,4(fp)
80114c: 108018e4 muli r2,r2,99
801150: 10c5883a add r2,r2,r3
801154: 10802404 addi r2,r2,144
801158: 10c00083 ldbu r3,2(r2)
80115c: e0800317 ldw r2,12(fp)
801160: 1885383a mul r2,r3,r2
801164: 1005d23a srai r2,r2,8
801168: e0800515 stw r2,20(fp)
if (offset >= width)
80116c: e0c00517 ldw r3,20(fp)
801170: e0800417 ldw r2,16(fp)
801174: 18800116 blt r3,r2,80117c <lcd_repaint_screen+0x88>
offset = 0;
801178: e0000515 stw zero,20(fp)
for (x = 0 ; x < ALT_LCD_WIDTH ; x++)
80117c: e0000215 stw zero,8(fp)
801180: e0800217 ldw r2,8(fp)
801184: 10800408 cmpgei r2,r2,16
801188: 10003d1e bne r2,zero,801280 <lcd_repaint_screen+0x18c>
{
char c = sp->line[y].data[(x + offset) % width];
80118c: e4000017 ldw r16,0(fp)
801190: e0c00217 ldw r3,8(fp)
801194: e0800517 ldw r2,20(fp)
801198: 1889883a add r4,r3,r2
80119c: e1400417 ldw r5,16(fp)
8011a0: 0803b100 call 803b10 <__modsi3>
8011a4: 1007883a mov r3,r2
8011a8: e0800117 ldw r2,4(fp)
8011ac: 108018e4 muli r2,r2,99
8011b0: 1405883a add r2,r2,r16
8011b4: 10c5883a add r2,r2,r3
8011b8: 10801004 addi r2,r2,64
8011bc: 10800003 ldbu r2,0(r2)
8011c0: e0800605 stb r2,24(fp)
/* Writing data takes 40us, so don't do it unless required */
if (sp->line[y].visible[x] != c)
8011c4: e0c00017 ldw r3,0(fp)
8011c8: e0800117 ldw r2,4(fp)
8011cc: 108018e4 muli r2,r2,99
8011d0: 10c7883a add r3,r2,r3
8011d4: e0800217 ldw r2,8(fp)
8011d8: 1885883a add r2,r3,r2
8011dc: 10800c04 addi r2,r2,48
8011e0: 10c00007 ldb r3,0(r2)
8011e4: e0800607 ldb r2,24(fp)
8011e8: 18802126 beq r3,r2,801270 <lcd_repaint_screen+0x17c>
{
unsigned char address = x + colstart[y];
8011ec: e0c00117 ldw r3,4(fp)
8011f0: d0a00504 addi r2,gp,-32748
8011f4: 1885883a add r2,r3,r2
8011f8: e0c00217 ldw r3,8(fp)
8011fc: 11000003 ldbu r4,0(r2)
801200: 1805883a mov r2,r3
801204: 2085883a add r2,r4,r2
801208: e0800645 stb r2,25(fp)
if (address != sp->address)
80120c: e0c00643 ldbu r3,25(fp)
801210: e0800017 ldw r2,0(fp)
801214: 108008c7 ldb r2,35(r2)
801218: 18800926 beq r3,r2,801240 <lcd_repaint_screen+0x14c>
{
lcd_write_command(sp, LCD_CMD_WRITE_DATA | address);
80121c: e0c00643 ldbu r3,25(fp)
801220: 00bfe004 movi r2,-128
801224: 1884b03a or r2,r3,r2
801228: 11403fcc andi r5,r2,255
80122c: e1000017 ldw r4,0(fp)
801230: 0800ec80 call 800ec8 <lcd_write_command>
sp->address = address;
801234: e0c00017 ldw r3,0(fp)
801238: e0800643 ldbu r2,25(fp)
80123c: 188008c5 stb r2,35(r3)
}
lcd_write_data(sp, c);
801240: e1400603 ldbu r5,24(fp)
801244: e1000017 ldw r4,0(fp)
801248: 0800f700 call 800f70 <lcd_write_data>
sp->line[y].visible[x] = c;
80124c: e0c00017 ldw r3,0(fp)
801250: e0800117 ldw r2,4(fp)
801254: 108018e4 muli r2,r2,99
801258: 10c7883a add r3,r2,r3
80125c: e0800217 ldw r2,8(fp)
801260: 1885883a add r2,r3,r2
801264: 10c00c04 addi r3,r2,48
801268: e0800603 ldbu r2,24(fp)
80126c: 18800005 stb r2,0(r3)
801270: e0800217 ldw r2,8(fp)
801274: 10800044 addi r2,r2,1
801278: e0800215 stw r2,8(fp)
80127c: 003fc006 br 801180 <lcd_repaint_screen+0x8c>
801280: e0800117 ldw r2,4(fp)
801284: 10800044 addi r2,r2,1
801288: e0800115 stw r2,4(fp)
80128c: 003fa306 br 80111c <lcd_repaint_screen+0x28>
}
}
}
}
801290: dfc00917 ldw ra,36(sp)
801294: df000817 ldw fp,32(sp)
801298: dc000717 ldw r16,28(sp)
80129c: dec00a04 addi sp,sp,40
8012a0: f800283a ret
008012a4 <lcd_scroll_up>:
/* --------------------------------------------------------------------- */
static void lcd_scroll_up(altera_avalon_lcd_16207_state* sp)
{
8012a4: defffc04 addi sp,sp,-16
8012a8: dfc00315 stw ra,12(sp)
8012ac: df000215 stw fp,8(sp)
8012b0: d839883a mov fp,sp
8012b4: e1000015 stw r4,0(fp)
int y;
for (y = 0 ; y < ALT_LCD_HEIGHT ; y++)
8012b8: e0000115 stw zero,4(fp)
8012bc: e0800117 ldw r2,4(fp)
8012c0: 10800088 cmpgei r2,r2,2
8012c4: 10001c1e bne r2,zero,801338 <lcd_scroll_up+0x94>
{
if (y < ALT_LCD_HEIGHT-1)
8012c8: e0800117 ldw r2,4(fp)
8012cc: 10800048 cmpgei r2,r2,1
8012d0: 10000d1e bne r2,zero,801308 <lcd_scroll_up+0x64>
memcpy(sp->line[y].data, sp->line[y+1].data, ALT_LCD_VIRTUAL_WIDTH);
8012d4: e0800117 ldw r2,4(fp)
8012d8: 10c018e4 muli r3,r2,99
8012dc: e0800017 ldw r2,0(fp)
8012e0: 1885883a add r2,r3,r2
8012e4: 11001004 addi r4,r2,64
8012e8: e0800117 ldw r2,4(fp)
8012ec: 10c018e4 muli r3,r2,99
8012f0: e0800017 ldw r2,0(fp)
8012f4: 1885883a add r2,r3,r2
8012f8: 114028c4 addi r5,r2,163
8012fc: 01801404 movi r6,80
801300: 08034840 call 803484 <memcpy>
801304: 00000806 br 801328 <lcd_scroll_up+0x84>
else
memset(sp->line[y].data, ' ', ALT_LCD_VIRTUAL_WIDTH);
801308: e0800117 ldw r2,4(fp)
80130c: 10c018e4 muli r3,r2,99
801310: e0800017 ldw r2,0(fp)
801314: 1885883a add r2,r3,r2
801318: 11001004 addi r4,r2,64
80131c: 01400804 movi r5,32
801320: 01801404 movi r6,80
801324: 08035400 call 803540 <memset>
801328: e0800117 ldw r2,4(fp)
80132c: 10800044 addi r2,r2,1
801330: e0800115 stw r2,4(fp)
801334: 003fe106 br 8012bc <lcd_scroll_up+0x18>
}
sp->y--;
801338: e0c00017 ldw r3,0(fp)
80133c: e0800017 ldw r2,0(fp)
801340: 10800883 ldbu r2,34(r2)
801344: 10bfffc4 addi r2,r2,-1
801348: 18800885 stb r2,34(r3)
}
80134c: dfc00317 ldw ra,12(sp)
801350: df000217 ldw fp,8(sp)
801354: dec00404 addi sp,sp,16
801358: f800283a ret
0080135c <lcd_handle_escape>:
/* --------------------------------------------------------------------- */
static void lcd_handle_escape(altera_avalon_lcd_16207_state* sp, char c)
{
80135c: defff804 addi sp,sp,-32
801360: dfc00715 stw ra,28(sp)
801364: df000615 stw fp,24(sp)
801368: d839883a mov fp,sp
80136c: e1000015 stw r4,0(fp)
801370: e1400105 stb r5,4(fp)
int parm1 = 0, parm2 = 0;
801374: e0000215 stw zero,8(fp)
801378: e0000315 stw zero,12(fp)
if (sp->escape[0] == '[')
80137c: e0800017 ldw r2,0(fp)
801380: 10800a07 ldb r2,40(r2)
801384: 108016d8 cmpnei r2,r2,91
801388: 1000361e bne r2,zero,801464 <lcd_handle_escape+0x108>
{
char * ptr = sp->escape+1;
80138c: e0800017 ldw r2,0(fp)
801390: 10800a44 addi r2,r2,41
801394: e0800415 stw r2,16(fp)
while (isdigit(*ptr))
801398: e0800417 ldw r2,16(fp)
80139c: 10c00007 ldb r3,0(r2)
8013a0: 00802034 movhi r2,128
8013a4: 108f5c04 addi r2,r2,15728
8013a8: 1885883a add r2,r3,r2
8013ac: 10800003 ldbu r2,0(r2)
8013b0: 1004d0ba srli r2,r2,2
8013b4: 1080004c andi r2,r2,1
8013b8: 1005003a cmpeq r2,r2,zero
8013bc: 10000c1e bne r2,zero,8013f0 <lcd_handle_escape+0x94>
parm1 = (parm1 * 10) + (*ptr++ - '0');
8013c0: e0800217 ldw r2,8(fp)
8013c4: 110002a4 muli r4,r2,10
8013c8: e1400404 addi r5,fp,16
8013cc: 28c00017 ldw r3,0(r5)
8013d0: 1805883a mov r2,r3
8013d4: 10800007 ldb r2,0(r2)
8013d8: 2085883a add r2,r4,r2
8013dc: 10bff404 addi r2,r2,-48
8013e0: 18c00044 addi r3,r3,1
8013e4: 28c00015 stw r3,0(r5)
8013e8: e0800215 stw r2,8(fp)
8013ec: 003fea06 br 801398 <lcd_handle_escape+0x3c>
if (*ptr == ';')
8013f0: e0800417 ldw r2,16(fp)
8013f4: 10800007 ldb r2,0(r2)
8013f8: 10800ed8 cmpnei r2,r2,59
8013fc: 10001b1e bne r2,zero,80146c <lcd_handle_escape+0x110>
{
ptr++;
801400: e0800417 ldw r2,16(fp)
801404: 10800044 addi r2,r2,1
801408: e0800415 stw r2,16(fp)
while (isdigit(*ptr))
80140c: e0800417 ldw r2,16(fp)
801410: 10c00007 ldb r3,0(r2)
801414: 00802034 movhi r2,128
801418: 108f5c04 addi r2,r2,15728
80141c: 1885883a add r2,r3,r2
801420: 10800003 ldbu r2,0(r2)
801424: 1004d0ba srli r2,r2,2
801428: 1080004c andi r2,r2,1
80142c: 1005003a cmpeq r2,r2,zero
801430: 10000e1e bne r2,zero,80146c <lcd_handle_escape+0x110>
parm2 = (parm2 * 10) + (*ptr++ - '0');
801434: e0800317 ldw r2,12(fp)
801438: 110002a4 muli r4,r2,10
80143c: e1400404 addi r5,fp,16
801440: 28c00017 ldw r3,0(r5)
801444: 1805883a mov r2,r3
801448: 10800007 ldb r2,0(r2)
80144c: 2085883a add r2,r4,r2
801450: 10bff404 addi r2,r2,-48
801454: 18c00044 addi r3,r3,1
801458: 28c00015 stw r3,0(r5)
80145c: e0800315 stw r2,12(fp)
801460: 003fea06 br 80140c <lcd_handle_escape+0xb0>
}
}
else
parm1 = -1;
801464: 00bfffc4 movi r2,-1
801468: e0800215 stw r2,8(fp)
switch (c)
80146c: e0800107 ldb r2,4(fp)
801470: e0800515 stw r2,20(fp)
801474: e0c00517 ldw r3,20(fp)
801478: 188012a0 cmpeqi r2,r3,74
80147c: 10002a1e bne r2,zero,801528 <lcd_handle_escape+0x1cc>
801480: e0c00517 ldw r3,20(fp)
801484: 188012c8 cmpgei r2,r3,75
801488: 1000041e bne r2,zero,80149c <lcd_handle_escape+0x140>
80148c: e0c00517 ldw r3,20(fp)
801490: 18801220 cmpeqi r2,r3,72
801494: 1000081e bne r2,zero,8014b8 <lcd_handle_escape+0x15c>
801498: 00003f06 br 801598 <lcd_handle_escape+0x23c>
80149c: e0c00517 ldw r3,20(fp)
8014a0: 188012e0 cmpeqi r2,r3,75
8014a4: 1000261e bne r2,zero,801540 <lcd_handle_escape+0x1e4>
8014a8: e0c00517 ldw r3,20(fp)
8014ac: 188019a0 cmpeqi r2,r3,102
8014b0: 1000011e bne r2,zero,8014b8 <lcd_handle_escape+0x15c>
8014b4: 00003806 br 801598 <lcd_handle_escape+0x23c>
{
case 'H': /* ESC '[' <y> ';' <x> 'H' : Move cursor to location */
case 'f': /* Same as above */
if (parm2 > 0)
8014b8: e0800317 ldw r2,12(fp)
8014bc: 10800050 cmplti r2,r2,1
8014c0: 1000041e bne r2,zero,8014d4 <lcd_handle_escape+0x178>
sp->x = parm2 - 1;
8014c4: e0c00017 ldw r3,0(fp)
8014c8: e0800317 ldw r2,12(fp)
8014cc: 10bfffc4 addi r2,r2,-1
8014d0: 18800845 stb r2,33(r3)
if (parm1 > 0)
8014d4: e0800217 ldw r2,8(fp)
8014d8: 10800050 cmplti r2,r2,1
8014dc: 10002e1e bne r2,zero,801598 <lcd_handle_escape+0x23c>
{
sp->y = parm1 - 1;
8014e0: e0c00017 ldw r3,0(fp)
8014e4: e0800217 ldw r2,8(fp)
8014e8: 10bfffc4 addi r2,r2,-1
8014ec: 18800885 stb r2,34(r3)
if (sp->y > ALT_LCD_HEIGHT * 2)
8014f0: e0800017 ldw r2,0(fp)
8014f4: 10800883 ldbu r2,34(r2)
8014f8: 10800170 cmpltui r2,r2,5
8014fc: 1000031e bne r2,zero,80150c <lcd_handle_escape+0x1b0>
sp->y = ALT_LCD_HEIGHT * 2;
801500: e0c00017 ldw r3,0(fp)
801504: 00800104 movi r2,4
801508: 18800885 stb r2,34(r3)
while (sp->y > ALT_LCD_HEIGHT)
80150c: e0800017 ldw r2,0(fp)
801510: 10800883 ldbu r2,34(r2)
801514: 108000f0 cmpltui r2,r2,3
801518: 10001f1e bne r2,zero,801598 <lcd_handle_escape+0x23c>
lcd_scroll_up(sp);
80151c: e1000017 ldw r4,0(fp)
801520: 08012a40 call 8012a4 <lcd_scroll_up>
801524: 003ff906 br 80150c <lcd_handle_escape+0x1b0>
}
break;
case 'J':
/* ESC J is clear to beginning of line [unimplemented]
* ESC [ 0 J is clear to bottom of screen [unimplemented]
* ESC [ 1 J is clear to beginning of screen [unimplemented]
* ESC [ 2 J is clear screen
*/
if (parm1 == 2)
801528: e0800217 ldw r2,8(fp)
80152c: 10800098 cmpnei r2,r2,2
801530: 1000191e bne r2,zero,801598 <lcd_handle_escape+0x23c>
lcd_clear_screen(sp);
801534: e1000017 ldw r4,0(fp)
801538: 08010340 call 801034 <lcd_clear_screen>
break;
80153c: 00001606 br 801598 <lcd_handle_escape+0x23c>
case 'K':
/* ESC K is clear to end of line
* ESC [ 0 K is clear to end of line
* ESC [ 1 K is clear to beginning of line [unimplemented]
* ESC [ 2 K is clear line [unimplemented]
*/
if (parm1 < 1)
801540: e0800217 ldw r2,8(fp)
801544: 10800048 cmpgei r2,r2,1
801548: 1000131e bne r2,zero,801598 <lcd_handle_escape+0x23c>
{
if (sp->x < ALT_LCD_VIRTUAL_WIDTH)
80154c: e0800017 ldw r2,0(fp)
801550: 10800843 ldbu r2,33(r2)
801554: 10801428 cmpgeui r2,r2,80
801558: 10000f1e bne r2,zero,801598 <lcd_handle_escape+0x23c>
memset(sp->line[sp->y].data + sp->x, ' ', ALT_LCD_VIRTUAL_WIDTH - sp->x);
80155c: e0800017 ldw r2,0(fp)
801560: 10800883 ldbu r2,34(r2)
801564: 10c018e4 muli r3,r2,99
801568: e0800017 ldw r2,0(fp)
80156c: 1887883a add r3,r3,r2
801570: e0800017 ldw r2,0(fp)
801574: 10800843 ldbu r2,33(r2)
801578: 1885883a add r2,r3,r2
80157c: 11001004 addi r4,r2,64
801580: e0800017 ldw r2,0(fp)
801584: 10c00843 ldbu r3,33(r2)
801588: 00801404 movi r2,80
80158c: 10cdc83a sub r6,r2,r3
801590: 01400804 movi r5,32
801594: 08035400 call 803540 <memset>
}
break;
}
}
801598: dfc00717 ldw ra,28(sp)
80159c: df000617 ldw fp,24(sp)
8015a0: dec00804 addi sp,sp,32
8015a4: f800283a ret
008015a8 <altera_avalon_lcd_16207_write>:
/* --------------------------------------------------------------------- */
int altera_avalon_lcd_16207_write(altera_avalon_lcd_16207_state* sp,
const char* ptr, int len, int flags)
{
8015a8: defff304 addi sp,sp,-52
8015ac: dfc00c15 stw ra,48(sp)
8015b0: df000b15 stw fp,44(sp)
8015b4: dc000a15 stw r16,40(sp)
8015b8: d839883a mov fp,sp
8015bc: e1000015 stw r4,0(fp)
8015c0: e1400115 stw r5,4(fp)
8015c4: e1800215 stw r6,8(fp)
8015c8: e1c00315 stw r7,12(fp)
const char* end = ptr + len;
8015cc: e0c00117 ldw r3,4(fp)
8015d0: e0800217 ldw r2,8(fp)
8015d4: 1885883a add r2,r3,r2
8015d8: e0800415 stw r2,16(fp)
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
8015dc: e0000715 stw zero,28(fp)
int y;
int widthmax;
/* When running in a multi threaded environment, obtain the "write_lock"
* semaphore. This ensures that writing to the device is thread-safe.
*/
ALT_SEM_PEND (sp->write_lock, 0);
/* Tell the routine which is called off the timer interrupt that the
* foreground routines are active so it must not repaint the display. */
sp->active = 1;
8015e0: e0c00017 ldw r3,0(fp)
8015e4: 00800044 movi r2,1
8015e8: 188009c5 stb r2,39(r3)
for ( ; ptr < end ; ptr++)
8015ec: e0c00117 ldw r3,4(fp)
8015f0: e0800417 ldw r2,16(fp)
8015f4: 18808c2e bgeu r3,r2,801828 <altera_avalon_lcd_16207_write+0x280>
{
char c = *ptr;
8015f8: e0800117 ldw r2,4(fp)
8015fc: 10800003 ldbu r2,0(r2)
801600: e0800805 stb r2,32(fp)
if (sp->esccount >= 0)
801604: e0800017 ldw r2,0(fp)
801608: 10800907 ldb r2,36(r2)
80160c: 1004803a cmplt r2,r2,zero
801610: 1000351e bne r2,zero,8016e8 <altera_avalon_lcd_16207_write+0x140>
{
unsigned int esccount = sp->esccount;
801614: e0800017 ldw r2,0(fp)
801618: 10800907 ldb r2,36(r2)
80161c: e0800915 stw r2,36(fp)
/* Single character escape sequences can end with any character
* Multi character escape sequences start with '[' and contain
* digits and semicolons before terminating
*/
if ((esccount == 0 && c != '[') ||
801620: e0800917 ldw r2,36(fp)
801624: 1004c03a cmpne r2,r2,zero
801628: 1000031e bne r2,zero,801638 <altera_avalon_lcd_16207_write+0x90>
80162c: e0800807 ldb r2,32(fp)
801630: 108016d8 cmpnei r2,r2,91
801634: 1000101e bne r2,zero,801678 <altera_avalon_lcd_16207_write+0xd0>
801638: e0800917 ldw r2,36(fp)
80163c: 1005003a cmpeq r2,r2,zero
801640: 1000191e bne r2,zero,8016a8 <altera_avalon_lcd_16207_write+0x100>
801644: e0c00807 ldb r3,32(fp)
801648: 00802034 movhi r2,128
80164c: 108f5c04 addi r2,r2,15728
801650: 1885883a add r2,r3,r2
801654: 10800003 ldbu r2,0(r2)
801658: 1004d0ba srli r2,r2,2
80165c: 1080004c andi r2,r2,1
801660: 1004c03a cmpne r2,r2,zero
801664: 1000101e bne r2,zero,8016a8 <altera_avalon_lcd_16207_write+0x100>
801668: e0800807 ldb r2,32(fp)
80166c: 10800ed8 cmpnei r2,r2,59
801670: 1000011e bne r2,zero,801678 <altera_avalon_lcd_16207_write+0xd0>
801674: 00000c06 br 8016a8 <altera_avalon_lcd_16207_write+0x100>
(esccount > 0 && !isdigit(c) && c != ';'))
{
sp->escape[esccount] = 0;
801678: e0c00017 ldw r3,0(fp)
80167c: e0800917 ldw r2,36(fp)
801680: 1885883a add r2,r3,r2
801684: 10800a04 addi r2,r2,40
801688: 10000005 stb zero,0(r2)
lcd_handle_escape(sp, c);
80168c: e1400807 ldb r5,32(fp)
801690: e1000017 ldw r4,0(fp)
801694: 080135c0 call 80135c <lcd_handle_escape>
sp->esccount = -1;
801698: e0c00017 ldw r3,0(fp)
80169c: 00bfffc4 movi r2,-1
8016a0: 18800905 stb r2,36(r3)
8016a4: 00005c06 br 801818 <altera_avalon_lcd_16207_write+0x270>
}
else if (sp->esccount < sizeof(sp->escape)-1)
8016a8: e0800017 ldw r2,0(fp)
8016ac: 10800903 ldbu r2,36(r2)
8016b0: 108001e8 cmpgeui r2,r2,7
8016b4: 1000581e bne r2,zero,801818 <altera_avalon_lcd_16207_write+0x270>
{
sp->escape[esccount] = c;
8016b8: e0c00017 ldw r3,0(fp)
8016bc: e0800917 ldw r2,36(fp)
8016c0: 1885883a add r2,r3,r2
8016c4: 10c00a04 addi r3,r2,40
8016c8: e0800803 ldbu r2,32(fp)
8016cc: 18800005 stb r2,0(r3)
sp->esccount++;
8016d0: e0c00017 ldw r3,0(fp)
8016d4: e0800017 ldw r2,0(fp)
8016d8: 10800903 ldbu r2,36(r2)
8016dc: 10800044 addi r2,r2,1
8016e0: 18800905 stb r2,36(r3)
8016e4: 00004c06 br 801818 <altera_avalon_lcd_16207_write+0x270>
}
}
else if (c == 27) /* ESC */
8016e8: e0800807 ldb r2,32(fp)
8016ec: 108006d8 cmpnei r2,r2,27
8016f0: 1000031e bne r2,zero,801700 <altera_avalon_lcd_16207_write+0x158>
{
sp->esccount = 0;
8016f4: e0800017 ldw r2,0(fp)
8016f8: 10000905 stb zero,36(r2)
8016fc: 00004606 br 801818 <altera_avalon_lcd_16207_write+0x270>
}
else if (c == '\r')
801700: e0800807 ldb r2,32(fp)
801704: 10800358 cmpnei r2,r2,13
801708: 1000031e bne r2,zero,801718 <altera_avalon_lcd_16207_write+0x170>
{
sp->x = 0;
80170c: e0800017 ldw r2,0(fp)
801710: 10000845 stb zero,33(r2)
801714: 00004006 br 801818 <altera_avalon_lcd_16207_write+0x270>
}
else if (c == '\n')
801718: e0800807 ldb r2,32(fp)
80171c: 10800298 cmpnei r2,r2,10
801720: 10000e1e bne r2,zero,80175c <altera_avalon_lcd_16207_write+0x1b4>
{
sp->x = 0;
801724: e0800017 ldw r2,0(fp)
801728: 10000845 stb zero,33(r2)
sp->y++;
80172c: e0c00017 ldw r3,0(fp)
801730: e0800017 ldw r2,0(fp)
801734: 10800883 ldbu r2,34(r2)
801738: 10800044 addi r2,r2,1
80173c: 18800885 stb r2,34(r3)
/* Let the cursor sit at X=0, Y=HEIGHT without scrolling so the user
* can print two lines of data without losing one.
*/
if (sp->y > ALT_LCD_HEIGHT)
801740: e0800017 ldw r2,0(fp)
801744: 10800883 ldbu r2,34(r2)
801748: 108000f0 cmpltui r2,r2,3
80174c: 1000321e bne r2,zero,801818 <altera_avalon_lcd_16207_write+0x270>
lcd_scroll_up(sp);
801750: e1000017 ldw r4,0(fp)
801754: 08012a40 call 8012a4 <lcd_scroll_up>
801758: 00002f06 br 801818 <altera_avalon_lcd_16207_write+0x270>
}
else if (c == '\b')
80175c: e0800807 ldb r2,32(fp)
801760: 10800218 cmpnei r2,r2,8
801764: 10000a1e bne r2,zero,801790 <altera_avalon_lcd_16207_write+0x1e8>
{
if (sp->x > 0)
801768: e0800017 ldw r2,0(fp)
80176c: 10800843 ldbu r2,33(r2)
801770: 1005003a cmpeq r2,r2,zero
801774: 1000281e bne r2,zero,801818 <altera_avalon_lcd_16207_write+0x270>
sp->x--;
801778: e0c00017 ldw r3,0(fp)
80177c: e0800017 ldw r2,0(fp)
801780: 10800843 ldbu r2,33(r2)
801784: 10bfffc4 addi r2,r2,-1
801788: 18800845 stb r2,33(r3)
80178c: 00002206 br 801818 <altera_avalon_lcd_16207_write+0x270>
}
else if (isprint(c))
801790: e0c00807 ldb r3,32(fp)
801794: 00802034 movhi r2,128
801798: 108f5c04 addi r2,r2,15728
80179c: 1885883a add r2,r3,r2
8017a0: 10800007 ldb r2,0(r2)
8017a4: 108025cc andi r2,r2,151
8017a8: 1005003a cmpeq r2,r2,zero
8017ac: 10001a1e bne r2,zero,801818 <altera_avalon_lcd_16207_write+0x270>
{
/* If we didn't scroll on the last linefeed then we might need to do
* it now. */
if (sp->y >= ALT_LCD_HEIGHT)
8017b0: e0800017 ldw r2,0(fp)
8017b4: 10800883 ldbu r2,34(r2)
8017b8: 108000b0 cmpltui r2,r2,2
8017bc: 1000021e bne r2,zero,8017c8 <altera_avalon_lcd_16207_write+0x220>
lcd_scroll_up(sp);
8017c0: e1000017 ldw r4,0(fp)
8017c4: 08012a40 call 8012a4 <lcd_scroll_up>
if (sp->x < ALT_LCD_VIRTUAL_WIDTH)
8017c8: e0800017 ldw r2,0(fp)
8017cc: 10800843 ldbu r2,33(r2)
8017d0: 10801428 cmpgeui r2,r2,80
8017d4: 10000b1e bne r2,zero,801804 <altera_avalon_lcd_16207_write+0x25c>
sp->line[sp->y].data[sp->x] = c;
8017d8: e1000017 ldw r4,0(fp)
8017dc: e0800017 ldw r2,0(fp)
8017e0: 10c00843 ldbu r3,33(r2)
8017e4: e0800017 ldw r2,0(fp)
8017e8: 10800883 ldbu r2,34(r2)
8017ec: 108018e4 muli r2,r2,99
8017f0: 1105883a add r2,r2,r4
8017f4: 10c5883a add r2,r2,r3
8017f8: 10c01004 addi r3,r2,64
8017fc: e0800803 ldbu r2,32(fp)
801800: 18800005 stb r2,0(r3)
sp->x++;
801804: e0c00017 ldw r3,0(fp)
801808: e0800017 ldw r2,0(fp)
80180c: 10800843 ldbu r2,33(r2)
801810: 10800044 addi r2,r2,1
801814: 18800845 stb r2,33(r3)
801818: e0800117 ldw r2,4(fp)
80181c: 10800044 addi r2,r2,1
801820: e0800115 stw r2,4(fp)
801824: 003f7106 br 8015ec <altera_avalon_lcd_16207_write+0x44>
}
}
/* Recalculate the scrolling parameters */
widthmax = ALT_LCD_WIDTH;
801828: 00800404 movi r2,16
80182c: e0800615 stw r2,24(fp)
for (y = 0 ; y < ALT_LCD_HEIGHT ; y++)
801830: e0000515 stw zero,20(fp)
801834: e0800517 ldw r2,20(fp)
801838: 10800088 cmpgei r2,r2,2
80183c: 1000331e bne r2,zero,80190c <altera_avalon_lcd_16207_write+0x364>
{
int width;
for (width = ALT_LCD_VIRTUAL_WIDTH ; width > 0 ; width--)
801840: 00801404 movi r2,80
801844: e0800915 stw r2,36(fp)
801848: e0800917 ldw r2,36(fp)
80184c: 10800050 cmplti r2,r2,1
801850: 10000f1e bne r2,zero,801890 <altera_avalon_lcd_16207_write+0x2e8>
if (sp->line[y].data[width-1] != ' ')
801854: e0c00017 ldw r3,0(fp)
801858: e0800517 ldw r2,20(fp)
80185c: 108018e4 muli r2,r2,99
801860: 10c7883a add r3,r2,r3
801864: e0800917 ldw r2,36(fp)
801868: 1885883a add r2,r3,r2
80186c: 10800fc4 addi r2,r2,63
801870: 10800007 ldb r2,0(r2)
801874: 10800820 cmpeqi r2,r2,32
801878: 1000011e bne r2,zero,801880 <altera_avalon_lcd_16207_write+0x2d8>
break;
80187c: 00000406 br 801890 <altera_avalon_lcd_16207_write+0x2e8>
801880: e0800917 ldw r2,36(fp)
801884: 10bfffc4 addi r2,r2,-1
801888: e0800915 stw r2,36(fp)
80188c: 003fee06 br 801848 <altera_avalon_lcd_16207_write+0x2a0>
/* The minimum width is the size of the LCD panel. If the real width
* is long enough to require scrolling then add an extra space so the
* end of the message doesn't run into the beginning of it.
*/
if (width <= ALT_LCD_WIDTH)
801890: e0800917 ldw r2,36(fp)
801894: 10800448 cmpgei r2,r2,17
801898: 1000031e bne r2,zero,8018a8 <altera_avalon_lcd_16207_write+0x300>
width = ALT_LCD_WIDTH;
80189c: 00800404 movi r2,16
8018a0: e0800915 stw r2,36(fp)
8018a4: 00000306 br 8018b4 <altera_avalon_lcd_16207_write+0x30c>
else
width++;
8018a8: e0800917 ldw r2,36(fp)
8018ac: 10800044 addi r2,r2,1
8018b0: e0800915 stw r2,36(fp)
sp->line[y].width = width;
8018b4: e0c00017 ldw r3,0(fp)
8018b8: e0800517 ldw r2,20(fp)
8018bc: 108018e4 muli r2,r2,99
8018c0: 10c5883a add r2,r2,r3
8018c4: 10c02404 addi r3,r2,144
8018c8: e0800917 ldw r2,36(fp)
8018cc: 18800045 stb r2,1(r3)
if (widthmax < width)
8018d0: e0c00617 ldw r3,24(fp)
8018d4: e0800917 ldw r2,36(fp)
8018d8: 1880020e bge r3,r2,8018e4 <altera_avalon_lcd_16207_write+0x33c>
widthmax = width;
8018dc: e0800917 ldw r2,36(fp)
8018e0: e0800615 stw r2,24(fp)
sp->line[y].speed = 0; /* By default lines don't scroll */
8018e4: e0c00017 ldw r3,0(fp)
8018e8: e0800517 ldw r2,20(fp)
8018ec: 108018e4 muli r2,r2,99
8018f0: 10c5883a add r2,r2,r3
8018f4: 10802404 addi r2,r2,144
8018f8: 10000085 stb zero,2(r2)
8018fc: e0800517 ldw r2,20(fp)
801900: 10800044 addi r2,r2,1
801904: e0800515 stw r2,20(fp)
801908: 003fca06 br 801834 <altera_avalon_lcd_16207_write+0x28c>
}
if (widthmax <= ALT_LCD_WIDTH)
80190c: e0800617 ldw r2,24(fp)
801910: 10800448 cmpgei r2,r2,17
801914: 1000031e bne r2,zero,801924 <altera_avalon_lcd_16207_write+0x37c>
sp->scrollmax = 0;
801918: e0800017 ldw r2,0(fp)
80191c: 10000985 stb zero,38(r2)
801920: 00002606 br 8019bc <altera_avalon_lcd_16207_write+0x414>
else
{
widthmax *= 2;
801924: e0c00617 ldw r3,24(fp)
801928: 1805883a mov r2,r3
80192c: 10c5883a add r2,r2,r3
801930: e0800615 stw r2,24(fp)
sp->scrollmax = widthmax;
801934: e0c00017 ldw r3,0(fp)
801938: e0800617 ldw r2,24(fp)
80193c: 18800985 stb r2,38(r3)
/* Now calculate how fast each of the other lines should go */
for (y = 0 ; y < ALT_LCD_HEIGHT ; y++)
801940: e0000515 stw zero,20(fp)
801944: e0800517 ldw r2,20(fp)
801948: 10800088 cmpgei r2,r2,2
80194c: 10001b1e bne r2,zero,8019bc <altera_avalon_lcd_16207_write+0x414>
if (sp->line[y].width > ALT_LCD_WIDTH)
801950: e0c00017 ldw r3,0(fp)
801954: e0800517 ldw r2,20(fp)
801958: 108018e4 muli r2,r2,99
80195c: 10c5883a add r2,r2,r3
801960: 10802404 addi r2,r2,144
801964: 10800047 ldb r2,1(r2)
801968: 10800450 cmplti r2,r2,17
80196c: 10000f1e bne r2,zero,8019ac <altera_avalon_lcd_16207_write+0x404>
{
/* You have three options for how to make the display scroll, chosen
* using the preprocessor directives below
*/
#if 1
/* This option makes all the lines scroll round at different speeds
* which are chosen so that all the scrolls finish at the same time.
*/
sp->line[y].speed = 256 * sp->line[y].width / widthmax;
801970: e0c00017 ldw r3,0(fp)
801974: e0800517 ldw r2,20(fp)
801978: 108018e4 muli r2,r2,99
80197c: 10c5883a add r2,r2,r3
801980: 14002404 addi r16,r2,144
801984: e0c00017 ldw r3,0(fp)
801988: e0800517 ldw r2,20(fp)
80198c: 108018e4 muli r2,r2,99
801990: 10c5883a add r2,r2,r3
801994: 10802404 addi r2,r2,144
801998: 10800047 ldb r2,1(r2)
80199c: 11004024 muli r4,r2,256
8019a0: e1400617 ldw r5,24(fp)
8019a4: 0803ac00 call 803ac0 <__divsi3>
8019a8: 80800085 stb r2,2(r16)
8019ac: e0800517 ldw r2,20(fp)
8019b0: 10800044 addi r2,r2,1
8019b4: e0800515 stw r2,20(fp)
8019b8: 003fe206 br 801944 <altera_avalon_lcd_16207_write+0x39c>
#elif 1
/* This option pads the shorter lines with spaces so that they all
* scroll together.
*/
sp->line[y].width = widthmax / 2;
sp->line[y].speed = 256/2;
#else
/* This option makes the shorter lines stop after they have rotated
* and waits for the longer lines to catch up
*/
sp->line[y].speed = 256/2;
#endif
}
}
/* Repaint once, then check whether there has been a missed repaint
* (because active was set when the timer interrupt occurred). If there
* has been a missed repaint then paint again. And again. etc.
*/
for ( ; ; )
{
int old_scrollpos = sp->scrollpos;
8019bc: e0800017 ldw r2,0(fp)
8019c0: 10800947 ldb r2,37(r2)
8019c4: e0800915 stw r2,36(fp)
lcd_repaint_screen(sp);
8019c8: e1000017 ldw r4,0(fp)
8019cc: 08010f40 call 8010f4 <lcd_repaint_screen>
/* Let the timer routines repaint the display again */
sp->active = 0;
8019d0: e0800017 ldw r2,0(fp)
8019d4: 100009c5 stb zero,39(r2)
/* Have the timer routines tried to scroll while we were painting?
* If not then we can exit */
if (sp->scrollpos == old_scrollpos)
8019d8: e0800017 ldw r2,0(fp)
8019dc: 10c00947 ldb r3,37(r2)
8019e0: e0800917 ldw r2,36(fp)
8019e4: 1880011e bne r3,r2,8019ec <altera_avalon_lcd_16207_write+0x444>
break;
8019e8: 00000406 br 8019fc <altera_avalon_lcd_16207_write+0x454>
/* We need to repaint again since the display scrolled while we were
* painting last time */
sp->active = 1;
8019ec: e0c00017 ldw r3,0(fp)
8019f0: 00800044 movi r2,1
8019f4: 188009c5 stb r2,39(r3)
8019f8: 003ff006 br 8019bc <altera_avalon_lcd_16207_write+0x414>
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
8019fc: e0000915 stw zero,36(fp)
}
/* Now that access to the display is complete, release the write
* semaphore so that other threads can access the buffer.
*/
ALT_SEM_POST (sp->write_lock);
return len;
801a00: e0800217 ldw r2,8(fp)
}
801a04: dfc00c17 ldw ra,48(sp)
801a08: df000b17 ldw fp,44(sp)
801a0c: dc000a17 ldw r16,40(sp)
801a10: dec00d04 addi sp,sp,52
801a14: f800283a ret
00801a18 <alt_lcd_16207_timeout>:
/* --------------------------------------------------------------------- */
/* This should be in a top level header file really */
#define container_of(ptr, type, member) ((type *)((char *)ptr - offsetof(type, member)))
/*
* Timeout routine is called every second
*/
static alt_u32 alt_lcd_16207_timeout(void* context)
{
801a18: defffc04 addi sp,sp,-16
801a1c: dfc00315 stw ra,12(sp)
801a20: df000215 stw fp,8(sp)
801a24: d839883a mov fp,sp
801a28: e1000015 stw r4,0(fp)
altera_avalon_lcd_16207_state* sp = (altera_avalon_lcd_16207_state*)context;
801a2c: e0800017 ldw r2,0(fp)
801a30: e0800115 stw r2,4(fp)
/* Update the scrolling position */
if (sp->scrollpos + 1 >= sp->scrollmax)
801a34: e0800117 ldw r2,4(fp)
801a38: 10800947 ldb r2,37(r2)
801a3c: 10c00044 addi r3,r2,1
801a40: e0800117 ldw r2,4(fp)
801a44: 10800987 ldb r2,38(r2)
801a48: 18800316 blt r3,r2,801a58 <alt_lcd_16207_timeout+0x40>
sp->scrollpos = 0;
801a4c: e0800117 ldw r2,4(fp)
801a50: 10000945 stb zero,37(r2)
801a54: 00000506 br 801a6c <alt_lcd_16207_timeout+0x54>
else
sp->scrollpos = sp->scrollpos + 1;
801a58: e0c00117 ldw r3,4(fp)
801a5c: e0800117 ldw r2,4(fp)
801a60: 10800943 ldbu r2,37(r2)
801a64: 10800044 addi r2,r2,1
801a68: 18800945 stb r2,37(r3)
/* Repaint the panel unless the foreground will do it again soon */
if (sp->scrollmax > 0 && !sp->active)
801a6c: e0800117 ldw r2,4(fp)
801a70: 10800987 ldb r2,38(r2)
801a74: 10800050 cmplti r2,r2,1
801a78: 1000061e bne r2,zero,801a94 <alt_lcd_16207_timeout+0x7c>
801a7c: e0800117 ldw r2,4(fp)
801a80: 108009c7 ldb r2,39(r2)
801a84: 1004c03a cmpne r2,r2,zero
801a88: 1000021e bne r2,zero,801a94 <alt_lcd_16207_timeout+0x7c>
lcd_repaint_screen(sp);
801a8c: e1000117 ldw r4,4(fp)
801a90: 08010f40 call 8010f4 <lcd_repaint_screen>
return sp->period;
801a94: e0800117 ldw r2,4(fp)
801a98: 10800717 ldw r2,28(r2)
}
801a9c: dfc00317 ldw ra,12(sp)
801aa0: df000217 ldw fp,8(sp)
801aa4: dec00404 addi sp,sp,16
801aa8: f800283a ret
00801aac <altera_avalon_lcd_16207_init>:
/* --------------------------------------------------------------------- */
/*
* Called at boot time to initialise the LCD driver
*/
void altera_avalon_lcd_16207_init(altera_avalon_lcd_16207_state* sp)
{
801aac: defff904 addi sp,sp,-28
801ab0: dfc00615 stw ra,24(sp)
801ab4: df000515 stw fp,20(sp)
801ab8: dc000415 stw r16,16(sp)
801abc: d839883a mov fp,sp
801ac0: e1000015 stw r4,0(fp)
unsigned int base = sp->base;
801ac4: e0800017 ldw r2,0(fp)
801ac8: 10800017 ldw r2,0(r2)
801acc: e0800115 stw r2,4(fp)
/* Mark the device as functional */
sp->broken = 0;
801ad0: e0800017 ldw r2,0(fp)
801ad4: 10000805 stb zero,32(r2)
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
801ad8: e0000215 stw zero,8(fp)
ALT_SEM_CREATE (&sp->write_lock, 1);
/* TODO: check that usleep can be called in an initialization routine */
/* The initialisation sequence below is copied from the datasheet for
* the 16207 LCD display. The first commands need to be timed because
* the BUSY bit in the status register doesn't work until the display
* has been reset three times.
*/
/* Wait for 15 ms then reset */
usleep(15000);
801adc: 010ea604 movi r4,15000
801ae0: 08027940 call 802794 <usleep>
IOWR_ALTERA_AVALON_LCD_16207_COMMAND(base, LCD_CMD_FUNCTION_SET | LCD_CMD_8BIT);
801ae4: e0c00117 ldw r3,4(fp)
801ae8: 00800c04 movi r2,48
801aec: 18800035 stwio r2,0(r3)
/* Wait for another 4.1ms and reset again */
usleep(4100);
801af0: 01040104 movi r4,4100
801af4: 08027940 call 802794 <usleep>
IOWR_ALTERA_AVALON_LCD_16207_COMMAND(base, LCD_CMD_FUNCTION_SET | LCD_CMD_8BIT);
801af8: e0c00117 ldw r3,4(fp)
801afc: 00800c04 movi r2,48
801b00: 18800035 stwio r2,0(r3)
/* Wait a further 1 ms and reset a third time */
usleep(1000);
801b04: 0100fa04 movi r4,1000
801b08: 08027940 call 802794 <usleep>
IOWR_ALTERA_AVALON_LCD_16207_COMMAND(base, LCD_CMD_FUNCTION_SET | LCD_CMD_8BIT);
801b0c: e0c00117 ldw r3,4(fp)
801b10: 00800c04 movi r2,48
801b14: 18800035 stwio r2,0(r3)
/* Setup interface parameters: 8 bit bus, 2 rows, 5x7 font */
lcd_write_command(sp, LCD_CMD_FUNCTION_SET | LCD_CMD_8BIT | LCD_CMD_TWO_LINE);
801b18: e1000017 ldw r4,0(fp)
801b1c: 01400e04 movi r5,56
801b20: 0800ec80 call 800ec8 <lcd_write_command>
/* Turn display off */
lcd_write_command(sp, LCD_CMD_ONOFF);
801b24: e1000017 ldw r4,0(fp)
801b28: 01400204 movi r5,8
801b2c: 0800ec80 call 800ec8 <lcd_write_command>
/* Clear display */
lcd_clear_screen(sp);
801b30: e1000017 ldw r4,0(fp)
801b34: 08010340 call 801034 <lcd_clear_screen>
/* Set mode: increment after writing, don't shift display */
lcd_write_command(sp, LCD_CMD_MODES | LCD_CMD_MODE_INC);
801b38: e1000017 ldw r4,0(fp)
801b3c: 01400184 movi r5,6
801b40: 0800ec80 call 800ec8 <lcd_write_command>
/* Turn display on */
lcd_write_command(sp, LCD_CMD_ONOFF | LCD_CMD_ENABLE_DISP);
801b44: e1000017 ldw r4,0(fp)
801b48: 01400304 movi r5,12
801b4c: 0800ec80 call 800ec8 <lcd_write_command>
sp->esccount = -1;
801b50: e0c00017 ldw r3,0(fp)
801b54: 00bfffc4 movi r2,-1
801b58: 18800905 stb r2,36(r3)
memset(sp->escape, 0, sizeof(sp->escape));
801b5c: e0800017 ldw r2,0(fp)
801b60: 11000a04 addi r4,r2,40
801b64: 000b883a mov r5,zero
801b68: 01800204 movi r6,8
801b6c: 08035400 call 803540 <memset>
sp->scrollpos = 0;
801b70: e0800017 ldw r2,0(fp)
801b74: 10000945 stb zero,37(r2)
sp->scrollmax = 0;
801b78: e0800017 ldw r2,0(fp)
801b7c: 10000985 stb zero,38(r2)
sp->active = 0;
801b80: e0800017 ldw r2,0(fp)
801b84: 100009c5 stb zero,39(r2)
sp->period = alt_ticks_per_second() / 10; /* Call every 100ms */
801b88: e4000017 ldw r16,0(fp)
*/
static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_ticks_per_second (void)
{
return _alt_tick_rate;
801b8c: d0a00e17 ldw r2,-32712(gp)
801b90: e0800315 stw r2,12(fp)
801b94: e1000317 ldw r4,12(fp)
801b98: 01400284 movi r5,10
801b9c: 0803b5c0 call 803b5c <__udivsi3>
801ba0: 80800715 stw r2,28(r16)
alt_alarm_start(&sp->alarm, sp->period, &alt_lcd_16207_timeout, sp);
801ba4: e0800017 ldw r2,0(fp)
801ba8: 11000104 addi r4,r2,4
801bac: e0800017 ldw r2,0(fp)
801bb0: 11400717 ldw r5,28(r2)
801bb4: 01802034 movhi r6,128
801bb8: 31868604 addi r6,r6,6680
801bbc: e1c00017 ldw r7,0(fp)
801bc0: 0801ce00 call 801ce0 <alt_alarm_start>
}
801bc4: dfc00617 ldw ra,24(sp)
801bc8: df000517 ldw fp,20(sp)
801bcc: dc000417 ldw r16,16(sp)
801bd0: dec00704 addi sp,sp,28
801bd4: f800283a ret
00801bd8 <altera_avalon_lcd_16207_write_fd>:
const char* ptr, int count, int flags);
int
altera_avalon_lcd_16207_write_fd(alt_fd* fd, const char* buffer, int space)
{
801bd8: defffa04 addi sp,sp,-24
801bdc: dfc00515 stw ra,20(sp)
801be0: df000415 stw fp,16(sp)
801be4: d839883a mov fp,sp
801be8: e1000015 stw r4,0(fp)
801bec: e1400115 stw r5,4(fp)
801bf0: e1800215 stw r6,8(fp)
altera_avalon_lcd_16207_dev* dev = (altera_avalon_lcd_16207_dev*) fd->dev;
801bf4: e0800017 ldw r2,0(fp)
801bf8: 10800017 ldw r2,0(r2)
801bfc: e0800315 stw r2,12(fp)
return altera_avalon_lcd_16207_write(&dev->state, buffer, space,
801c00: e0800317 ldw r2,12(fp)
801c04: 11000a04 addi r4,r2,40
801c08: e0800017 ldw r2,0(fp)
801c0c: e1400117 ldw r5,4(fp)
801c10: e1800217 ldw r6,8(fp)
801c14: 11c00217 ldw r7,8(r2)
801c18: 08015a80 call 8015a8 <altera_avalon_lcd_16207_write>
fd->fd_flags);
}
801c1c: dfc00517 ldw ra,20(sp)
801c20: df000417 ldw fp,16(sp)
801c24: dec00604 addi sp,sp,24
801c28: f800283a ret
00801c2c <alt_avalon_timer_sc_irq>:
* alarms, see alt_tick.c for further details.
*/
static void alt_avalon_timer_sc_irq (void* base, alt_u32 id)
{
801c2c: defffc04 addi sp,sp,-16
801c30: dfc00315 stw ra,12(sp)
801c34: df000215 stw fp,8(sp)
801c38: d839883a mov fp,sp
801c3c: e1000015 stw r4,0(fp)
801c40: e1400115 stw r5,4(fp)
/* clear the interrupt */
IOWR_ALTERA_AVALON_TIMER_STATUS (base, 0);
801c44: e0800017 ldw r2,0(fp)
801c48: 10000035 stwio zero,0(r2)
/* ALT_LOG - see altera_hal/HAL/inc/sys/alt_log_printf.h */
ALT_LOG_SYS_CLK_HEARTBEAT();
/* notify the system of a clock tick */
alt_tick ();
801c4c: 08026940 call 802694 <alt_tick>
}
801c50: dfc00317 ldw ra,12(sp)
801c54: df000217 ldw fp,8(sp)
801c58: dec00404 addi sp,sp,16
801c5c: f800283a ret
00801c60 <alt_avalon_timer_sc_init>:
/*
* alt_avalon_timer_sc_init() is called to initialise the timer that will be
* used to provide the periodic system clock. This is called from the
* auto-generated alt_sys_init() function.
*/
void alt_avalon_timer_sc_init (void* base, alt_u32 irq, alt_u32 freq)
{
801c60: defff904 addi sp,sp,-28
801c64: dfc00615 stw ra,24(sp)
801c68: df000515 stw fp,20(sp)
801c6c: d839883a mov fp,sp
801c70: e1000015 stw r4,0(fp)
801c74: e1400115 stw r5,4(fp)
801c78: e1800215 stw r6,8(fp)
* in order to initialise the value of the clock frequency.
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_sysclk_init (alt_u32 nticks)
{
801c7c: e0800217 ldw r2,8(fp)
801c80: e0800315 stw r2,12(fp)
if (! _alt_tick_rate)
801c84: d0a00e17 ldw r2,-32712(gp)
801c88: 1004c03a cmpne r2,r2,zero
801c8c: 1000041e bne r2,zero,801ca0 <alt_avalon_timer_sc_init+0x40>
{
_alt_tick_rate = nticks;
801c90: e0800317 ldw r2,12(fp)
801c94: d0a00e15 stw r2,-32712(gp)
801c98: e0000415 stw zero,16(fp)
801c9c: 00000206 br 801ca8 <alt_avalon_timer_sc_init+0x48>
return 0;
}
else
{
return -1;
801ca0: 00bfffc4 movi r2,-1
801ca4: e0800415 stw r2,16(fp)
/* set the system clock frequency */
alt_sysclk_init (freq);
/* set to free running mode */
IOWR_ALTERA_AVALON_TIMER_CONTROL (base,
801ca8: e0800017 ldw r2,0(fp)
801cac: 10800104 addi r2,r2,4
801cb0: 1007883a mov r3,r2
801cb4: 008001c4 movi r2,7
801cb8: 18800035 stwio r2,0(r3)
ALTERA_AVALON_TIMER_CONTROL_ITO_MSK |
ALTERA_AVALON_TIMER_CONTROL_CONT_MSK |
ALTERA_AVALON_TIMER_CONTROL_START_MSK);
/* register the interrupt handler, and enable the interrupt */
alt_irq_register (irq, base, alt_avalon_timer_sc_irq);
801cbc: e1000117 ldw r4,4(fp)
801cc0: e1400017 ldw r5,0(fp)
801cc4: 01802034 movhi r6,128
801cc8: 31870b04 addi r6,r6,7212
801ccc: 08021980 call 802198 <alt_irq_register>
}
801cd0: dfc00617 ldw ra,24(sp)
801cd4: df000517 ldw fp,20(sp)
801cd8: dec00704 addi sp,sp,28
801cdc: f800283a ret
00801ce0 <alt_alarm_start>:
int alt_alarm_start (alt_alarm* alarm, alt_u32 nticks,
alt_u32 (*callback) (void* context),
void* context)
{
801ce0: defff504 addi sp,sp,-44
801ce4: df000a15 stw fp,40(sp)
801ce8: d839883a mov fp,sp
801cec: e1000015 stw r4,0(fp)
801cf0: e1400115 stw r5,4(fp)
801cf4: e1800215 stw r6,8(fp)
801cf8: e1c00315 stw r7,12(fp)
alt_irq_context irq_context;
alt_u32 current_nticks = 0;
801cfc: e0000515 stw zero,20(fp)
*/
static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_ticks_per_second (void)
{
return _alt_tick_rate;
801d00: d0a00e17 ldw r2,-32712(gp)
801d04: e0800615 stw r2,24(fp)
801d08: e0800617 ldw r2,24(fp)
801d0c: 1005003a cmpeq r2,r2,zero
801d10: 10003f1e bne r2,zero,801e10 <alt_alarm_start+0x130>
if (alt_ticks_per_second ())
{
if (alarm)
801d14: e0800017 ldw r2,0(fp)
801d18: 1005003a cmpeq r2,r2,zero
801d1c: 1000391e bne r2,zero,801e04 <alt_alarm_start+0x124>
{
alarm->callback = callback;
801d20: e0c00017 ldw r3,0(fp)
801d24: e0800217 ldw r2,8(fp)
801d28: 18800315 stw r2,12(r3)
alarm->context = context;
801d2c: e0c00017 ldw r3,0(fp)
801d30: e0800317 ldw r2,12(fp)
801d34: 18800515 stw r2,20(r3)
alt_irq_disable_all (void)
{
alt_irq_context context;
NIOS2_READ_STATUS (context);
801d38: 0005303a rdctl r2,status
801d3c: e0800815 stw r2,32(fp)
NIOS2_WRITE_STATUS (0);
801d40: 0001703a wrctl status,zero
801d44: e0800817 ldw r2,32(fp)
801d48: e0800715 stw r2,28(fp)
801d4c: e0800717 ldw r2,28(fp)
801d50: e0800415 stw r2,16(fp)
*/
static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_nticks (void)
{
return _alt_nticks;
801d54: d0a00f17 ldw r2,-32708(gp)
801d58: e0800815 stw r2,32(fp)
801d5c: e0800817 ldw r2,32(fp)
801d60: e0800515 stw r2,20(fp)
irq_context = alt_irq_disable_all ();
current_nticks = alt_nticks();
alarm->time = nticks + current_nticks + 1;
801d64: e1000017 ldw r4,0(fp)
801d68: e0c00117 ldw r3,4(fp)
801d6c: e0800517 ldw r2,20(fp)
801d70: 1885883a add r2,r3,r2
801d74: 10800044 addi r2,r2,1
801d78: 20800215 stw r2,8(r4)
/*
* If the desired alarm time causes a roll-over, set the rollover
* flag. This will prevent the subsequent tick event from causing
* an alarm too early.
*/
if(alarm->time < current_nticks)
801d7c: e0800017 ldw r2,0(fp)
801d80: 10c00217 ldw r3,8(r2)
801d84: e0800517 ldw r2,20(fp)
801d88: 1880042e bgeu r3,r2,801d9c <alt_alarm_start+0xbc>
{
alarm->rollover = 1;
801d8c: e0c00017 ldw r3,0(fp)
801d90: 00800044 movi r2,1
801d94: 18800405 stb r2,16(r3)
801d98: 00000206 br 801da4 <alt_alarm_start+0xc4>
}
else
{
alarm->rollover = 0;
801d9c: e0800017 ldw r2,0(fp)
801da0: 10000405 stb zero,16(r2)
*/
static ALT_INLINE void ALT_ALWAYS_INLINE alt_llist_insert(alt_llist* list,
alt_llist* entry)
{
801da4: d0a01004 addi r2,gp,-32704
801da8: e0800815 stw r2,32(fp)
801dac: e0800017 ldw r2,0(fp)
801db0: e0800715 stw r2,28(fp)
entry->previous = list;
801db4: e0c00717 ldw r3,28(fp)
801db8: e0800817 ldw r2,32(fp)
801dbc: 18800115 stw r2,4(r3)
entry->next = list->next;
801dc0: e0c00717 ldw r3,28(fp)
801dc4: e0800817 ldw r2,32(fp)
801dc8: 10800017 ldw r2,0(r2)
801dcc: 18800015 stw r2,0(r3)
list->next->previous = entry;
801dd0: e0800817 ldw r2,32(fp)
801dd4: 10c00017 ldw r3,0(r2)
801dd8: e0800717 ldw r2,28(fp)
801ddc: 18800115 stw r2,4(r3)
list->next = entry;
801de0: e0c00817 ldw r3,32(fp)
801de4: e0800717 ldw r2,28(fp)
801de8: 18800015 stw r2,0(r3)
*/
static ALT_INLINE void ALT_ALWAYS_INLINE
alt_irq_enable_all (alt_irq_context context)
{
801dec: e0800417 ldw r2,16(fp)
801df0: e0800815 stw r2,32(fp)
NIOS2_WRITE_STATUS (context);
801df4: e0800817 ldw r2,32(fp)
801df8: 1001703a wrctl status,r2
}
alt_llist_insert (&alt_alarm_list, &alarm->llist);
alt_irq_enable_all (irq_context);
return 0;
801dfc: e0000915 stw zero,36(fp)
801e00: 00000506 br 801e18 <alt_alarm_start+0x138>
}
else
{
return -EINVAL;
801e04: 00bffa84 movi r2,-22
801e08: e0800915 stw r2,36(fp)
801e0c: 00000206 br 801e18 <alt_alarm_start+0x138>
}
}
else
{
return -ENOTSUP;
801e10: 00bfde84 movi r2,-134
801e14: e0800915 stw r2,36(fp)
}
}
801e18: e0800917 ldw r2,36(fp)
801e1c: df000a17 ldw fp,40(sp)
801e20: dec00b04 addi sp,sp,44
801e24: f800283a ret
00801e28 <alt_dcache_flush_all>:
* alt_dcache_flush_all() is called to flush the entire data cache.
*/
void alt_dcache_flush_all (void)
{
801e28: defffe04 addi sp,sp,-8
801e2c: df000115 stw fp,4(sp)
801e30: d839883a mov fp,sp
#if NIOS2_DCACHE_SIZE > 0
char* i;
for (i = (char*) 0; i < (char*) NIOS2_DCACHE_SIZE; i+= NIOS2_DCACHE_LINE_SIZE)
801e34: e0000015 stw zero,0(fp)
801e38: e0800017 ldw r2,0(fp)
801e3c: 10820028 cmpgeui r2,r2,2048
801e40: 1000061e bne r2,zero,801e5c <alt_dcache_flush_all+0x34>
{
__asm__ volatile ("flushd (%0)" :: "r" (i));
801e44: e0800017 ldw r2,0(fp)
801e48: 1000003b flushd 0(r2)
801e4c: e0800017 ldw r2,0(fp)
801e50: 10800804 addi r2,r2,32
801e54: e0800015 stw r2,0(fp)
801e58: 003ff706 br 801e38 <alt_dcache_flush_all+0x10>
}
#endif /* NIOS2_DCACHE_SIZE > 0 */
}
801e5c: df000117 ldw fp,4(sp)
801e60: dec00204 addi sp,sp,8
801e64: f800283a ret
00801e68 <alt_dev_null_write>:
* indicates that the data has been successfully transmitted.
*/
static int alt_dev_null_write (alt_fd* fd, const char* ptr, int len)
{
801e68: defffc04 addi sp,sp,-16
801e6c: df000315 stw fp,12(sp)
801e70: d839883a mov fp,sp
801e74: e1000015 stw r4,0(fp)
801e78: e1400115 stw r5,4(fp)
801e7c: e1800215 stw r6,8(fp)
return len;
801e80: e0800217 ldw r2,8(fp)
}
801e84: df000317 ldw fp,12(sp)
801e88: dec00404 addi sp,sp,16
801e8c: f800283a ret
00801e90 <alt_dev_llist_insert>:
*
*/
int alt_dev_llist_insert (alt_dev_llist* dev, alt_llist* list)
{
801e90: defff904 addi sp,sp,-28
801e94: dfc00615 stw ra,24(sp)
801e98: df000515 stw fp,20(sp)
801e9c: d839883a mov fp,sp
801ea0: e1000015 stw r4,0(fp)
801ea4: e1400115 stw r5,4(fp)
/*
* check that the device exists, and that it has a valid name.
*/
if (!dev || !dev->name)
801ea8: e0800017 ldw r2,0(fp)
801eac: 1005003a cmpeq r2,r2,zero
801eb0: 1000041e bne r2,zero,801ec4 <alt_dev_llist_insert+0x34>
801eb4: e0800017 ldw r2,0(fp)
801eb8: 10800217 ldw r2,8(r2)
801ebc: 1004c03a cmpne r2,r2,zero
801ec0: 1000071e bne r2,zero,801ee0 <alt_dev_llist_insert+0x50>
{
ALT_ERRNO = EINVAL;
801ec4: 0801f400 call 801f40 <alt_get_errno>
801ec8: 1007883a mov r3,r2
801ecc: 00800584 movi r2,22
801ed0: 18800015 stw r2,0(r3)
return -EINVAL;
801ed4: 00bffa84 movi r2,-22
801ed8: e0800415 stw r2,16(fp)
801edc: 00001306 br 801f2c <alt_dev_llist_insert+0x9c>
*/
static ALT_INLINE void ALT_ALWAYS_INLINE alt_llist_insert(alt_llist* list,
alt_llist* entry)
{
801ee0: e0800117 ldw r2,4(fp)
801ee4: e0800215 stw r2,8(fp)
801ee8: e0800017 ldw r2,0(fp)
801eec: e0800315 stw r2,12(fp)
entry->previous = list;
801ef0: e0c00317 ldw r3,12(fp)
801ef4: e0800217 ldw r2,8(fp)
801ef8: 18800115 stw r2,4(r3)
entry->next = list->next;
801efc: e0c00317 ldw r3,12(fp)
801f00: e0800217 ldw r2,8(fp)
801f04: 10800017 ldw r2,0(r2)
801f08: 18800015 stw r2,0(r3)
list->next->previous = entry;
801f0c: e0800217 ldw r2,8(fp)
801f10: 10c00017 ldw r3,0(r2)
801f14: e0800317 ldw r2,12(fp)
801f18: 18800115 stw r2,4(r3)
list->next = entry;
801f1c: e0c00217 ldw r3,8(fp)
801f20: e0800317 ldw r2,12(fp)
801f24: 18800015 stw r2,0(r3)
}
/*
* register the device.
*/
alt_llist_insert(list, &dev->llist);
return 0;
801f28: e0000415 stw zero,16(fp)
}
801f2c: e0800417 ldw r2,16(fp)
801f30: dfc00617 ldw ra,24(sp)
801f34: df000517 ldw fp,20(sp)
801f38: dec00704 addi sp,sp,28
801f3c: f800283a ret
00801f40 <alt_get_errno>:
extern int errno;
static ALT_INLINE int* alt_get_errno(void)
{
801f40: defffd04 addi sp,sp,-12
801f44: dfc00215 stw ra,8(sp)
801f48: df000115 stw fp,4(sp)
801f4c: d839883a mov fp,sp
return ((alt_errno) ? alt_errno() : &errno);
801f50: d0a00b17 ldw r2,-32724(gp)
801f54: 1005003a cmpeq r2,r2,zero
801f58: 1000041e bne r2,zero,801f6c <alt_get_errno+0x2c>
801f5c: d0a00b17 ldw r2,-32724(gp)
801f60: 103ee83a callr r2
801f64: e0800015 stw r2,0(fp)
801f68: 00000206 br 801f74 <alt_get_errno+0x34>
801f6c: d0a01b04 addi r2,gp,-32660
801f70: e0800015 stw r2,0(fp)
801f74: e0800017 ldw r2,0(fp)
}
801f78: dfc00217 ldw ra,8(sp)
801f7c: df000117 ldw fp,4(sp)
801f80: dec00304 addi sp,sp,12
801f84: f800283a ret
00801f88 <_do_ctors>:
* Run the C++ static constructors.
*/
void _do_ctors(void)
{
801f88: defffd04 addi sp,sp,-12
801f8c: dfc00215 stw ra,8(sp)
801f90: df000115 stw fp,4(sp)
801f94: d839883a mov fp,sp
constructor* ctor;
for (ctor = &__CTOR_END__[-1]; ctor >= __CTOR_LIST__; ctor--)
801f98: 00802034 movhi r2,128
801f9c: 108f2d04 addi r2,r2,15540
801fa0: e0800015 stw r2,0(fp)
801fa4: e0c00017 ldw r3,0(fp)
801fa8: 00802034 movhi r2,128
801fac: 108f2e04 addi r2,r2,15544
801fb0: 18800736 bltu r3,r2,801fd0 <_do_ctors+0x48>
(*ctor) ();
801fb4: e0800017 ldw r2,0(fp)
801fb8: 10800017 ldw r2,0(r2)
801fbc: 103ee83a callr r2
801fc0: e0800017 ldw r2,0(fp)
801fc4: 10bfff04 addi r2,r2,-4
801fc8: e0800015 stw r2,0(fp)
801fcc: 003ff506 br 801fa4 <_do_ctors+0x1c>
}
801fd0: dfc00217 ldw ra,8(sp)
801fd4: df000117 ldw fp,4(sp)
801fd8: dec00304 addi sp,sp,12
801fdc: f800283a ret
00801fe0 <_do_dtors>:
* Run the C++ static destructors.
*/
void _do_dtors(void)
{
801fe0: defffd04 addi sp,sp,-12
801fe4: dfc00215 stw ra,8(sp)
801fe8: df000115 stw fp,4(sp)
801fec: d839883a mov fp,sp
destructor* dtor;
for (dtor = &__DTOR_END__[-1]; dtor >= __DTOR_LIST__; dtor--)
801ff0: 00802034 movhi r2,128
801ff4: 108f2d04 addi r2,r2,15540
801ff8: e0800015 stw r2,0(fp)
801ffc: e0c00017 ldw r3,0(fp)
802000: 00802034 movhi r2,128
802004: 108f2e04 addi r2,r2,15544
802008: 18800736 bltu r3,r2,802028 <_do_dtors+0x48>
(*dtor) ();
80200c: e0800017 ldw r2,0(fp)
802010: 10800017 ldw r2,0(r2)
802014: 103ee83a callr r2
802018: e0800017 ldw r2,0(fp)
80201c: 10bfff04 addi r2,r2,-4
802020: e0800015 stw r2,0(fp)
802024: 003ff506 br 801ffc <_do_dtors+0x1c>
}
802028: dfc00217 ldw ra,8(sp)
80202c: df000117 ldw fp,4(sp)
802030: dec00304 addi sp,sp,12
802034: f800283a ret
00802038 <alt_icache_flush_all>:
* alt_icache_flush_all() is called to flush the entire instruction cache.
*/
void alt_icache_flush_all (void)
{
802038: defffe04 addi sp,sp,-8
80203c: dfc00115 stw ra,4(sp)
802040: df000015 stw fp,0(sp)
802044: d839883a mov fp,sp
#if NIOS2_ICACHE_SIZE > 0
alt_icache_flush (0, NIOS2_ICACHE_SIZE);
802048: 0009883a mov r4,zero
80204c: 01440004 movi r5,4096
802050: 0802b280 call 802b28 <alt_icache_flush>
#endif
}
802054: dfc00117 ldw ra,4(sp)
802058: df000017 ldw fp,0(sp)
80205c: dec00204 addi sp,sp,8
802060: f800283a ret
00802064 <alt_open_fd>:
* remains unchanged.
*/
static void alt_open_fd(alt_fd* fd, const char* name, int flags, int mode)
{
802064: defff904 addi sp,sp,-28
802068: dfc00615 stw ra,24(sp)
80206c: df000515 stw fp,20(sp)
802070: d839883a mov fp,sp
802074: e1000015 stw r4,0(fp)
802078: e1400115 stw r5,4(fp)
80207c: e1800215 stw r6,8(fp)
802080: e1c00315 stw r7,12(fp)
int old;
old = open (name, flags, mode);
802084: e1000117 ldw r4,4(fp)
802088: e1400217 ldw r5,8(fp)
80208c: e1800317 ldw r6,12(fp)
802090: 08023e00 call 8023e0 <open>
802094: e0800415 stw r2,16(fp)
if (old >= 0)
802098: e0800417 ldw r2,16(fp)
80209c: 1004803a cmplt r2,r2,zero
8020a0: 10001c1e bne r2,zero,802114 <alt_open_fd+0xb0>
{
fd->dev = alt_fd_list[old].dev;
8020a4: e1000017 ldw r4,0(fp)
8020a8: 00c02034 movhi r3,128
8020ac: 18d40704 addi r3,r3,20508
8020b0: e0800417 ldw r2,16(fp)
8020b4: 10800324 muli r2,r2,12
8020b8: 10c5883a add r2,r2,r3
8020bc: 10800017 ldw r2,0(r2)
8020c0: 20800015 stw r2,0(r4)
fd->priv = alt_fd_list[old].priv;
8020c4: e1000017 ldw r4,0(fp)
8020c8: 00c02034 movhi r3,128
8020cc: 18d40704 addi r3,r3,20508
8020d0: e0800417 ldw r2,16(fp)
8020d4: 10800324 muli r2,r2,12
8020d8: 10c5883a add r2,r2,r3
8020dc: 10800104 addi r2,r2,4
8020e0: 10800017 ldw r2,0(r2)
8020e4: 20800115 stw r2,4(r4)
fd->fd_flags = alt_fd_list[old].fd_flags;
8020e8: e1000017 ldw r4,0(fp)
8020ec: 00c02034 movhi r3,128
8020f0: 18d40704 addi r3,r3,20508
8020f4: e0800417 ldw r2,16(fp)
8020f8: 10800324 muli r2,r2,12
8020fc: 10c5883a add r2,r2,r3
802100: 10800204 addi r2,r2,8
802104: 10800017 ldw r2,0(r2)
802108: 20800215 stw r2,8(r4)
alt_release_fd (old);
80210c: e1000417 ldw r4,16(fp)
802110: 08025a80 call 8025a8 <alt_release_fd>
}
}
802114: dfc00617 ldw ra,24(sp)
802118: df000517 ldw fp,20(sp)
80211c: dec00704 addi sp,sp,28
802120: f800283a ret
00802124 <alt_io_redirect>:
/*
* alt_io_redirect() is called once the device/filesystem lists have been
* initialised, but before main(). Its function is to redirect standard in,
* standard out and standard error so that they point to the devices selected by
* the user (as defined in system.h).
*
* Prior to the call to this function, io is directed towards /dev/null. If
* i/o can not be redirected to the requested device, for example if the device
* does not exist, then it remains directed at /dev/null.
*/
void alt_io_redirect(const char* stdout_dev,
const char* stdin_dev,
const char* stderr_dev)
{
802124: defffb04 addi sp,sp,-20
802128: dfc00415 stw ra,16(sp)
80212c: df000315 stw fp,12(sp)
802130: d839883a mov fp,sp
802134: e1000015 stw r4,0(fp)
802138: e1400115 stw r5,4(fp)
80213c: e1800215 stw r6,8(fp)
/* Redirect the channels */
alt_open_fd (&alt_fd_list[STDOUT_FILENO], stdout_dev, O_WRONLY, 0777);
802140: 01002034 movhi r4,128
802144: 21140a04 addi r4,r4,20520
802148: e1400017 ldw r5,0(fp)
80214c: 01800044 movi r6,1
802150: 01c07fc4 movi r7,511
802154: 08020640 call 802064 <alt_open_fd>
alt_open_fd (&alt_fd_list[STDIN_FILENO], stdin_dev, O_RDONLY, 0777);
802158: 01002034 movhi r4,128
80215c: 21140704 addi r4,r4,20508
802160: e1400117 ldw r5,4(fp)
802164: 000d883a mov r6,zero
802168: 01c07fc4 movi r7,511
80216c: 08020640 call 802064 <alt_open_fd>
alt_open_fd (&alt_fd_list[STDERR_FILENO], stderr_dev, O_WRONLY, 0777);
802170: 01002034 movhi r4,128
802174: 21140d04 addi r4,r4,20532
802178: e1400217 ldw r5,8(fp)
80217c: 01800044 movi r6,1
802180: 01c07fc4 movi r7,511
802184: 08020640 call 802064 <alt_open_fd>
}
802188: dfc00417 ldw ra,16(sp)
80218c: df000317 ldw fp,12(sp)
802190: dec00504 addi sp,sp,20
802194: f800283a ret
00802198 <alt_irq_register>:
int alt_irq_register (alt_u32 id,
void* context,
void (*handler)(void*, alt_u32))
{
802198: defff304 addi sp,sp,-52
80219c: df000c15 stw fp,48(sp)
8021a0: d839883a mov fp,sp
8021a4: e1000015 stw r4,0(fp)
8021a8: e1400115 stw r5,4(fp)
8021ac: e1800215 stw r6,8(fp)
int rc = -EINVAL;
8021b0: 00bffa84 movi r2,-22
8021b4: e0800315 stw r2,12(fp)
alt_irq_context status;
if (id < ALT_NIRQ)
8021b8: e0800017 ldw r2,0(fp)
8021bc: 10800828 cmpgeui r2,r2,32
8021c0: 1000511e bne r2,zero,802308 <alt_irq_register+0x170>
alt_irq_disable_all (void)
{
alt_irq_context context;
NIOS2_READ_STATUS (context);
8021c4: 0005303a rdctl r2,status
8021c8: e0800615 stw r2,24(fp)
NIOS2_WRITE_STATUS (0);
8021cc: 0001703a wrctl status,zero
8021d0: e0800617 ldw r2,24(fp)
8021d4: e0800515 stw r2,20(fp)
8021d8: e0800517 ldw r2,20(fp)
8021dc: e0800415 stw r2,16(fp)
{
/*
* interrupts are disabled while the handler tables are updated to ensure
* that an interrupt doesn't occur while the tables are in an inconsistant
* state.
*/
status = alt_irq_disable_all ();
alt_irq[id].handler = handler;
8021e0: 00c02034 movhi r3,128
8021e4: 18d66e04 addi r3,r3,22968
8021e8: e0800017 ldw r2,0(fp)
8021ec: 10800224 muli r2,r2,8
8021f0: 10c7883a add r3,r2,r3
8021f4: e0800217 ldw r2,8(fp)
8021f8: 18800015 stw r2,0(r3)
alt_irq[id].context = context;
8021fc: 00c02034 movhi r3,128
802200: 18d66e04 addi r3,r3,22968
802204: e0800017 ldw r2,0(fp)
802208: 10800224 muli r2,r2,8
80220c: 10c5883a add r2,r2,r3
802210: 10c00104 addi r3,r2,4
802214: e0800117 ldw r2,4(fp)
802218: 18800015 stw r2,0(r3)
rc = (handler) ? alt_irq_enable (id): alt_irq_disable (id);
80221c: e0800217 ldw r2,8(fp)
802220: 1005003a cmpeq r2,r2,zero
802224: 1000191e bne r2,zero,80228c <alt_irq_register+0xf4>
*
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_irq_enable (alt_u32 id)
{
802228: e0800017 ldw r2,0(fp)
80222c: e0800615 stw r2,24(fp)
802230: 0005303a rdctl r2,status
802234: e0800915 stw r2,36(fp)
802238: 0001703a wrctl status,zero
80223c: e0800917 ldw r2,36(fp)
802240: e0800815 stw r2,32(fp)
802244: e0800817 ldw r2,32(fp)
802248: e0800715 stw r2,28(fp)
alt_irq_context status;
extern volatile alt_u32 alt_irq_active;
status = alt_irq_disable_all ();
alt_irq_active |= (1 << id);
80224c: 00c00044 movi r3,1
802250: e0800617 ldw r2,24(fp)
802254: 1886983a sll r3,r3,r2
802258: d0a00c17 ldw r2,-32720(gp)
80225c: 10c4b03a or r2,r2,r3
802260: d0a00c15 stw r2,-32720(gp)
NIOS2_WRITE_IENABLE (alt_irq_active);
802264: d0a00c17 ldw r2,-32720(gp)
802268: 100170fa wrctl ienable,r2
80226c: e0800717 ldw r2,28(fp)
802270: e0800915 stw r2,36(fp)
802274: e0800917 ldw r2,36(fp)
802278: 1001703a wrctl status,r2
alt_irq_enable_all(status);
80227c: e0000515 stw zero,20(fp)
802280: e0800517 ldw r2,20(fp)
802284: e0800b15 stw r2,44(fp)
802288: 00001906 br 8022f0 <alt_irq_register+0x158>
80228c: e0800017 ldw r2,0(fp)
802290: e0800915 stw r2,36(fp)
802294: 0005303a rdctl r2,status
802298: e0800a15 stw r2,40(fp)
80229c: 0001703a wrctl status,zero
8022a0: e0800a17 ldw r2,40(fp)
8022a4: e0800615 stw r2,24(fp)
8022a8: e0800617 ldw r2,24(fp)
8022ac: e0800715 stw r2,28(fp)
8022b0: 00c00044 movi r3,1
8022b4: e0800917 ldw r2,36(fp)
8022b8: 1884983a sll r2,r3,r2
8022bc: 0086303a nor r3,zero,r2
8022c0: d0a00c17 ldw r2,-32720(gp)
8022c4: 10c4703a and r2,r2,r3
8022c8: d0a00c15 stw r2,-32720(gp)
8022cc: d0a00c17 ldw r2,-32720(gp)
8022d0: 100170fa wrctl ienable,r2
8022d4: e0800717 ldw r2,28(fp)
8022d8: e0800a15 stw r2,40(fp)
8022dc: e0800a17 ldw r2,40(fp)
8022e0: 1001703a wrctl status,r2
8022e4: e0000815 stw zero,32(fp)
8022e8: e0800817 ldw r2,32(fp)
8022ec: e0800b15 stw r2,44(fp)
8022f0: e0800b17 ldw r2,44(fp)
8022f4: e0800315 stw r2,12(fp)
8022f8: e0800417 ldw r2,16(fp)
8022fc: e0800a15 stw r2,40(fp)
802300: e0800a17 ldw r2,40(fp)
802304: 1001703a wrctl status,r2
alt_irq_enable_all(status);
}
return rc;
802308: e0800317 ldw r2,12(fp)
}
80230c: df000c17 ldw fp,48(sp)
802310: dec00d04 addi sp,sp,52
802314: f800283a ret
00802318 <alt_file_locked>:
* themselves, and report the error from the filesystems open() function.
*/
static int alt_file_locked (alt_fd* fd)
{
802318: defffc04 addi sp,sp,-16
80231c: df000315 stw fp,12(sp)
802320: d839883a mov fp,sp
802324: e1000015 stw r4,0(fp)
alt_u32 i;
/*
* Mark the file descriptor as belonging to a device.
*/
fd->fd_flags |= ALT_FD_DEV;
802328: e0c00017 ldw r3,0(fp)
80232c: e0800017 ldw r2,0(fp)
802330: 10800217 ldw r2,8(r2)
802334: 10900034 orhi r2,r2,16384
802338: 18800215 stw r2,8(r3)
/*
* Loop through all current file descriptors searching for one that's locked
* for exclusive access. If a match is found, generate an error.
*/
for (i = 0; i <= alt_max_fd; i++)
80233c: e0000115 stw zero,4(fp)
802340: d0e00a17 ldw r3,-32728(gp)
802344: e0800117 ldw r2,4(fp)
802348: 18802036 bltu r3,r2,8023cc <alt_file_locked+0xb4>
{
if ((alt_fd_list[i].dev == fd->dev) &&
80234c: 00c02034 movhi r3,128
802350: 18d40704 addi r3,r3,20508
802354: e0800117 ldw r2,4(fp)
802358: 10800324 muli r2,r2,12
80235c: 10c5883a add r2,r2,r3
802360: e0c00017 ldw r3,0(fp)
802364: 11000017 ldw r4,0(r2)
802368: 18800017 ldw r2,0(r3)
80236c: 2080131e bne r4,r2,8023bc <alt_file_locked+0xa4>
802370: 00c02034 movhi r3,128
802374: 18d40704 addi r3,r3,20508
802378: e0800117 ldw r2,4(fp)
80237c: 10800324 muli r2,r2,12
802380: 10c5883a add r2,r2,r3
802384: 10800204 addi r2,r2,8
802388: 10800017 ldw r2,0(r2)
80238c: 1004403a cmpge r2,r2,zero
802390: 10000a1e bne r2,zero,8023bc <alt_file_locked+0xa4>
802394: e0800117 ldw r2,4(fp)
802398: 10c00324 muli r3,r2,12
80239c: 00802034 movhi r2,128
8023a0: 10940704 addi r2,r2,20508
8023a4: 1887883a add r3,r3,r2
8023a8: e0800017 ldw r2,0(fp)
8023ac: 18800326 beq r3,r2,8023bc <alt_file_locked+0xa4>
(alt_fd_list[i].fd_flags & ALT_FD_EXCL) &&
(&alt_fd_list[i] != fd))
{
return -EACCES;
8023b0: 00bffcc4 movi r2,-13
8023b4: e0800215 stw r2,8(fp)
8023b8: 00000506 br 8023d0 <alt_file_locked+0xb8>
8023bc: e0800117 ldw r2,4(fp)
8023c0: 10800044 addi r2,r2,1
8023c4: e0800115 stw r2,4(fp)
8023c8: 003fdd06 br 802340 <alt_file_locked+0x28>
}
}
/* The device is not locked */
return 0;
8023cc: e0000215 stw zero,8(fp)
}
8023d0: e0800217 ldw r2,8(fp)
8023d4: df000317 ldw fp,12(sp)
8023d8: dec00404 addi sp,sp,16
8023dc: f800283a ret
008023e0 <open>:
/*
* open() is called in order to get a file descriptor that reference the file
* or device named "name". This descriptor can then be used to manipulate the
* file/device using the standard system calls, e.g. write(), read(), ioctl()
* etc.
*
* This is equivalent to the standard open() system call.
*
* ALT_OPEN is mapped onto the open() system call in alt_syscall.h
*/
int ALT_OPEN (const char* file, int flags, int mode)
{
8023e0: defff404 addi sp,sp,-48
8023e4: dfc00b15 stw ra,44(sp)
8023e8: df000a15 stw fp,40(sp)
8023ec: d839883a mov fp,sp
8023f0: e1000015 stw r4,0(fp)
8023f4: e1400115 stw r5,4(fp)
8023f8: e1800215 stw r6,8(fp)
alt_dev* dev;
alt_fd* fd;
int index = -1;
8023fc: 00bfffc4 movi r2,-1
802400: e0800515 stw r2,20(fp)
int status = -ENODEV;
802404: 00bffb44 movi r2,-19
802408: e0800615 stw r2,24(fp)
int isafs = 0;
80240c: e0000715 stw zero,28(fp)
/*
* Check the device list, to see if a device with a matching name is
* registered.
*/
if (!(dev = alt_find_dev (file, &alt_dev_list)))
802410: e1000017 ldw r4,0(fp)
802414: d1600804 addi r5,gp,-32736
802418: 08029080 call 802908 <alt_find_dev>
80241c: e0800315 stw r2,12(fp)
802420: e0800317 ldw r2,12(fp)
802424: 1004c03a cmpne r2,r2,zero
802428: 1000051e bne r2,zero,802440 <open+0x60>
{
/* No matching device, so try the filesystem list */
dev = alt_find_file (file);
80242c: e1000017 ldw r4,0(fp)
802430: 08029980 call 802998 <alt_find_file>
802434: e0800315 stw r2,12(fp)
isafs = 1;
802438: 00800044 movi r2,1
80243c: e0800715 stw r2,28(fp)
}
/*
* If a matching device or filesystem is found, allocate a file descriptor.
*/
if (dev)
802440: e0800317 ldw r2,12(fp)
802444: 1005003a cmpeq r2,r2,zero
802448: 1000301e bne r2,zero,80250c <open+0x12c>
{
if ((index = alt_get_fd (dev)) < 0)
80244c: e1000317 ldw r4,12(fp)
802450: 0802a7c0 call 802a7c <alt_get_fd>
802454: e0800515 stw r2,20(fp)
802458: e0800517 ldw r2,20(fp)
80245c: 1004403a cmpge r2,r2,zero
802460: 1000031e bne r2,zero,802470 <open+0x90>
{
status = index;
802464: e0800517 ldw r2,20(fp)
802468: e0800615 stw r2,24(fp)
80246c: 00002906 br 802514 <open+0x134>
}
else
{
fd = &alt_fd_list[index];
802470: e0800517 ldw r2,20(fp)
802474: 10c00324 muli r3,r2,12
802478: 00802034 movhi r2,128
80247c: 10940704 addi r2,r2,20508
802480: 1885883a add r2,r3,r2
802484: e0800415 stw r2,16(fp)
fd->fd_flags = (flags & ~ALT_FD_FLAGS_MASK);
802488: e1000417 ldw r4,16(fp)
80248c: e0c00117 ldw r3,4(fp)
802490: 00900034 movhi r2,16384
802494: 10bfffc4 addi r2,r2,-1
802498: 1884703a and r2,r3,r2
80249c: 20800215 stw r2,8(r4)
/* If this is a device, ensure it isn't already locked */
if (isafs || ((status = alt_file_locked (fd)) >= 0))
8024a0: e0800717 ldw r2,28(fp)
8024a4: 1004c03a cmpne r2,r2,zero
8024a8: 1000071e bne r2,zero,8024c8 <open+0xe8>
8024ac: e1000417 ldw r4,16(fp)
8024b0: 08023180 call 802318 <alt_file_locked>
8024b4: e0800615 stw r2,24(fp)
8024b8: e0800617 ldw r2,24(fp)
8024bc: 1004403a cmpge r2,r2,zero
8024c0: 1000011e bne r2,zero,8024c8 <open+0xe8>
8024c4: 00001306 br 802514 <open+0x134>
{
/*
* If the device or filesystem provides an open() callback function,
* call it now to perform any device/filesystem specific operations.
*/
status = (dev->open) ? dev->open(fd, file, flags, mode): 0;
8024c8: e0800317 ldw r2,12(fp)
8024cc: 10800317 ldw r2,12(r2)
8024d0: 1005003a cmpeq r2,r2,zero
8024d4: 1000091e bne r2,zero,8024fc <open+0x11c>
8024d8: e0800317 ldw r2,12(fp)
8024dc: 10800317 ldw r2,12(r2)
8024e0: e1000417 ldw r4,16(fp)
8024e4: e1400017 ldw r5,0(fp)
8024e8: e1800117 ldw r6,4(fp)
8024ec: e1c00217 ldw r7,8(fp)
8024f0: 103ee83a callr r2
8024f4: e0800915 stw r2,36(fp)
8024f8: 00000106 br 802500 <open+0x120>
8024fc: e0000915 stw zero,36(fp)
802500: e0800917 ldw r2,36(fp)
802504: e0800615 stw r2,24(fp)
802508: 00000206 br 802514 <open+0x134>
}
}
}
else
{
status = -ENODEV;
80250c: 00bffb44 movi r2,-19
802510: e0800615 stw r2,24(fp)
}
/* Allocation failed, so clean up and return an error */
if (status < 0)
802514: e0800617 ldw r2,24(fp)
802518: 1004403a cmpge r2,r2,zero
80251c: 1000091e bne r2,zero,802544 <open+0x164>
{
alt_release_fd (index);
802520: e1000517 ldw r4,20(fp)
802524: 08025a80 call 8025a8 <alt_release_fd>
ALT_ERRNO = -status;
802528: 08025600 call 802560 <alt_get_errno>
80252c: e0c00617 ldw r3,24(fp)
802530: 00c7c83a sub r3,zero,r3
802534: 10c00015 stw r3,0(r2)
return -1;
802538: 00bfffc4 movi r2,-1
80253c: e0800815 stw r2,32(fp)
802540: 00000206 br 80254c <open+0x16c>
}
/* return the reference upon success */
return index;
802544: e0800517 ldw r2,20(fp)
802548: e0800815 stw r2,32(fp)
}
80254c: e0800817 ldw r2,32(fp)
802550: dfc00b17 ldw ra,44(sp)
802554: df000a17 ldw fp,40(sp)
802558: dec00c04 addi sp,sp,48
80255c: f800283a ret
00802560 <alt_get_errno>:
extern int errno;
static ALT_INLINE int* alt_get_errno(void)
{
802560: defffd04 addi sp,sp,-12
802564: dfc00215 stw ra,8(sp)
802568: df000115 stw fp,4(sp)
80256c: d839883a mov fp,sp
return ((alt_errno) ? alt_errno() : &errno);
802570: d0a00b17 ldw r2,-32724(gp)
802574: 1005003a cmpeq r2,r2,zero
802578: 1000041e bne r2,zero,80258c <alt_get_errno+0x2c>
80257c: d0a00b17 ldw r2,-32724(gp)
802580: 103ee83a callr r2
802584: e0800015 stw r2,0(fp)
802588: 00000206 br 802594 <alt_get_errno+0x34>
80258c: d0a01b04 addi r2,gp,-32660
802590: e0800015 stw r2,0(fp)
802594: e0800017 ldw r2,0(fp)
}
802598: dfc00217 ldw ra,8(sp)
80259c: df000117 ldw fp,4(sp)
8025a0: dec00304 addi sp,sp,12
8025a4: f800283a ret
008025a8 <alt_release_fd>:
* error cannont be released backed to the pool. They are always reserved.
*/
void alt_release_fd (int fd)
{
8025a8: defffe04 addi sp,sp,-8
8025ac: df000115 stw fp,4(sp)
8025b0: d839883a mov fp,sp
8025b4: e1000015 stw r4,0(fp)
if (fd > 2)
8025b8: e0800017 ldw r2,0(fp)
8025bc: 108000d0 cmplti r2,r2,3
8025c0: 10000d1e bne r2,zero,8025f8 <alt_release_fd+0x50>
{
alt_fd_list[fd].fd_flags = 0;
8025c4: 00c02034 movhi r3,128
8025c8: 18d40704 addi r3,r3,20508
8025cc: e0800017 ldw r2,0(fp)
8025d0: 10800324 muli r2,r2,12
8025d4: 10c5883a add r2,r2,r3
8025d8: 10800204 addi r2,r2,8
8025dc: 10000015 stw zero,0(r2)
alt_fd_list[fd].dev = 0;
8025e0: 00c02034 movhi r3,128
8025e4: 18d40704 addi r3,r3,20508
8025e8: e0800017 ldw r2,0(fp)
8025ec: 10800324 muli r2,r2,12
8025f0: 10c5883a add r2,r2,r3
8025f4: 10000015 stw zero,0(r2)
}
}
8025f8: df000117 ldw fp,4(sp)
8025fc: dec00204 addi sp,sp,8
802600: f800283a ret
00802604 <alt_alarm_stop>:
* the alarm executes.
*/
void alt_alarm_stop (alt_alarm* alarm)
{
802604: defffb04 addi sp,sp,-20
802608: df000415 stw fp,16(sp)
80260c: d839883a mov fp,sp
802610: e1000015 stw r4,0(fp)
alt_irq_disable_all (void)
{
alt_irq_context context;
NIOS2_READ_STATUS (context);
802614: 0005303a rdctl r2,status
802618: e0800315 stw r2,12(fp)
NIOS2_WRITE_STATUS (0);
80261c: 0001703a wrctl status,zero
802620: e0800317 ldw r2,12(fp)
802624: e0800215 stw r2,8(fp)
802628: e0800217 ldw r2,8(fp)
80262c: e0800115 stw r2,4(fp)
* input argument is the element to remove.
*/
static ALT_INLINE void ALT_ALWAYS_INLINE alt_llist_remove(alt_llist* entry)
{
802630: e0800017 ldw r2,0(fp)
802634: e0800315 stw r2,12(fp)
entry->next->previous = entry->previous;
802638: e0800317 ldw r2,12(fp)
80263c: 10c00017 ldw r3,0(r2)
802640: e0800317 ldw r2,12(fp)
802644: 10800117 ldw r2,4(r2)
802648: 18800115 stw r2,4(r3)
entry->previous->next = entry->next;
80264c: e0800317 ldw r2,12(fp)
802650: 10c00117 ldw r3,4(r2)
802654: e0800317 ldw r2,12(fp)
802658: 10800017 ldw r2,0(r2)
80265c: 18800015 stw r2,0(r3)
/*
* Set the entry to point to itself, so that any further calls to
* alt_llist_remove() are harmless.
*/
entry->previous = entry;
802660: e0c00317 ldw r3,12(fp)
802664: e0800317 ldw r2,12(fp)
802668: 18800115 stw r2,4(r3)
entry->next = entry;
80266c: e0c00317 ldw r3,12(fp)
802670: e0800317 ldw r2,12(fp)
802674: 18800015 stw r2,0(r3)
*/
static ALT_INLINE void ALT_ALWAYS_INLINE
alt_irq_enable_all (alt_irq_context context)
{
802678: e0800117 ldw r2,4(fp)
80267c: e0800315 stw r2,12(fp)
NIOS2_WRITE_STATUS (context);
802680: e0800317 ldw r2,12(fp)
802684: 1001703a wrctl status,r2
alt_irq_context irq_context;
irq_context = alt_irq_disable_all();
alt_llist_remove (&alarm->llist);
alt_irq_enable_all (irq_context);
}
802688: df000417 ldw fp,16(sp)
80268c: dec00504 addi sp,sp,20
802690: f800283a ret
00802694 <alt_tick>:
/*
* alt_tick() is periodically called by the system clock driver in order to
* process the registered list of alarms. Each alarm is registed with a
* callback interval, and a callback function, "callback".
*
* The return value of the callback function indicates how many ticks are to
* elapse until the next callback. A return value of zero indicates that the
* alarm should be deactivated.
*
* alt_tick() is expected to run at interrupt level.
*/
void alt_tick (void)
{
802694: defffb04 addi sp,sp,-20
802698: dfc00415 stw ra,16(sp)
80269c: df000315 stw fp,12(sp)
8026a0: d839883a mov fp,sp
alt_alarm* next;
alt_alarm* alarm = (alt_alarm*) alt_alarm_list.next;
8026a4: d0a01017 ldw r2,-32704(gp)
8026a8: e0800115 stw r2,4(fp)
alt_u32 next_callback;
/* update the tick counter */
_alt_nticks++;
8026ac: d0a00f17 ldw r2,-32708(gp)
8026b0: 10800044 addi r2,r2,1
8026b4: d0a00f15 stw r2,-32708(gp)
/* process the registered callbacks */
while (alarm != (alt_alarm*) &alt_alarm_list)
8026b8: e0c00117 ldw r3,4(fp)
8026bc: d0a01004 addi r2,gp,-32704
8026c0: 18803026 beq r3,r2,802784 <alt_tick+0xf0>
{
next = (alt_alarm*) alarm->llist.next;
8026c4: e0800117 ldw r2,4(fp)
8026c8: 10800017 ldw r2,0(r2)
8026cc: e0800015 stw r2,0(fp)
/*
* Upon the tick-counter rolling over it is safe to clear the
* roll-over flag; once the flag is cleared this (or subsequnt)
* tick events are enabled to generate an alarm event.
*/
if ((alarm->rollover) && (_alt_nticks == 0))
8026d0: e0800117 ldw r2,4(fp)
8026d4: 10800403 ldbu r2,16(r2)
8026d8: 1005003a cmpeq r2,r2,zero
8026dc: 1000051e bne r2,zero,8026f4 <alt_tick+0x60>
8026e0: d0a00f17 ldw r2,-32708(gp)
8026e4: 1004c03a cmpne r2,r2,zero
8026e8: 1000021e bne r2,zero,8026f4 <alt_tick+0x60>
{
alarm->rollover = 0;
8026ec: e0800117 ldw r2,4(fp)
8026f0: 10000405 stb zero,16(r2)
}
/* if the alarm period has expired, make the callback */
if ((alarm->time <= _alt_nticks) && (alarm->rollover == 0))
8026f4: e0800117 ldw r2,4(fp)
8026f8: 10c00217 ldw r3,8(r2)
8026fc: d0a00f17 ldw r2,-32708(gp)
802700: 10c01d36 bltu r2,r3,802778 <alt_tick+0xe4>
802704: e0800117 ldw r2,4(fp)
802708: 10800403 ldbu r2,16(r2)
80270c: 1004c03a cmpne r2,r2,zero
802710: 1000191e bne r2,zero,802778 <alt_tick+0xe4>
{
next_callback = alarm->callback (alarm->context);
802714: e0800117 ldw r2,4(fp)
802718: e0c00117 ldw r3,4(fp)
80271c: 10800317 ldw r2,12(r2)
802720: 19000517 ldw r4,20(r3)
802724: 103ee83a callr r2
802728: e0800215 stw r2,8(fp)
/* deactivate the alarm if the return value is zero */
if (next_callback == 0)
80272c: e0800217 ldw r2,8(fp)
802730: 1004c03a cmpne r2,r2,zero
802734: 1000031e bne r2,zero,802744 <alt_tick+0xb0>
{
alt_alarm_stop (alarm);
802738: e1000117 ldw r4,4(fp)
80273c: 08026040 call 802604 <alt_alarm_stop>
802740: 00000d06 br 802778 <alt_tick+0xe4>
}
else
{
alarm->time += next_callback;
802744: e1000117 ldw r4,4(fp)
802748: e0800117 ldw r2,4(fp)
80274c: 10c00217 ldw r3,8(r2)
802750: e0800217 ldw r2,8(fp)
802754: 1885883a add r2,r3,r2
802758: 20800215 stw r2,8(r4)
/*
* If the desired alarm time causes a roll-over, set the rollover
* flag. This will prevent the subsequent tick event from causing
* an alarm too early.
*/
if(alarm->time < _alt_nticks)
80275c: e0800117 ldw r2,4(fp)
802760: 10c00217 ldw r3,8(r2)
802764: d0a00f17 ldw r2,-32708(gp)
802768: 1880032e bgeu r3,r2,802778 <alt_tick+0xe4>
{
alarm->rollover = 1;
80276c: e0c00117 ldw r3,4(fp)
802770: 00800044 movi r2,1
802774: 18800405 stb r2,16(r3)
}
}
}
alarm = next;
802778: e0800017 ldw r2,0(fp)
80277c: e0800115 stw r2,4(fp)
802780: 003fcd06 br 8026b8 <alt_tick+0x24>
}
/*
* Update the operating system specific timer facilities.
*/
ALT_OS_TIME_TICK();
}
802784: dfc00417 ldw ra,16(sp)
802788: df000317 ldw fp,12(sp)
80278c: dec00504 addi sp,sp,20
802790: f800283a ret
00802794 <usleep>:
* ALT_USLEEP is mapped onto the usleep() system call in alt_syscall.h
*/
unsigned int ALT_USLEEP (unsigned int us)
{
802794: defffd04 addi sp,sp,-12
802798: dfc00215 stw ra,8(sp)
80279c: df000115 stw fp,4(sp)
8027a0: d839883a mov fp,sp
8027a4: e1000015 stw r4,0(fp)
return alt_busy_sleep(us);
8027a8: e1000017 ldw r4,0(fp)
8027ac: 08027c00 call 8027c0 <alt_busy_sleep>
}
8027b0: dfc00217 ldw ra,8(sp)
8027b4: df000117 ldw fp,4(sp)
8027b8: dec00304 addi sp,sp,12
8027bc: f800283a ret
008027c0 <alt_busy_sleep>:
#include "priv/alt_busy_sleep.h"
unsigned int alt_busy_sleep (unsigned int us)
{
8027c0: defffa04 addi sp,sp,-24
8027c4: dfc00515 stw ra,20(sp)
8027c8: df000415 stw fp,16(sp)
8027cc: d839883a mov fp,sp
8027d0: e1000015 stw r4,0(fp)
/*
* Only delay if ALT_SIM_OPTIMIZE is not defined; i.e., if software
* is built targetting ModelSim RTL simulation, the delay will be
* skipped to speed up simulation.
*/
#ifndef ALT_SIM_OPTIMIZE
int i;
int big_loops;
alt_u32 cycles_per_loop;
if (!strcmp(NIOS2_CPU_IMPLEMENTATION,"tiny"))
{
cycles_per_loop = 9;
}
else
{
cycles_per_loop = 3;
8027d4: 008000c4 movi r2,3
8027d8: e0800315 stw r2,12(fp)
}
big_loops = us / (INT_MAX/
8027dc: e0c00317 ldw r3,12(fp)
8027e0: 008003f4 movhi r2,15
8027e4: 10909004 addi r2,r2,16960
8027e8: 188b383a mul r5,r3,r2
8027ec: 0100bef4 movhi r4,763
8027f0: 213c2004 addi r4,r4,-3968
8027f4: 0803b5c0 call 803b5c <__udivsi3>
8027f8: 100b883a mov r5,r2
8027fc: 01200034 movhi r4,32768
802800: 213fffc4 addi r4,r4,-1
802804: 0803b5c0 call 803b5c <__udivsi3>
802808: 100b883a mov r5,r2
80280c: e1000017 ldw r4,0(fp)
802810: 0803b5c0 call 803b5c <__udivsi3>
802814: e0800215 stw r2,8(fp)
(ALT_CPU_FREQ/(cycles_per_loop * 1000000)));
if (big_loops)
802818: e0800217 ldw r2,8(fp)
80281c: 1005003a cmpeq r2,r2,zero
802820: 1000281e bne r2,zero,8028c4 <alt_busy_sleep+0x104>
{
for(i=0;i<big_loops;i++)
802824: e0000115 stw zero,4(fp)
802828: e0c00117 ldw r3,4(fp)
80282c: e0800217 ldw r2,8(fp)
802830: 1880170e bge r3,r2,802890 <alt_busy_sleep+0xd0>
{
/*
* Do NOT Try to single step the asm statement below
* (single step will never return)
* Step out of this function or set a breakpoint after the asm statements
*/
__asm__ volatile (
802834: 00a00034 movhi r2,32768
802838: 10bfffc4 addi r2,r2,-1
80283c: 10bfffc4 addi r2,r2,-1
802840: 103ffe1e bne r2,zero,80283c <alt_busy_sleep+0x7c>
"\n0:"
"\n\taddi %0,%0, -1"
"\n\tbne %0,zero,0b"
"\n1:"
"\n\t.pushsection .debug_alt_sim_info"
"\n\t.int 4, 0, 0b, 1b"
"\n\t.popsection"
:: "r" (INT_MAX));
us -= (INT_MAX/(ALT_CPU_FREQ/
802844: e0c00317 ldw r3,12(fp)
802848: 008003f4 movhi r2,15
80284c: 10909004 addi r2,r2,16960
802850: 188b383a mul r5,r3,r2
802854: 0100bef4 movhi r4,763
802858: 213c2004 addi r4,r4,-3968
80285c: 0803b5c0 call 803b5c <__udivsi3>
802860: 100b883a mov r5,r2
802864: 01200034 movhi r4,32768
802868: 213fffc4 addi r4,r4,-1
80286c: 0803b5c0 call 803b5c <__udivsi3>
802870: 1007883a mov r3,r2
802874: e0800017 ldw r2,0(fp)
802878: 10c5c83a sub r2,r2,r3
80287c: e0800015 stw r2,0(fp)
802880: e0800117 ldw r2,4(fp)
802884: 10800044 addi r2,r2,1
802888: e0800115 stw r2,4(fp)
80288c: 003fe606 br 802828 <alt_busy_sleep+0x68>
(cycles_per_loop * 1000000)));
}
/*
* Do NOT Try to single step the asm statement below
* (single step will never return)
* Step out of this function or set a breakpoint after the asm statements
*/
__asm__ volatile (
802890: e0c00317 ldw r3,12(fp)
802894: 008003f4 movhi r2,15
802898: 10909004 addi r2,r2,16960
80289c: 188b383a mul r5,r3,r2
8028a0: 0100bef4 movhi r4,763
8028a4: 213c2004 addi r4,r4,-3968
8028a8: 0803b5c0 call 803b5c <__udivsi3>
8028ac: 1007883a mov r3,r2
8028b0: e0800017 ldw r2,0(fp)
8028b4: 1885383a mul r2,r3,r2
8028b8: 10bfffc4 addi r2,r2,-1
8028bc: 103ffe1e bne r2,zero,8028b8 <alt_busy_sleep+0xf8>
8028c0: 00000c06 br 8028f4 <alt_busy_sleep+0x134>
"\n0:"
"\n\taddi %0,%0, -1"
"\n\tbne %0,zero,0b"
"\n1:"
"\n\t.pushsection .debug_alt_sim_info"
"\n\t.int 4, 0, 0b, 1b"
"\n\t.popsection"
:: "r" (us*(ALT_CPU_FREQ/(cycles_per_loop * 1000000))));
}
else
{
/*
* Do NOT Try to single step the asm statement below
* (single step will never return)
* Step out of this function or set a breakpoint after the asm statements
*/
__asm__ volatile (
8028c4: e0c00317 ldw r3,12(fp)
8028c8: 008003f4 movhi r2,15
8028cc: 10909004 addi r2,r2,16960
8028d0: 188b383a mul r5,r3,r2
8028d4: 0100bef4 movhi r4,763
8028d8: 213c2004 addi r4,r4,-3968
8028dc: 0803b5c0 call 803b5c <__udivsi3>
8028e0: 1007883a mov r3,r2
8028e4: e0800017 ldw r2,0(fp)
8028e8: 1885383a mul r2,r3,r2
8028ec: 10bfffc4 addi r2,r2,-1
8028f0: 00bffe16 blt zero,r2,8028ec <alt_busy_sleep+0x12c>
"\n0:"
"\n\taddi %0,%0, -1"
"\n\tbgt %0,zero,0b"
"\n1:"
"\n\t.pushsection .debug_alt_sim_info"
"\n\t.int 4, 0, 0b, 1b"
"\n\t.popsection"
:: "r" (us*(ALT_CPU_FREQ/(cycles_per_loop * 1000000))));
}
#endif /* #ifndef ALT_SIM_OPTIMIZE */
return 0;
8028f4: 0005883a mov r2,zero
}
8028f8: dfc00517 ldw ra,20(sp)
8028fc: df000417 ldw fp,16(sp)
802900: dec00604 addi sp,sp,24
802904: f800283a ret
00802908 <alt_find_dev>:
* be found.
*/
alt_dev* alt_find_dev(const char* name, alt_llist* llist)
{
802908: defff904 addi sp,sp,-28
80290c: dfc00615 stw ra,24(sp)
802910: df000515 stw fp,20(sp)
802914: d839883a mov fp,sp
802918: e1000015 stw r4,0(fp)
80291c: e1400115 stw r5,4(fp)
alt_dev* next = (alt_dev*) llist->next;
802920: e0800117 ldw r2,4(fp)
802924: 10800017 ldw r2,0(r2)
802928: e0800215 stw r2,8(fp)
alt_32 len;
len = strlen(name) + 1;
80292c: e1000017 ldw r4,0(fp)
802930: 08036280 call 803628 <strlen>
802934: 10800044 addi r2,r2,1
802938: e0800315 stw r2,12(fp)
/*
* Check each list entry in turn, until a match is found, or we reach the
* end of the list (i.e. next winds up pointing back to the list head).
*/
while (next != (alt_dev*) llist)
80293c: e0c00217 ldw r3,8(fp)
802940: e0800117 ldw r2,4(fp)
802944: 18800e26 beq r3,r2,802980 <alt_find_dev+0x78>
{
/*
* memcmp() is used here rather than strcmp() in order to reduce the size
* of the executable.
*/
if (!memcmp (next->name, name, len))
802948: e0800217 ldw r2,8(fp)
80294c: 11000217 ldw r4,8(r2)
802950: e1400017 ldw r5,0(fp)
802954: e1800317 ldw r6,12(fp)
802958: 08034140 call 803414 <memcmp>
80295c: 1004c03a cmpne r2,r2,zero
802960: 1000031e bne r2,zero,802970 <alt_find_dev+0x68>
{
/* match found */
return next;
802964: e0800217 ldw r2,8(fp)
802968: e0800415 stw r2,16(fp)
80296c: 00000506 br 802984 <alt_find_dev+0x7c>
}
next = (alt_dev*) next->llist.next;
802970: e0800217 ldw r2,8(fp)
802974: 10800017 ldw r2,0(r2)
802978: e0800215 stw r2,8(fp)
80297c: 003fef06 br 80293c <alt_find_dev+0x34>
}
/* No match found */
return NULL;
802980: e0000415 stw zero,16(fp)
}
802984: e0800417 ldw r2,16(fp)
802988: dfc00617 ldw ra,24(sp)
80298c: df000517 ldw fp,20(sp)
802990: dec00704 addi sp,sp,28
802994: f800283a ret
00802998 <alt_find_file>:
* "/myfilesystem/junk.txt" would match: "/myfilesystem", but not: "/myfile".
*/
alt_dev* alt_find_file (const char* name)
{
802998: defffa04 addi sp,sp,-24
80299c: dfc00515 stw ra,20(sp)
8029a0: df000415 stw fp,16(sp)
8029a4: d839883a mov fp,sp
8029a8: e1000015 stw r4,0(fp)
alt_dev* next = (alt_dev*) alt_fs_list.next;
8029ac: d0a00617 ldw r2,-32744(gp)
8029b0: e0800115 stw r2,4(fp)
alt_32 len;
/*
* Check each list entry in turn, until a match is found, or we reach the
* end of the list (i.e. next winds up pointing back to the list head).
*/
while (next != (alt_dev*) &alt_fs_list)
8029b4: e0c00117 ldw r3,4(fp)
8029b8: d0a00604 addi r2,gp,-32744
8029bc: 18802926 beq r3,r2,802a64 <alt_find_file+0xcc>
{
len = strlen(next->name);
8029c0: e0800117 ldw r2,4(fp)
8029c4: 11000217 ldw r4,8(r2)
8029c8: 08036280 call 803628 <strlen>
8029cc: e0800215 stw r2,8(fp)
if (next->name[len-1] == '/')
8029d0: e0800117 ldw r2,4(fp)
8029d4: 10c00217 ldw r3,8(r2)
8029d8: e0800217 ldw r2,8(fp)
8029dc: 1885883a add r2,r3,r2
8029e0: 10bfffc4 addi r2,r2,-1
8029e4: 10800007 ldb r2,0(r2)
8029e8: 10800bd8 cmpnei r2,r2,47
8029ec: 1000031e bne r2,zero,8029fc <alt_find_file+0x64>
{
len -= 1;
8029f0: e0800217 ldw r2,8(fp)
8029f4: 10bfffc4 addi r2,r2,-1
8029f8: e0800215 stw r2,8(fp)
}
if (((name[len] == '/') || (name[len] == '\0')) &&
8029fc: e0c00017 ldw r3,0(fp)
802a00: e0800217 ldw r2,8(fp)
802a04: 1885883a add r2,r3,r2
802a08: 10800007 ldb r2,0(r2)
802a0c: 10800be0 cmpeqi r2,r2,47
802a10: 1000061e bne r2,zero,802a2c <alt_find_file+0x94>
802a14: e0c00017 ldw r3,0(fp)
802a18: e0800217 ldw r2,8(fp)
802a1c: 1885883a add r2,r3,r2
802a20: 10800007 ldb r2,0(r2)
802a24: 1004c03a cmpne r2,r2,zero
802a28: 10000a1e bne r2,zero,802a54 <alt_find_file+0xbc>
802a2c: e0800117 ldw r2,4(fp)
802a30: 11000217 ldw r4,8(r2)
802a34: e1400017 ldw r5,0(fp)
802a38: e1800217 ldw r6,8(fp)
802a3c: 08034140 call 803414 <memcmp>
802a40: 1004c03a cmpne r2,r2,zero
802a44: 1000031e bne r2,zero,802a54 <alt_find_file+0xbc>
!memcmp (next->name, name, len))
{
/* match found */
return next;
802a48: e0800117 ldw r2,4(fp)
802a4c: e0800315 stw r2,12(fp)
802a50: 00000506 br 802a68 <alt_find_file+0xd0>
}
next = (alt_dev*) next->llist.next;
802a54: e0800117 ldw r2,4(fp)
802a58: 10800017 ldw r2,0(r2)
802a5c: e0800115 stw r2,4(fp)
802a60: 003fd406 br 8029b4 <alt_find_file+0x1c>
}
/* No match found */
return NULL;
802a64: e0000315 stw zero,12(fp)
}
802a68: e0800317 ldw r2,12(fp)
802a6c: dfc00517 ldw ra,20(sp)
802a70: df000417 ldw fp,16(sp)
802a74: dec00604 addi sp,sp,24
802a78: f800283a ret
00802a7c <alt_get_fd>:
* negative value indicates failure.
*/
int alt_get_fd (alt_dev* dev)
{
802a7c: defffa04 addi sp,sp,-24
802a80: df000515 stw fp,20(sp)
802a84: d839883a mov fp,sp
802a88: e1000015 stw r4,0(fp)
alt_32 i;
int rc = -EMFILE;
802a8c: 00bffa04 movi r2,-24
802a90: e0800215 stw r2,8(fp)
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
802a94: e0000315 stw zero,12(fp)
/*
* Take the alt_fd_list_lock semaphore in order to avoid races when
* accessing the file descriptor pool.
*/
ALT_SEM_PEND(alt_fd_list_lock, 0);
/*
* Search through the list of file descriptors, and allocate the first
* free descriptor that's found.
*
* If a free descriptor is found, then the value of "alt_max_fd" is
* updated accordingly. "alt_max_fd" is a 'highwater mark' which
* indicates the highest file descriptor ever allocated. This is used to
* improve efficency when searching the file descriptor list, and
* therefore reduce contention on the alt_fd_list_lock semaphore.
*/
for (i = 0; i < ALT_MAX_FD; i++)
802a98: e0000115 stw zero,4(fp)
802a9c: e0800117 ldw r2,4(fp)
802aa0: 10800808 cmpgei r2,r2,32
802aa4: 10001b1e bne r2,zero,802b14 <alt_get_fd+0x98>
{
if (!alt_fd_list[i].dev)
802aa8: 00c02034 movhi r3,128
802aac: 18d40704 addi r3,r3,20508
802ab0: e0800117 ldw r2,4(fp)
802ab4: 10800324 muli r2,r2,12
802ab8: 10c5883a add r2,r2,r3
802abc: 10800017 ldw r2,0(r2)
802ac0: 1004c03a cmpne r2,r2,zero
802ac4: 10000f1e bne r2,zero,802b04 <alt_get_fd+0x88>
{
alt_fd_list[i].dev = dev;
802ac8: 00c02034 movhi r3,128
802acc: 18d40704 addi r3,r3,20508
802ad0: e0800117 ldw r2,4(fp)
802ad4: 10800324 muli r2,r2,12
802ad8: 10c7883a add r3,r2,r3
802adc: e0800017 ldw r2,0(fp)
802ae0: 18800015 stw r2,0(r3)
if (i > alt_max_fd)
802ae4: e0c00117 ldw r3,4(fp)
802ae8: d0a00a17 ldw r2,-32728(gp)
802aec: 10c0020e bge r2,r3,802af8 <alt_get_fd+0x7c>
{
alt_max_fd = i;
802af0: e0800117 ldw r2,4(fp)
802af4: d0a00a15 stw r2,-32728(gp)
}
rc = i;
802af8: e0800117 ldw r2,4(fp)
802afc: e0800215 stw r2,8(fp)
goto alt_get_fd_exit;
802b00: 00000406 br 802b14 <alt_get_fd+0x98>
802b04: e0800117 ldw r2,4(fp)
802b08: 10800044 addi r2,r2,1
802b0c: e0800115 stw r2,4(fp)
802b10: 003fe206 br 802a9c <alt_get_fd+0x20>
*/
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
{
return 0;
802b14: e0000415 stw zero,16(fp)
}
}
alt_get_fd_exit:
/*
* Release the alt_fd_list_lock semaphore now that we are done with the
* file descriptor pool.
*/
ALT_SEM_POST(alt_fd_list_lock);
return rc;
802b18: e0800217 ldw r2,8(fp)
}
802b1c: df000517 ldw fp,20(sp)
802b20: dec00604 addi sp,sp,24
802b24: f800283a ret
00802b28 <alt_icache_flush>:
* region of length "len" bytes, starting at address "start".
*/
void alt_icache_flush (void* start, alt_u32 len)
{
802b28: defffb04 addi sp,sp,-20
802b2c: df000415 stw fp,16(sp)
802b30: d839883a mov fp,sp
802b34: e1000015 stw r4,0(fp)
802b38: e1400115 stw r5,4(fp)
#if NIOS2_ICACHE_SIZE > 0
char* i;
char* end;
/*
* This is the most we would ever need to flush.
*/
if (len > NIOS2_ICACHE_SIZE)
802b3c: e0800117 ldw r2,4(fp)
802b40: 10840070 cmpltui r2,r2,4097
802b44: 1000021e bne r2,zero,802b50 <alt_icache_flush+0x28>
{
len = NIOS2_ICACHE_SIZE;
802b48: 00840004 movi r2,4096
802b4c: e0800115 stw r2,4(fp)
}
end = ((char*) start) + len;
802b50: e0c00017 ldw r3,0(fp)
802b54: e0800117 ldw r2,4(fp)
802b58: 1885883a add r2,r3,r2
802b5c: e0800315 stw r2,12(fp)
for (i = start; i < end; i+= NIOS2_ICACHE_LINE_SIZE)
802b60: e0800017 ldw r2,0(fp)
802b64: e0800215 stw r2,8(fp)
802b68: e0c00217 ldw r3,8(fp)
802b6c: e0800317 ldw r2,12(fp)
802b70: 1880062e bgeu r3,r2,802b8c <alt_icache_flush+0x64>
{
__asm__ volatile ("flushi %0" :: "r" (i));
802b74: e0800217 ldw r2,8(fp)
802b78: 1000603a flushi r2
802b7c: e0800217 ldw r2,8(fp)
802b80: 10800804 addi r2,r2,32
802b84: e0800215 stw r2,8(fp)
802b88: 003ff706 br 802b68 <alt_icache_flush+0x40>
}
/*
* For an unaligned flush request, we've got one more line left.
* Note that this is dependent on NIOS2_ICACHE_LINE_SIZE to be a
* multiple of 2 (which it always is).
*/
if (((alt_u32) start) & (NIOS2_ICACHE_LINE_SIZE - 1))
802b8c: e0800017 ldw r2,0(fp)
802b90: 108007cc andi r2,r2,31
802b94: 1005003a cmpeq r2,r2,zero
802b98: 1000021e bne r2,zero,802ba4 <alt_icache_flush+0x7c>
{
__asm__ volatile ("flushi %0" :: "r" (i));
802b9c: e0800217 ldw r2,8(fp)
802ba0: 1000603a flushi r2
}
/*
* Having flushed the cache, flush any stale instructions in the
* pipeline
*/
__asm__ volatile ("flushp");
802ba4: 0000203a flushp
#endif /* NIOS2_ICACHE_SIZE > 0 */
}
802ba8: df000417 ldw fp,16(sp)
802bac: dec00504 addi sp,sp,20
802bb0: f800283a ret
00802bb4 <atexit>:
802bb4: d0a01317 ldw r2,-32692(gp)
802bb8: defffe04 addi sp,sp,-8
802bbc: dc000015 stw r16,0(sp)
802bc0: dfc00115 stw ra,4(sp)
802bc4: 11405217 ldw r5,328(r2)
802bc8: 2021883a mov r16,r4
802bcc: 01004304 movi r4,268
802bd0: 28001b26 beq r5,zero,802c40 <atexit+0x8c>
802bd4: 28c00117 ldw r3,4(r5)
802bd8: 008007c4 movi r2,31
802bdc: 10c00d16 blt r2,r3,802c14 <atexit+0x60>
802be0: 28800104 addi r2,r5,4
802be4: 10c00017 ldw r3,0(r2)
802be8: 000d883a mov r6,zero
802bec: 180890ba slli r4,r3,2
802bf0: 18c00044 addi r3,r3,1
802bf4: 10c00015 stw r3,0(r2)
802bf8: 2149883a add r4,r4,r5
802bfc: 24000215 stw r16,8(r4)
802c00: 3005883a mov r2,r6
802c04: dfc00117 ldw ra,4(sp)
802c08: dc000017 ldw r16,0(sp)
802c0c: dec00204 addi sp,sp,8
802c10: f800283a ret
802c14: 0802d340 call 802d34 <malloc>
802c18: 100b883a mov r5,r2
802c1c: 01bfffc4 movi r6,-1
802c20: 103ff726 beq r2,zero,802c00 <atexit+0x4c>
802c24: d0e01317 ldw r3,-32692(gp)
802c28: 10004215 stw zero,264(r2)
802c2c: 10000115 stw zero,4(r2)
802c30: 18805217 ldw r2,328(r3)
802c34: 28800015 stw r2,0(r5)
802c38: 19405215 stw r5,328(r3)
802c3c: 003fe806 br 802be0 <atexit+0x2c>
802c40: 01402034 movhi r5,128
802c44: 2956ae04 addi r5,r5,23224
802c48: 11405215 stw r5,328(r2)
802c4c: 003fe106 br 802bd4 <atexit+0x20>
00802c50 <exit>:
802c50: d0a01317 ldw r2,-32692(gp)
802c54: defff804 addi sp,sp,-32
802c58: dd800015 stw r22,0(sp)
802c5c: dfc00715 stw ra,28(sp)
802c60: dc000615 stw r16,24(sp)
802c64: dc400515 stw r17,20(sp)
802c68: dc800415 stw r18,16(sp)
802c6c: dcc00315 stw r19,12(sp)
802c70: dd000215 stw r20,8(sp)
802c74: dd400115 stw r21,4(sp)
802c78: 15005217 ldw r20,328(r2)
802c7c: 202d883a mov r22,r4
802c80: a0002526 beq r20,zero,802d18 <exit+0xc8>
802c84: a0800117 ldw r2,4(r20)
802c88: a5402204 addi r21,r20,136
802c8c: 0027883a mov r19,zero
802c90: 143fffc4 addi r16,r2,-1
802c94: 8006803a cmplt r3,r16,zero
802c98: 1800021e bne r3,zero,802ca4 <exit+0x54>
802c9c: 00800044 movi r2,1
802ca0: 1426983a sll r19,r2,r16
802ca4: 1800191e bne r3,zero,802d0c <exit+0xbc>
802ca8: 800490ba slli r2,r16,2
802cac: 1025883a mov r18,r2
802cb0: 1505883a add r2,r2,r20
802cb4: 14400204 addi r17,r2,8
802cb8: 00000806 br 802cdc <exit+0x8c>
802cbc: 88800017 ldw r2,0(r17)
802cc0: 29400017 ldw r5,0(r5)
802cc4: 843fffc4 addi r16,r16,-1
802cc8: 94bfff04 addi r18,r18,-4
802ccc: 103ee83a callr r2
802cd0: 8c7fff04 addi r17,r17,-4
802cd4: 9827d07a srai r19,r19,1
802cd8: 80000c16 blt r16,zero,802d0c <exit+0xbc>
802cdc: a8802017 ldw r2,128(r21)
802ce0: 954b883a add r5,r18,r21
802ce4: b009883a mov r4,r22
802ce8: 14c4703a and r2,r2,r19
802cec: 103ff31e bne r2,zero,802cbc <exit+0x6c>
802cf0: 88800017 ldw r2,0(r17)
802cf4: 843fffc4 addi r16,r16,-1
802cf8: 94bfff04 addi r18,r18,-4
802cfc: 103ee83a callr r2
802d00: 8c7fff04 addi r17,r17,-4
802d04: 9827d07a srai r19,r19,1
802d08: 803ff40e bge r16,zero,802cdc <exit+0x8c>
802d0c: a5000017 ldw r20,0(r20)
802d10: a03fdc1e bne r20,zero,802c84 <exit+0x34>
802d14: d0a01317 ldw r2,-32692(gp)
802d18: 10c00f17 ldw r3,60(r2)
802d1c: 1800021e bne r3,zero,802d28 <exit+0xd8>
802d20: b009883a mov r4,r22
802d24: 0803bac0 call 803bac <_exit>
802d28: 1009883a mov r4,r2
802d2c: 183ee83a callr r3
802d30: 003ffb06 br 802d20 <exit+0xd0>
00802d34 <malloc>:
802d34: 200b883a mov r5,r4
802d38: d1201317 ldw r4,-32692(gp)
802d3c: 02002034 movhi r8,128
802d40: 420b5704 addi r8,r8,11612
802d44: 4000683a jmp r8
00802d48 <free>:
802d48: 200b883a mov r5,r4
802d4c: d1201317 ldw r4,-32692(gp)
802d50: 02002034 movhi r8,128
802d54: 420dea04 addi r8,r8,14248
802d58: 4000683a jmp r8
00802d5c <_malloc_r>:
802d5c: defff504 addi sp,sp,-44
802d60: 28c002c4 addi r3,r5,11
802d64: 00800584 movi r2,22
802d68: dc400715 stw r17,28(sp)
802d6c: dc800615 stw r18,24(sp)
802d70: dfc00a15 stw ra,40(sp)
802d74: df000915 stw fp,36(sp)
802d78: dc000815 stw r16,32(sp)
802d7c: dcc00515 stw r19,20(sp)
802d80: dd000415 stw r20,16(sp)
802d84: dd400315 stw r21,12(sp)
802d88: dd800215 stw r22,8(sp)
802d8c: ddc00115 stw r23,4(sp)
802d90: 2025883a mov r18,r4
802d94: 04400404 movi r17,16
802d98: 10c0032e bgeu r2,r3,802da8 <_malloc_r+0x4c>
802d9c: 00bffe04 movi r2,-8
802da0: 18a2703a and r17,r3,r2
802da4: 88000116 blt r17,zero,802dac <_malloc_r+0x50>
802da8: 89400d2e bgeu r17,r5,802de0 <_malloc_r+0x84>
802dac: 0005883a mov r2,zero
802db0: dfc00a17 ldw ra,40(sp)
802db4: df000917 ldw fp,36(sp)
802db8: dc000817 ldw r16,32(sp)
802dbc: dc400717 ldw r17,28(sp)
802dc0: dc800617 ldw r18,24(sp)
802dc4: dcc00517 ldw r19,20(sp)
802dc8: dd000417 ldw r20,16(sp)
802dcc: dd400317 ldw r21,12(sp)
802dd0: dd800217 ldw r22,8(sp)
802dd4: ddc00117 ldw r23,4(sp)
802dd8: dec00b04 addi sp,sp,44
802ddc: f800283a ret
802de0: 9009883a mov r4,r18
802de4: 0803bcc0 call 803bcc <__malloc_lock>
802de8: 00807dc4 movi r2,503
802dec: 14401536 bltu r2,r17,802e44 <_malloc_r+0xe8>
802df0: 03402034 movhi r13,128
802df4: 6b555004 addi r13,r13,21824
802df8: 8b4d883a add r6,r17,r13
802dfc: 34000317 ldw r16,12(r6)
802e00: 8812d0fa srli r9,r17,3
802e04: 81803e26 beq r16,r6,802f00 <_malloc_r+0x1a4>
802e08: 80c00117 ldw r3,4(r16)
802e0c: 00bfff04 movi r2,-4
802e10: 82000317 ldw r8,12(r16)
802e14: 1886703a and r3,r3,r2
802e18: 80cb883a add r5,r16,r3
802e1c: 28800117 ldw r2,4(r5)
802e20: 81c00217 ldw r7,8(r16)
802e24: 9009883a mov r4,r18
802e28: 10800054 ori r2,r2,1
802e2c: 41c00215 stw r7,8(r8)
802e30: 28800115 stw r2,4(r5)
802e34: 3a000315 stw r8,12(r7)
802e38: 0803be80 call 803be8 <__malloc_unlock>
802e3c: 80800204 addi r2,r16,8
802e40: 003fdb06 br 802db0 <_malloc_r+0x54>
802e44: 8806d27a srli r3,r17,9
802e48: 8812d0fa srli r9,r17,3
802e4c: 18000926 beq r3,zero,802e74 <_malloc_r+0x118>
802e50: 00800104 movi r2,4
802e54: 10c02f2e bgeu r2,r3,802f14 <_malloc_r+0x1b8>
802e58: 00800504 movi r2,20
802e5c: 1a4016c4 addi r9,r3,91
802e60: 10c0042e bgeu r2,r3,802e74 <_malloc_r+0x118>
802e64: 00801504 movi r2,84
802e68: 10c11536 bltu r2,r3,8032c0 <_malloc_r+0x564>
802e6c: 8804d33a srli r2,r17,12
802e70: 12401b84 addi r9,r2,110
802e74: 480490fa slli r2,r9,3
802e78: 03402034 movhi r13,128
802e7c: 6b555004 addi r13,r13,21824
802e80: 134b883a add r5,r2,r13
802e84: 2c000317 ldw r16,12(r5)
802e88: 81400926 beq r16,r5,802eb0 <_malloc_r+0x154>
802e8c: 01ffff04 movi r7,-4
802e90: 018003c4 movi r6,15
802e94: 80800117 ldw r2,4(r16)
802e98: 11c6703a and r3,r2,r7
802e9c: 1c49c83a sub r4,r3,r17
802ea0: 3100aa16 blt r6,r4,80314c <_malloc_r+0x3f0>
802ea4: 2000690e bge r4,zero,80304c <_malloc_r+0x2f0>
802ea8: 84000317 ldw r16,12(r16)
802eac: 817ff91e bne r16,r5,802e94 <_malloc_r+0x138>
802eb0: 4a400044 addi r9,r9,1
802eb4: 03002034 movhi r12,128
802eb8: 63155204 addi r12,r12,21832
802ebc: 64000217 ldw r16,8(r12)
802ec0: 83002826 beq r16,r12,802f64 <_malloc_r+0x208>
802ec4: 80800117 ldw r2,4(r16)
802ec8: 00ffff04 movi r3,-4
802ecc: 10c6703a and r3,r2,r3
802ed0: 1c49c83a sub r4,r3,r17
802ed4: 008003c4 movi r2,15
802ed8: 11006616 blt r2,r4,803074 <_malloc_r+0x318>
802edc: 63000315 stw r12,12(r12)
802ee0: 63000215 stw r12,8(r12)
802ee4: 20000e16 blt r4,zero,802f20 <_malloc_r+0x1c4>
802ee8: 80c7883a add r3,r16,r3
802eec: 18800117 ldw r2,4(r3)
802ef0: 9009883a mov r4,r18
802ef4: 10800054 ori r2,r2,1
802ef8: 18800115 stw r2,4(r3)
802efc: 003fce06 br 802e38 <_malloc_r+0xdc>
802f00: 81800204 addi r6,r16,8
802f04: 34000317 ldw r16,12(r6)
802f08: 81bfbf1e bne r16,r6,802e08 <_malloc_r+0xac>
802f0c: 4a400084 addi r9,r9,2
802f10: 003fe806 br 802eb4 <_malloc_r+0x158>
802f14: 8804d1ba srli r2,r17,6
802f18: 12400e04 addi r9,r2,56
802f1c: 003fd506 br 802e74 <_malloc_r+0x118>
802f20: 00807fc4 movi r2,511
802f24: 10c09436 bltu r2,r3,803178 <_malloc_r+0x41c>
802f28: 1808d0fa srli r4,r3,3
802f2c: 61bffe04 addi r6,r12,-8
802f30: 00800044 movi r2,1
802f34: 200a90fa slli r5,r4,3
802f38: 2007d0ba srai r3,r4,2
802f3c: 31000117 ldw r4,4(r6)
802f40: 2991883a add r8,r5,r6
802f44: 41c00217 ldw r7,8(r8)
802f48: 10c4983a sll r2,r2,r3
802f4c: 82000315 stw r8,12(r16)
802f50: 81c00215 stw r7,8(r16)
802f54: 2088b03a or r4,r4,r2
802f58: 3c000315 stw r16,12(r7)
802f5c: 31000115 stw r4,4(r6)
802f60: 44000215 stw r16,8(r8)
802f64: 4807883a mov r3,r9
802f68: 4800a616 blt r9,zero,803204 <_malloc_r+0x4a8>
802f6c: 1807d0ba srai r3,r3,2
802f70: 03402034 movhi r13,128
802f74: 6b555004 addi r13,r13,21824
802f78: 00800044 movi r2,1
802f7c: 10ce983a sll r7,r2,r3
802f80: 69000117 ldw r4,4(r13)
802f84: 21c04836 bltu r4,r7,8030a8 <_malloc_r+0x34c>
802f88: 21c4703a and r2,r4,r7
802f8c: 10000a1e bne r2,zero,802fb8 <_malloc_r+0x25c>
802f90: 39cf883a add r7,r7,r7
802f94: 00bfff04 movi r2,-4
802f98: 4884703a and r2,r9,r2
802f9c: 21c6703a and r3,r4,r7
802fa0: 12400104 addi r9,r2,4
802fa4: 1800041e bne r3,zero,802fb8 <_malloc_r+0x25c>
802fa8: 39cf883a add r7,r7,r7
802fac: 4a400104 addi r9,r9,4
802fb0: 21c4703a and r2,r4,r7
802fb4: 103ffc26 beq r2,zero,802fa8 <_malloc_r+0x24c>
802fb8: 480490fa slli r2,r9,3
802fbc: 4817883a mov r11,r9
802fc0: 134d883a add r6,r2,r13
802fc4: 300b883a mov r5,r6
802fc8: 2c000317 ldw r16,12(r5)
802fcc: 81400926 beq r16,r5,802ff4 <_malloc_r+0x298>
802fd0: 02bfff04 movi r10,-4
802fd4: 020003c4 movi r8,15
802fd8: 80800117 ldw r2,4(r16)
802fdc: 1286703a and r3,r2,r10
802fe0: 1c49c83a sub r4,r3,r17
802fe4: 41008016 blt r8,r4,8031e8 <_malloc_r+0x48c>
802fe8: 2000180e bge r4,zero,80304c <_malloc_r+0x2f0>
802fec: 84000317 ldw r16,12(r16)
802ff0: 817ff91e bne r16,r5,802fd8 <_malloc_r+0x27c>
802ff4: 4a400044 addi r9,r9,1
802ff8: 488000cc andi r2,r9,3
802ffc: 29400204 addi r5,r5,8
803000: 103ff11e bne r2,zero,802fc8 <_malloc_r+0x26c>
803004: 588000cc andi r2,r11,3
803008: 31bffe04 addi r6,r6,-8
80300c: 5affffc4 addi r11,r11,-1
803010: 1000e526 beq r2,zero,8033a8 <_malloc_r+0x64c>
803014: 30800217 ldw r2,8(r6)
803018: 11bffa26 beq r2,r6,803004 <_malloc_r+0x2a8>
80301c: 03402034 movhi r13,128
803020: 6b555004 addi r13,r13,21824
803024: 39cf883a add r7,r7,r7
803028: 68c00117 ldw r3,4(r13)
80302c: 19c01e36 bltu r3,r7,8030a8 <_malloc_r+0x34c>
803030: 3800031e bne r7,zero,803040 <_malloc_r+0x2e4>
803034: 00001c06 br 8030a8 <_malloc_r+0x34c>
803038: 39cf883a add r7,r7,r7
80303c: 4a400104 addi r9,r9,4
803040: 19c4703a and r2,r3,r7
803044: 103ffc26 beq r2,zero,803038 <_malloc_r+0x2dc>
803048: 003fdb06 br 802fb8 <_malloc_r+0x25c>
80304c: 80c7883a add r3,r16,r3
803050: 18800117 ldw r2,4(r3)
803054: 82000317 ldw r8,12(r16)
803058: 81c00217 ldw r7,8(r16)
80305c: 10800054 ori r2,r2,1
803060: 9009883a mov r4,r18
803064: 18800115 stw r2,4(r3)
803068: 41c00215 stw r7,8(r8)
80306c: 3a000315 stw r8,12(r7)
803070: 003f7106 br 802e38 <_malloc_r+0xdc>
803074: 88800054 ori r2,r17,1
803078: 844b883a add r5,r16,r17
80307c: 80800115 stw r2,4(r16)
803080: 2905883a add r2,r5,r4
803084: 20c00054 ori r3,r4,1
803088: 61400315 stw r5,12(r12)
80308c: 61400215 stw r5,8(r12)
803090: 11000015 stw r4,0(r2)
803094: 9009883a mov r4,r18
803098: 2b000215 stw r12,8(r5)
80309c: 28c00115 stw r3,4(r5)
8030a0: 2b000315 stw r12,12(r5)
8030a4: 003f6406 br 802e38 <_malloc_r+0xdc>
8030a8: 6d400217 ldw r21,8(r13)
8030ac: 00bfff04 movi r2,-4
8030b0: a8c00117 ldw r3,4(r21)
8030b4: 18ac703a and r22,r3,r2
8030b8: b449c83a sub r4,r22,r17
8030bc: b4400236 bltu r22,r17,8030c8 <_malloc_r+0x36c>
8030c0: 008003c4 movi r2,15
8030c4: 11002316 blt r2,r4,803154 <_malloc_r+0x3f8>
8030c8: d0a01717 ldw r2,-32676(gp)
8030cc: 073fffc4 movi fp,-1
8030d0: b02f883a mov r23,r22
8030d4: 8887883a add r3,r17,r2
8030d8: d0a01617 ldw r2,-32680(gp)
8030dc: ada7883a add r19,r21,r22
8030e0: 1d000404 addi r20,r3,16
8030e4: 17000326 beq r2,fp,8030f4 <_malloc_r+0x398>
8030e8: 18c403c4 addi r3,r3,4111
8030ec: 00bc0004 movi r2,-4096
8030f0: 18a8703a and r20,r3,r2
8030f4: 9009883a mov r4,r18
8030f8: a00b883a mov r5,r20
8030fc: db400015 stw r13,0(sp)
803100: 08035dc0 call 8035dc <_sbrk_r>
803104: 1021883a mov r16,r2
803108: db400017 ldw r13,0(sp)
80310c: 17000426 beq r2,fp,803120 <_malloc_r+0x3c4>
803110: 14c03e2e bgeu r2,r19,80320c <_malloc_r+0x4b0>
803114: 00802034 movhi r2,128
803118: 10955004 addi r2,r2,21824
80311c: a8803b26 beq r21,r2,80320c <_malloc_r+0x4b0>
803120: 68800217 ldw r2,8(r13)
803124: 013fff04 movi r4,-4
803128: 10c00117 ldw r3,4(r2)
80312c: 1906703a and r3,r3,r4
803130: 1c49c83a sub r4,r3,r17
803134: 1c400236 bltu r3,r17,803140 <_malloc_r+0x3e4>
803138: 008003c4 movi r2,15
80313c: 11000516 blt r2,r4,803154 <_malloc_r+0x3f8>
803140: 9009883a mov r4,r18
803144: 0803be80 call 803be8 <__malloc_unlock>
803148: 003f1806 br 802dac <_malloc_r+0x50>
80314c: 4a7fffc4 addi r9,r9,-1
803150: 003f5706 br 802eb0 <_malloc_r+0x154>
803154: 6c000217 ldw r16,8(r13)
803158: 88800054 ori r2,r17,1
80315c: 21000054 ori r4,r4,1
803160: 8447883a add r3,r16,r17
803164: 80800115 stw r2,4(r16)
803168: 19000115 stw r4,4(r3)
80316c: 9009883a mov r4,r18
803170: 68c00215 stw r3,8(r13)
803174: 003f3006 br 802e38 <_malloc_r+0xdc>
803178: 180ad27a srli r5,r3,9
80317c: 1808d0fa srli r4,r3,3
803180: 28000426 beq r5,zero,803194 <_malloc_r+0x438>
803184: 00800104 movi r2,4
803188: 11405836 bltu r2,r5,8032ec <_malloc_r+0x590>
80318c: 1804d1ba srli r2,r3,6
803190: 11000e04 addi r4,r2,56
803194: 200490fa slli r2,r4,3
803198: 01402034 movhi r5,128
80319c: 29555004 addi r5,r5,21824
8031a0: 1351883a add r8,r2,r13
8031a4: 41c00217 ldw r7,8(r8)
8031a8: 3a006d26 beq r7,r8,803360 <_malloc_r+0x604>
8031ac: 38800117 ldw r2,4(r7)
8031b0: 013fff04 movi r4,-4
8031b4: 1104703a and r2,r2,r4
8031b8: 1880052e bgeu r3,r2,8031d0 <_malloc_r+0x474>
8031bc: 39c00217 ldw r7,8(r7)
8031c0: 3a000326 beq r7,r8,8031d0 <_malloc_r+0x474>
8031c4: 38800117 ldw r2,4(r7)
8031c8: 1104703a and r2,r2,r4
8031cc: 18bffb36 bltu r3,r2,8031bc <_malloc_r+0x460>
8031d0: 3a000317 ldw r8,12(r7)
8031d4: 82000315 stw r8,12(r16)
8031d8: 81c00215 stw r7,8(r16)
8031dc: 3c000315 stw r16,12(r7)
8031e0: 44000215 stw r16,8(r8)
8031e4: 003f5f06 br 802f64 <_malloc_r+0x208>
8031e8: 82000317 ldw r8,12(r16)
8031ec: 81c00217 ldw r7,8(r16)
8031f0: 88800054 ori r2,r17,1
8031f4: 844b883a add r5,r16,r17
8031f8: 41c00215 stw r7,8(r8)
8031fc: 3a000315 stw r8,12(r7)
803200: 003f9e06 br 80307c <_malloc_r+0x320>
803204: 48c000c4 addi r3,r9,3
803208: 003f5806 br 802f6c <_malloc_r+0x210>
80320c: 07002034 movhi fp,128
803210: e7154604 addi fp,fp,21784
803214: e0800017 ldw r2,0(fp)
803218: 1505883a add r2,r2,r20
80321c: e0800015 stw r2,0(fp)
803220: 84c05826 beq r16,r19,803384 <_malloc_r+0x628>
803224: d0e01617 ldw r3,-32680(gp)
803228: 00bfffc4 movi r2,-1
80322c: 18805326 beq r3,r2,80337c <_malloc_r+0x620>
803230: e0800017 ldw r2,0(fp)
803234: 84c7c83a sub r3,r16,r19
803238: 10c5883a add r2,r2,r3
80323c: e0800015 stw r2,0(fp)
803240: 80c001cc andi r3,r16,7
803244: 0027883a mov r19,zero
803248: 18000326 beq r3,zero,803258 <_malloc_r+0x4fc>
80324c: 00800204 movi r2,8
803250: 10e7c83a sub r19,r2,r3
803254: 84e1883a add r16,r16,r19
803258: 8505883a add r2,r16,r20
80325c: 1083ffcc andi r2,r2,4095
803260: 00c40004 movi r3,4096
803264: 1887c83a sub r3,r3,r2
803268: 98e7883a add r19,r19,r3
80326c: 9009883a mov r4,r18
803270: 980b883a mov r5,r19
803274: db400015 stw r13,0(sp)
803278: 08035dc0 call 8035dc <_sbrk_r>
80327c: 1007883a mov r3,r2
803280: 00bfffc4 movi r2,-1
803284: db400017 ldw r13,0(sp)
803288: 18804e26 beq r3,r2,8033c4 <_malloc_r+0x668>
80328c: e0800017 ldw r2,0(fp)
803290: 1c07c83a sub r3,r3,r16
803294: 1cc9883a add r4,r3,r19
803298: 14c5883a add r2,r2,r19
80329c: e0800015 stw r2,0(fp)
8032a0: 6c000215 stw r16,8(r13)
8032a4: 20800054 ori r2,r4,1
8032a8: ab404426 beq r21,r13,8033bc <_malloc_r+0x660>
8032ac: 014003c4 movi r5,15
8032b0: 2d801636 bltu r5,r22,80330c <_malloc_r+0x5b0>
8032b4: 00800044 movi r2,1
8032b8: 80800115 stw r2,4(r16)
8032bc: 003f9806 br 803120 <_malloc_r+0x3c4>
8032c0: 00805504 movi r2,340
8032c4: 10c00336 bltu r2,r3,8032d4 <_malloc_r+0x578>
8032c8: 8804d3fa srli r2,r17,15
8032cc: 12401dc4 addi r9,r2,119
8032d0: 003ee806 br 802e74 <_malloc_r+0x118>
8032d4: 00815504 movi r2,1364
8032d8: 02401f84 movi r9,126
8032dc: 10fee536 bltu r2,r3,802e74 <_malloc_r+0x118>
8032e0: 8804d4ba srli r2,r17,18
8032e4: 12401f04 addi r9,r2,124
8032e8: 003ee206 br 802e74 <_malloc_r+0x118>
8032ec: 00800504 movi r2,20
8032f0: 290016c4 addi r4,r5,91
8032f4: 117fa72e bgeu r2,r5,803194 <_malloc_r+0x438>
8032f8: 00801504 movi r2,84
8032fc: 11403a36 bltu r2,r5,8033e8 <_malloc_r+0x68c>
803300: 1804d33a srli r2,r3,12
803304: 11001b84 addi r4,r2,110
803308: 003fa206 br 803194 <_malloc_r+0x438>
80330c: 80800115 stw r2,4(r16)
803310: a8800117 ldw r2,4(r21)
803314: 00fffe04 movi r3,-8
803318: b13ffd04 addi r4,r22,-12
80331c: 20ee703a and r23,r4,r3
803320: 1080004c andi r2,r2,1
803324: 15c4b03a or r2,r2,r23
803328: a8800115 stw r2,4(r21)
80332c: adc7883a add r3,r21,r23
803330: 00800144 movi r2,5
803334: 18800215 stw r2,8(r3)
803338: 18800115 stw r2,4(r3)
80333c: 2dc02436 bltu r5,r23,8033d0 <_malloc_r+0x674>
803340: e0c00017 ldw r3,0(fp)
803344: d0a01517 ldw r2,-32684(gp)
803348: 10c0012e bgeu r2,r3,803350 <_malloc_r+0x5f4>
80334c: d0e01515 stw r3,-32684(gp)
803350: d0a01417 ldw r2,-32688(gp)
803354: 10ff722e bgeu r2,r3,803120 <_malloc_r+0x3c4>
803358: d0e01415 stw r3,-32688(gp)
80335c: 003f7006 br 803120 <_malloc_r+0x3c4>
803360: 2005d0ba srai r2,r4,2
803364: 00c00044 movi r3,1
803368: 29000117 ldw r4,4(r5)
80336c: 1886983a sll r3,r3,r2
803370: 20c8b03a or r4,r4,r3
803374: 29000115 stw r4,4(r5)
803378: 003f9606 br 8031d4 <_malloc_r+0x478>
80337c: d4201615 stw r16,-32680(gp)
803380: 003faf06 br 803240 <_malloc_r+0x4e4>
803384: 8083ffcc andi r2,r16,4095
803388: 103fa61e bne r2,zero,803224 <_malloc_r+0x4c8>
80338c: 00802034 movhi r2,128
803390: 10955004 addi r2,r2,21824
803394: 10c00217 ldw r3,8(r2)
803398: a5c9883a add r4,r20,r23
80339c: 20800054 ori r2,r4,1
8033a0: 18800115 stw r2,4(r3)
8033a4: 003fe606 br 803340 <_malloc_r+0x5e4>
8033a8: 68800117 ldw r2,4(r13)
8033ac: 01c6303a nor r3,zero,r7
8033b0: 10c4703a and r2,r2,r3
8033b4: 68800115 stw r2,4(r13)
8033b8: 003f1806 br 80301c <_malloc_r+0x2c0>
8033bc: 80800115 stw r2,4(r16)
8033c0: 003fdf06 br 803340 <_malloc_r+0x5e4>
8033c4: 0027883a mov r19,zero
8033c8: 8007883a mov r3,r16
8033cc: 003faf06 br 80328c <_malloc_r+0x530>
8033d0: a9400204 addi r5,r21,8
8033d4: 9009883a mov r4,r18
8033d8: db400015 stw r13,0(sp)
8033dc: 08037a80 call 8037a8 <_free_r>
8033e0: db400017 ldw r13,0(sp)
8033e4: 003fd606 br 803340 <_malloc_r+0x5e4>
8033e8: 00805504 movi r2,340
8033ec: 11400336 bltu r2,r5,8033fc <_malloc_r+0x6a0>
8033f0: 1804d3fa srli r2,r3,15
8033f4: 11001dc4 addi r4,r2,119
8033f8: 003f6606 br 803194 <_malloc_r+0x438>
8033fc: 00815504 movi r2,1364
803400: 01001f84 movi r4,126
803404: 117f6336 bltu r2,r5,803194 <_malloc_r+0x438>
803408: 1804d4ba srli r2,r3,18
80340c: 11001f04 addi r4,r2,124
803410: 003f6006 br 803194 <_malloc_r+0x438>
00803414 <memcmp>:
803414: 01c000c4 movi r7,3
803418: 3980032e bgeu r7,r6,803428 <memcmp+0x14>
80341c: 2144b03a or r2,r4,r5
803420: 11c4703a and r2,r2,r7
803424: 10000d26 beq r2,zero,80345c <memcmp+0x48>
803428: 31bfffc4 addi r6,r6,-1
80342c: 00bfffc4 movi r2,-1
803430: 30800826 beq r6,r2,803454 <memcmp+0x40>
803434: 100f883a mov r7,r2
803438: 20c00003 ldbu r3,0(r4)
80343c: 28800003 ldbu r2,0(r5)
803440: 31bfffc4 addi r6,r6,-1
803444: 21000044 addi r4,r4,1
803448: 29400044 addi r5,r5,1
80344c: 18800b1e bne r3,r2,80347c <memcmp+0x68>
803450: 31fff91e bne r6,r7,803438 <memcmp+0x24>
803454: 0005883a mov r2,zero
803458: f800283a ret
80345c: 20c00017 ldw r3,0(r4)
803460: 28800017 ldw r2,0(r5)
803464: 18bff01e bne r3,r2,803428 <memcmp+0x14>
803468: 31bfff04 addi r6,r6,-4
80346c: 21000104 addi r4,r4,4
803470: 29400104 addi r5,r5,4
803474: 39bff936 bltu r7,r6,80345c <memcmp+0x48>
803478: 003feb06 br 803428 <memcmp+0x14>
80347c: 1885c83a sub r2,r3,r2
803480: f800283a ret
00803484 <memcpy>:
803484: 020003c4 movi r8,15
803488: 2007883a mov r3,r4
80348c: 4180032e bgeu r8,r6,80349c <memcpy+0x18>
803490: 2904b03a or r2,r5,r4
803494: 108000cc andi r2,r2,3
803498: 10000c26 beq r2,zero,8034cc <memcpy+0x48>
80349c: 31bfffc4 addi r6,r6,-1
8034a0: 00bfffc4 movi r2,-1
8034a4: 30800726 beq r6,r2,8034c4 <memcpy+0x40>
8034a8: 100f883a mov r7,r2
8034ac: 28800003 ldbu r2,0(r5)
8034b0: 31bfffc4 addi r6,r6,-1
8034b4: 29400044 addi r5,r5,1
8034b8: 18800005 stb r2,0(r3)
8034bc: 18c00044 addi r3,r3,1
8034c0: 31fffa1e bne r6,r7,8034ac <memcpy+0x28>
8034c4: 2005883a mov r2,r4
8034c8: f800283a ret
8034cc: 200f883a mov r7,r4
8034d0: 28800017 ldw r2,0(r5)
8034d4: 29400104 addi r5,r5,4
8034d8: 31bffc04 addi r6,r6,-16
8034dc: 38800015 stw r2,0(r7)
8034e0: 28c00017 ldw r3,0(r5)
8034e4: 39c00104 addi r7,r7,4
8034e8: 29400104 addi r5,r5,4
8034ec: 38c00015 stw r3,0(r7)
8034f0: 28800017 ldw r2,0(r5)
8034f4: 39c00104 addi r7,r7,4
8034f8: 29400104 addi r5,r5,4
8034fc: 38800015 stw r2,0(r7)
803500: 28c00017 ldw r3,0(r5)
803504: 39c00104 addi r7,r7,4
803508: 29400104 addi r5,r5,4
80350c: 38c00015 stw r3,0(r7)
803510: 39c00104 addi r7,r7,4
803514: 41bfee36 bltu r8,r6,8034d0 <memcpy+0x4c>
803518: 00c000c4 movi r3,3
80351c: 1980062e bgeu r3,r6,803538 <memcpy+0xb4>
803520: 28800017 ldw r2,0(r5)
803524: 31bfff04 addi r6,r6,-4
803528: 29400104 addi r5,r5,4
80352c: 38800015 stw r2,0(r7)
803530: 39c00104 addi r7,r7,4
803534: 19bffa36 bltu r3,r6,803520 <memcpy+0x9c>
803538: 3807883a mov r3,r7
80353c: 003fd706 br 80349c <memcpy+0x18>
00803540 <memset>:
803540: 008000c4 movi r2,3
803544: 29403fcc andi r5,r5,255
803548: 2007883a mov r3,r4
80354c: 11801a2e bgeu r2,r6,8035b8 <memset+0x78>
803550: 2084703a and r2,r4,r2
803554: 1000181e bne r2,zero,8035b8 <memset+0x78>
803558: 2806923a slli r3,r5,8
80355c: 200f883a mov r7,r4
803560: 1946b03a or r3,r3,r5
803564: 1804943a slli r2,r3,16
803568: 1886b03a or r3,r3,r2
80356c: 008003c4 movi r2,15
803570: 11800a2e bgeu r2,r6,80359c <memset+0x5c>
803574: 38c00015 stw r3,0(r7)
803578: 39c00104 addi r7,r7,4
80357c: 38c00015 stw r3,0(r7)
803580: 39c00104 addi r7,r7,4
803584: 38c00015 stw r3,0(r7)
803588: 39c00104 addi r7,r7,4
80358c: 38c00015 stw r3,0(r7)
803590: 31bffc04 addi r6,r6,-16
803594: 39c00104 addi r7,r7,4
803598: 11bff636 bltu r2,r6,803574 <memset+0x34>
80359c: 008000c4 movi r2,3
8035a0: 1180042e bgeu r2,r6,8035b4 <memset+0x74>
8035a4: 38c00015 stw r3,0(r7)
8035a8: 31bfff04 addi r6,r6,-4
8035ac: 39c00104 addi r7,r7,4
8035b0: 11bffc36 bltu r2,r6,8035a4 <memset+0x64>
8035b4: 3807883a mov r3,r7
8035b8: 31bfffc4 addi r6,r6,-1
8035bc: 00bfffc4 movi r2,-1
8035c0: 30800426 beq r6,r2,8035d4 <memset+0x94>
8035c4: 19400005 stb r5,0(r3)
8035c8: 31bfffc4 addi r6,r6,-1
8035cc: 18c00044 addi r3,r3,1
8035d0: 30bffc1e bne r6,r2,8035c4 <memset+0x84>
8035d4: 2005883a mov r2,r4
8035d8: f800283a ret
008035dc <_sbrk_r>:
8035dc: defffe04 addi sp,sp,-8
8035e0: dc000015 stw r16,0(sp)
8035e4: 2021883a mov r16,r4
8035e8: 2809883a mov r4,r5
8035ec: dfc00115 stw ra,4(sp)
8035f0: d0201b15 stw zero,-32660(gp)
8035f4: 0803c040 call 803c04 <sbrk>
8035f8: 1007883a mov r3,r2
8035fc: 00bfffc4 movi r2,-1
803600: 18800526 beq r3,r2,803618 <_sbrk_r+0x3c>
803604: 1805883a mov r2,r3
803608: dfc00117 ldw ra,4(sp)
80360c: dc000017 ldw r16,0(sp)
803610: dec00204 addi sp,sp,8
803614: f800283a ret
803618: d0a01b17 ldw r2,-32660(gp)
80361c: 103ff926 beq r2,zero,803604 <_sbrk_r+0x28>
803620: 80800015 stw r2,0(r16)
803624: 003ff706 br 803604 <_sbrk_r+0x28>
00803628 <strlen>:
803628: 208000cc andi r2,r4,3
80362c: 200f883a mov r7,r4
803630: 1000101e bne r2,zero,803674 <strlen+0x4c>
803634: 20800017 ldw r2,0(r4)
803638: 01bfbff4 movhi r6,65279
80363c: 31bfbfc4 addi r6,r6,-257
803640: 01602074 movhi r5,32897
803644: 29602004 addi r5,r5,-32640
803648: 00000206 br 803654 <strlen+0x2c>
80364c: 21000104 addi r4,r4,4
803650: 20800017 ldw r2,0(r4)
803654: 0086303a nor r3,zero,r2
803658: 1185883a add r2,r2,r6
80365c: 10c4703a and r2,r2,r3
803660: 1144703a and r2,r2,r5
803664: 103ff926 beq r2,zero,80364c <strlen+0x24>
803668: 20800007 ldb r2,0(r4)
80366c: 10000326 beq r2,zero,80367c <strlen+0x54>
803670: 21000044 addi r4,r4,1
803674: 20800007 ldb r2,0(r4)
803678: 103ffd1e bne r2,zero,803670 <strlen+0x48>
80367c: 21c5c83a sub r2,r4,r7
803680: f800283a ret
00803684 <_malloc_trim_r>:
803684: defffb04 addi sp,sp,-20
803688: dcc00015 stw r19,0(sp)
80368c: 04c02034 movhi r19,128
803690: 9cd55004 addi r19,r19,21824
803694: dc000315 stw r16,12(sp)
803698: dc400215 stw r17,8(sp)
80369c: dc800115 stw r18,4(sp)
8036a0: 2823883a mov r17,r5
8036a4: 2021883a mov r16,r4
8036a8: dfc00415 stw ra,16(sp)
8036ac: 0803bcc0 call 803bcc <__malloc_lock>
8036b0: 98800217 ldw r2,8(r19)
8036b4: 8009883a mov r4,r16
8036b8: 000b883a mov r5,zero
8036bc: 10c00117 ldw r3,4(r2)
8036c0: 00bfff04 movi r2,-4
8036c4: 18a4703a and r18,r3,r2
8036c8: 9463c83a sub r17,r18,r17
8036cc: 8c43fbc4 addi r17,r17,4079
8036d0: 8822d33a srli r17,r17,12
8036d4: 00840004 movi r2,4096
8036d8: 8c7fffc4 addi r17,r17,-1
8036dc: 8822933a slli r17,r17,12
8036e0: 88800616 blt r17,r2,8036fc <_malloc_trim_r+0x78>
8036e4: 08035dc0 call 8035dc <_sbrk_r>
8036e8: 98c00217 ldw r3,8(r19)
8036ec: 8009883a mov r4,r16
8036f0: 044bc83a sub r5,zero,r17
8036f4: 1c87883a add r3,r3,r18
8036f8: 18800926 beq r3,r2,803720 <_malloc_trim_r+0x9c>
8036fc: 0803be80 call 803be8 <__malloc_unlock>
803700: 0005883a mov r2,zero
803704: dfc00417 ldw ra,16(sp)
803708: dc000317 ldw r16,12(sp)
80370c: dc400217 ldw r17,8(sp)
803710: dc800117 ldw r18,4(sp)
803714: dcc00017 ldw r19,0(sp)
803718: dec00504 addi sp,sp,20
80371c: f800283a ret
803720: 8009883a mov r4,r16
803724: 08035dc0 call 8035dc <_sbrk_r>
803728: 944dc83a sub r6,r18,r17
80372c: 00ffffc4 movi r3,-1
803730: 8009883a mov r4,r16
803734: 000b883a mov r5,zero
803738: 01c02034 movhi r7,128
80373c: 39d54604 addi r7,r7,21784
803740: 31800054 ori r6,r6,1
803744: 10c00926 beq r2,r3,80376c <_malloc_trim_r+0xe8>
803748: 38800017 ldw r2,0(r7)
80374c: 98c00217 ldw r3,8(r19)
803750: 8009883a mov r4,r16
803754: 1445c83a sub r2,r2,r17
803758: 38800015 stw r2,0(r7)
80375c: 19800115 stw r6,4(r3)
803760: 0803be80 call 803be8 <__malloc_unlock>
803764: 00800044 movi r2,1
803768: 003fe606 br 803704 <_malloc_trim_r+0x80>
80376c: 08035dc0 call 8035dc <_sbrk_r>
803770: 99400217 ldw r5,8(r19)
803774: 100d883a mov r6,r2
803778: 8009883a mov r4,r16
80377c: 1165c83a sub r18,r2,r5
803780: 008003c4 movi r2,15
803784: 90c00054 ori r3,r18,1
803788: 14bfdc0e bge r2,r18,8036fc <_malloc_trim_r+0x78>
80378c: 28c00115 stw r3,4(r5)
803790: d0e01617 ldw r3,-32680(gp)
803794: 00802034 movhi r2,128
803798: 10954604 addi r2,r2,21784
80379c: 30c7c83a sub r3,r6,r3
8037a0: 10c00015 stw r3,0(r2)
8037a4: 003fd506 br 8036fc <_malloc_trim_r+0x78>
008037a8 <_free_r>:
8037a8: defffd04 addi sp,sp,-12
8037ac: dc000115 stw r16,4(sp)
8037b0: dc400015 stw r17,0(sp)
8037b4: dfc00215 stw ra,8(sp)
8037b8: 2821883a mov r16,r5
8037bc: 2023883a mov r17,r4
8037c0: 28003226 beq r5,zero,80388c <_free_r+0xe4>
8037c4: 0803bcc0 call 803bcc <__malloc_lock>
8037c8: 82bffe04 addi r10,r16,-8
8037cc: 51400117 ldw r5,4(r10)
8037d0: 00bfff84 movi r2,-2
8037d4: 03002034 movhi r12,128
8037d8: 63155004 addi r12,r12,21824
8037dc: 2892703a and r9,r5,r2
8037e0: 524d883a add r6,r10,r9
8037e4: 30c00117 ldw r3,4(r6)
8037e8: 61000217 ldw r4,8(r12)
8037ec: 00bfff04 movi r2,-4
8037f0: 1896703a and r11,r3,r2
8037f4: 21804e26 beq r4,r6,803930 <_free_r+0x188>
8037f8: 2880004c andi r2,r5,1
8037fc: 32c00115 stw r11,4(r6)
803800: 000b883a mov r5,zero
803804: 1000091e bne r2,zero,80382c <_free_r+0x84>
803808: 50c00017 ldw r3,0(r10)
80380c: 60800204 addi r2,r12,8
803810: 50d5c83a sub r10,r10,r3
803814: 51000217 ldw r4,8(r10)
803818: 48d3883a add r9,r9,r3
80381c: 20807426 beq r4,r2,8039f0 <_free_r+0x248>
803820: 52000317 ldw r8,12(r10)
803824: 41000215 stw r4,8(r8)
803828: 22000315 stw r8,12(r4)
80382c: 32c7883a add r3,r6,r11
803830: 18800117 ldw r2,4(r3)
803834: 2808c03a cmpne r4,r5,zero
803838: 1080004c andi r2,r2,1
80383c: 1000061e bne r2,zero,803858 <_free_r+0xb0>
803840: 4ad3883a add r9,r9,r11
803844: 20001626 beq r4,zero,8038a0 <_free_r+0xf8>
803848: 30c00217 ldw r3,8(r6)
80384c: 32000317 ldw r8,12(r6)
803850: 40c00215 stw r3,8(r8)
803854: 1a000315 stw r8,12(r3)
803858: 48800054 ori r2,r9,1
80385c: 5247883a add r3,r10,r9
803860: 50800115 stw r2,4(r10)
803864: 1a400015 stw r9,0(r3)
803868: 20001726 beq r4,zero,8038c8 <_free_r+0x120>
80386c: 8809883a mov r4,r17
803870: 02002034 movhi r8,128
803874: 420efa04 addi r8,r8,15336
803878: dfc00217 ldw ra,8(sp)
80387c: dc000117 ldw r16,4(sp)
803880: dc400017 ldw r17,0(sp)
803884: dec00304 addi sp,sp,12
803888: 4000683a jmp r8
80388c: dfc00217 ldw ra,8(sp)
803890: dc000117 ldw r16,4(sp)
803894: dc400017 ldw r17,0(sp)
803898: dec00304 addi sp,sp,12
80389c: f800283a ret
8038a0: 30c00217 ldw r3,8(r6)
8038a4: 00802034 movhi r2,128
8038a8: 10955204 addi r2,r2,21832
8038ac: 18bfe71e bne r3,r2,80384c <_free_r+0xa4>
8038b0: 1a800315 stw r10,12(r3)
8038b4: 1a800215 stw r10,8(r3)
8038b8: 01000044 movi r4,1
8038bc: 50c00215 stw r3,8(r10)
8038c0: 50c00315 stw r3,12(r10)
8038c4: 003fe406 br 803858 <_free_r+0xb0>
8038c8: 00807fc4 movi r2,511
8038cc: 12402b36 bltu r2,r9,80397c <_free_r+0x1d4>
8038d0: 4806d0fa srli r3,r9,3
8038d4: 01802034 movhi r6,128
8038d8: 31955004 addi r6,r6,21824
8038dc: 00800044 movi r2,1
8038e0: 180890fa slli r4,r3,3
8038e4: 1807d0ba srai r3,r3,2
8038e8: 31400117 ldw r5,4(r6)
8038ec: 2191883a add r8,r4,r6
8038f0: 41c00217 ldw r7,8(r8)
8038f4: 10c4983a sll r2,r2,r3
8038f8: 52000315 stw r8,12(r10)
8038fc: 51c00215 stw r7,8(r10)
803900: 288ab03a or r5,r5,r2
803904: 3a800315 stw r10,12(r7)
803908: 31400115 stw r5,4(r6)
80390c: 42800215 stw r10,8(r8)
803910: 8809883a mov r4,r17
803914: 02002034 movhi r8,128
803918: 420efa04 addi r8,r8,15336
80391c: dfc00217 ldw ra,8(sp)
803920: dc000117 ldw r16,4(sp)
803924: dc400017 ldw r17,0(sp)
803928: dec00304 addi sp,sp,12
80392c: 4000683a jmp r8
803930: 2880004c andi r2,r5,1
803934: 4ad3883a add r9,r9,r11
803938: 1000071e bne r2,zero,803958 <_free_r+0x1b0>
80393c: 50c00017 ldw r3,0(r10)
803940: 50d5c83a sub r10,r10,r3
803944: 52000317 ldw r8,12(r10)
803948: 51c00217 ldw r7,8(r10)
80394c: 48d3883a add r9,r9,r3
803950: 41c00215 stw r7,8(r8)
803954: 3a000315 stw r8,12(r7)
803958: d0a01817 ldw r2,-32672(gp)
80395c: 48c00054 ori r3,r9,1
803960: 62800215 stw r10,8(r12)
803964: 50c00115 stw r3,4(r10)
803968: 48bfc036 bltu r9,r2,80386c <_free_r+0xc4>
80396c: d1601717 ldw r5,-32676(gp)
803970: 8809883a mov r4,r17
803974: 08036840 call 803684 <_malloc_trim_r>
803978: 003fbc06 br 80386c <_free_r+0xc4>
80397c: 4808d27a srli r4,r9,9
803980: 4806d0fa srli r3,r9,3
803984: 2000151e bne r4,zero,8039dc <_free_r+0x234>
803988: 180490fa slli r2,r3,3
80398c: 01402034 movhi r5,128
803990: 29555004 addi r5,r5,21824
803994: 1311883a add r8,r2,r12
803998: 41c00217 ldw r7,8(r8)
80399c: 3a001e26 beq r7,r8,803a18 <_free_r+0x270>
8039a0: 38800117 ldw r2,4(r7)
8039a4: 00ffff04 movi r3,-4
8039a8: 10c4703a and r2,r2,r3
8039ac: 4880052e bgeu r9,r2,8039c4 <_free_r+0x21c>
8039b0: 39c00217 ldw r7,8(r7)
8039b4: 3a000326 beq r7,r8,8039c4 <_free_r+0x21c>
8039b8: 38800117 ldw r2,4(r7)
8039bc: 10c4703a and r2,r2,r3
8039c0: 48bffb36 bltu r9,r2,8039b0 <_free_r+0x208>
8039c4: 3a000317 ldw r8,12(r7)
8039c8: 52000315 stw r8,12(r10)
8039cc: 51c00215 stw r7,8(r10)
8039d0: 3a800315 stw r10,12(r7)
8039d4: 42800215 stw r10,8(r8)
8039d8: 003fcd06 br 803910 <_free_r+0x168>
8039dc: 00800104 movi r2,4
8039e0: 11000536 bltu r2,r4,8039f8 <_free_r+0x250>
8039e4: 4804d1ba srli r2,r9,6
8039e8: 10c00e04 addi r3,r2,56
8039ec: 003fe606 br 803988 <_free_r+0x1e0>
8039f0: 01400044 movi r5,1
8039f4: 003f8d06 br 80382c <_free_r+0x84>
8039f8: 00800504 movi r2,20
8039fc: 20c016c4 addi r3,r4,91
803a00: 113fe12e bgeu r2,r4,803988 <_free_r+0x1e0>
803a04: 00801504 movi r2,84
803a08: 11000a36 bltu r2,r4,803a34 <_free_r+0x28c>
803a0c: 4804d33a srli r2,r9,12
803a10: 10c01b84 addi r3,r2,110
803a14: 003fdc06 br 803988 <_free_r+0x1e0>
803a18: 1805d0ba srai r2,r3,2
803a1c: 00c00044 movi r3,1
803a20: 29000117 ldw r4,4(r5)
803a24: 1886983a sll r3,r3,r2
803a28: 20c8b03a or r4,r4,r3
803a2c: 29000115 stw r4,4(r5)
803a30: 003fe506 br 8039c8 <_free_r+0x220>
803a34: 00805504 movi r2,340
803a38: 11000336 bltu r2,r4,803a48 <_free_r+0x2a0>
803a3c: 4804d3fa srli r2,r9,15
803a40: 10c01dc4 addi r3,r2,119
803a44: 003fd006 br 803988 <_free_r+0x1e0>
803a48: 00815504 movi r2,1364
803a4c: 00c01f84 movi r3,126
803a50: 113fcd36 bltu r2,r4,803988 <_free_r+0x1e0>
803a54: 4804d4ba srli r2,r9,18
803a58: 10c01f04 addi r3,r2,124
803a5c: 003fca06 br 803988 <_free_r+0x1e0>
00803a60 <udivmodsi4>:
803a60: 00800044 movi r2,1
803a64: 000f883a mov r7,zero
803a68: 2900082e bgeu r5,r4,803a8c <udivmodsi4+0x2c>
803a6c: 28000716 blt r5,zero,803a8c <udivmodsi4+0x2c>
803a70: 294b883a add r5,r5,r5
803a74: 1085883a add r2,r2,r2
803a78: 29000e2e bgeu r5,r4,803ab4 <udivmodsi4+0x54>
803a7c: 1007003a cmpeq r3,r2,zero
803a80: 1800081e bne r3,zero,803aa4 <udivmodsi4+0x44>
803a84: 283ffa0e bge r5,zero,803a70 <udivmodsi4+0x10>
803a88: 1800061e bne r3,zero,803aa4 <udivmodsi4+0x44>
803a8c: 21400236 bltu r4,r5,803a98 <udivmodsi4+0x38>
803a90: 2149c83a sub r4,r4,r5
803a94: 388eb03a or r7,r7,r2
803a98: 1004d07a srli r2,r2,1
803a9c: 280ad07a srli r5,r5,1
803aa0: 103ffa1e bne r2,zero,803a8c <udivmodsi4+0x2c>
803aa4: 3000011e bne r6,zero,803aac <udivmodsi4+0x4c>
803aa8: 3809883a mov r4,r7
803aac: 2005883a mov r2,r4
803ab0: f800283a ret
803ab4: 1007003a cmpeq r3,r2,zero
803ab8: 183ff426 beq r3,zero,803a8c <udivmodsi4+0x2c>
803abc: 003ff906 br 803aa4 <udivmodsi4+0x44>
00803ac0 <__divsi3>:
803ac0: defffe04 addi sp,sp,-8
803ac4: dc000015 stw r16,0(sp)
803ac8: dfc00115 stw ra,4(sp)
803acc: 000d883a mov r6,zero
803ad0: 0021883a mov r16,zero
803ad4: 20000816 blt r4,zero,803af8 <__divsi3+0x38>
803ad8: 28000a16 blt r5,zero,803b04 <__divsi3+0x44>
803adc: 0803a600 call 803a60 <udivmodsi4>
803ae0: 80000126 beq r16,zero,803ae8 <__divsi3+0x28>
803ae4: 0085c83a sub r2,zero,r2
803ae8: dfc00117 ldw ra,4(sp)
803aec: dc000017 ldw r16,0(sp)
803af0: dec00204 addi sp,sp,8
803af4: f800283a ret
803af8: 0109c83a sub r4,zero,r4
803afc: 0021003a cmpeq r16,zero,zero
803b00: 283ff60e bge r5,zero,803adc <__divsi3+0x1c>
803b04: 014bc83a sub r5,zero,r5
803b08: 8021003a cmpeq r16,r16,zero
803b0c: 003ff306 br 803adc <__divsi3+0x1c>
00803b10 <__modsi3>:
803b10: defffe04 addi sp,sp,-8
803b14: dc000015 stw r16,0(sp)
803b18: dfc00115 stw ra,4(sp)
803b1c: 01800044 movi r6,1
803b20: 0021883a mov r16,zero
803b24: 20000816 blt r4,zero,803b48 <__modsi3+0x38>
803b28: 28000a16 blt r5,zero,803b54 <__modsi3+0x44>
803b2c: 0803a600 call 803a60 <udivmodsi4>
803b30: 80000126 beq r16,zero,803b38 <__modsi3+0x28>
803b34: 0085c83a sub r2,zero,r2
803b38: dfc00117 ldw ra,4(sp)
803b3c: dc000017 ldw r16,0(sp)
803b40: dec00204 addi sp,sp,8
803b44: f800283a ret
803b48: 0109c83a sub r4,zero,r4
803b4c: 3021883a mov r16,r6
803b50: 283ff60e bge r5,zero,803b2c <__modsi3+0x1c>
803b54: 014bc83a sub r5,zero,r5
803b58: 003ff406 br 803b2c <__modsi3+0x1c>
00803b5c <__udivsi3>:
803b5c: 000d883a mov r6,zero
803b60: 02002034 movhi r8,128
803b64: 420e9804 addi r8,r8,14944
803b68: 4000683a jmp r8
00803b6c <__umodsi3>:
803b6c: 01800044 movi r6,1
803b70: 02002034 movhi r8,128
803b74: 420e9804 addi r8,r8,14944
803b78: 4000683a jmp r8
00803b7c <alt_sim_halt>:
#endif
static ALT_ALWAYS_INLINE void alt_sim_halt(int exit_code)
{
803b7c: defffd04 addi sp,sp,-12
803b80: df000215 stw fp,8(sp)
803b84: d839883a mov fp,sp
803b88: e1000015 stw r4,0(fp)
int r2 = exit_code;
803b8c: e0800017 ldw r2,0(fp)
803b90: e0800115 stw r2,4(fp)
#if defined(NIOS2_HAS_DEBUG_STUB) && (defined(ALT_BREAK_ON_EXIT) || defined(ALT_PROVIDE_GMON))
int r3 = (1 << 2);
#ifdef ALT_PROVIDE_GMON
extern unsigned int alt_gmon_data[];
int r4 = (int)alt_gmon_data;
r3 |= (1 << 4);
usleep(100000);
#define ALT_GMON_DATA ,"D04"(r4)
#else
#define ALT_GMON_DATA
#endif
__asm__ volatile ("wrctl ctl6, %0" : : "r"(1), "D02"(r2) );
__asm__ volatile ("\n0:\n\taddi %0,%0, -1\n\tbgt %0,zero,0b" : : "r" (ALT_CPU_FREQ/100) ); /* Delay for >30ms */
__asm__ volatile ("break 2" : : "D02"(r2), "D03"(r3) ALT_GMON_DATA );
#else
__asm__ volatile ("wrctl ctl6, %0" : : "r"(1), "D02"(r2) );
803b94: 00c00044 movi r3,1
803b98: e0800117 ldw r2,4(fp)
803b9c: 180171ba wrctl ctl6,r3
#endif
}
803ba0: df000217 ldw fp,8(sp)
803ba4: dec00304 addi sp,sp,12
803ba8: f800283a ret
00803bac <_exit>:
* ALT_EXIT is mapped onto the _exit() system call in alt_syscall.h
*/
void ALT_EXIT (int exit_code)
{
803bac: defffd04 addi sp,sp,-12
803bb0: dfc00215 stw ra,8(sp)
803bb4: df000115 stw fp,4(sp)
803bb8: d839883a mov fp,sp
803bbc: e1000015 stw r4,0(fp)
/* ALT_LOG - please see HAL/inc/alt_log_printf.h for details */
ALT_LOG_PRINT_BOOT("[alt_exit.c] Entering _exit() function.\r\n");
ALT_LOG_PRINT_BOOT("[alt_exit.c] Exit code from main was %d.\r\n",exit_code);
/* Stop all other threads */
ALT_LOG_PRINT_BOOT("[alt_exit.c] Calling ALT_OS_STOP().\r\n");
ALT_OS_STOP();
/* Provide notification to the simulator that we've stopped */
ALT_LOG_PRINT_BOOT("[alt_exit.c] Calling ALT_SIM_HALT().\r\n");
ALT_SIM_HALT(exit_code);
803bc0: e1000017 ldw r4,0(fp)
803bc4: 0803b7c0 call 803b7c <alt_sim_halt>
/* spin forever, since there's no where to go back to */
ALT_LOG_PRINT_BOOT("[alt_exit.c] Spinning forever.\r\n");
while (1);
803bc8: 003fff06 br 803bc8 <_exit+0x1c>
00803bcc <__malloc_lock>:
* this requires that malloc is never called by an interrupt service routine.
*/
void __malloc_lock ( struct _reent *_r )
{
803bcc: defffe04 addi sp,sp,-8
803bd0: df000115 stw fp,4(sp)
803bd4: d839883a mov fp,sp
803bd8: e1000015 stw r4,0(fp)
803bdc: df000117 ldw fp,4(sp)
803be0: dec00204 addi sp,sp,8
803be4: f800283a ret
00803be8 <__malloc_unlock>:
}
/*
*
*/
void __malloc_unlock ( struct _reent *_r )
{
803be8: defffe04 addi sp,sp,-8
803bec: df000115 stw fp,4(sp)
803bf0: d839883a mov fp,sp
803bf4: e1000015 stw r4,0(fp)
803bf8: df000117 ldw fp,4(sp)
803bfc: dec00204 addi sp,sp,8
803c00: f800283a ret
00803c04 <sbrk>:
caddr_t ALT_SBRK (int incr) __attribute__ ((no_instrument_function ));
caddr_t ALT_SBRK (int incr)
{
803c04: defff904 addi sp,sp,-28
803c08: df000615 stw fp,24(sp)
803c0c: d839883a mov fp,sp
803c10: e1000015 stw r4,0(fp)
alt_irq_disable_all (void)
{
alt_irq_context context;
NIOS2_READ_STATUS (context);
803c14: 0005303a rdctl r2,status
803c18: e0800415 stw r2,16(fp)
NIOS2_WRITE_STATUS (0);
803c1c: 0001703a wrctl status,zero
803c20: e0800417 ldw r2,16(fp)
803c24: e0800315 stw r2,12(fp)
803c28: e0800317 ldw r2,12(fp)
803c2c: e0800115 stw r2,4(fp)
alt_irq_context context;
char *prev_heap_end;
context = alt_irq_disable_all();
/* Always return data aligned on a word boundary */
heap_end = (char *)(((unsigned int)heap_end + 3) & ~3);
803c30: d0a01917 ldw r2,-32668(gp)
803c34: 10c000c4 addi r3,r2,3
803c38: 00bfff04 movi r2,-4
803c3c: 1884703a and r2,r3,r2
803c40: d0a01915 stw r2,-32668(gp)
#ifdef ALT_MAX_HEAP_BYTES
/*
* User specified a maximum heap size. Return -1 if it would
* be exceeded by this sbrk call.
*/
if (((heap_end + incr) - __alt_heap_start) > ALT_MAX_HEAP_BYTES) {
alt_irq_enable_all(context);
return (caddr_t)-1;
}
#else
if ((heap_end + incr) > __alt_heap_limit) {
803c44: d0e01917 ldw r3,-32668(gp)
803c48: e0800017 ldw r2,0(fp)
803c4c: 1887883a add r3,r3,r2
803c50: 00804034 movhi r2,256
803c54: 10800004 addi r2,r2,0
803c58: 10c0072e bgeu r2,r3,803c78 <sbrk+0x74>
*/
static ALT_INLINE void ALT_ALWAYS_INLINE
alt_irq_enable_all (alt_irq_context context)
{
803c5c: e0800117 ldw r2,4(fp)
803c60: e0800415 stw r2,16(fp)
NIOS2_WRITE_STATUS (context);
803c64: e0800417 ldw r2,16(fp)
803c68: 1001703a wrctl status,r2
alt_irq_enable_all(context);
return (caddr_t)-1;
803c6c: 00bfffc4 movi r2,-1
803c70: e0800515 stw r2,20(fp)
803c74: 00000c06 br 803ca8 <sbrk+0xa4>
}
#endif
prev_heap_end = heap_end;
803c78: d0a01917 ldw r2,-32668(gp)
803c7c: e0800215 stw r2,8(fp)
heap_end += incr;
803c80: d0e01917 ldw r3,-32668(gp)
803c84: e0800017 ldw r2,0(fp)
803c88: 1885883a add r2,r3,r2
803c8c: d0a01915 stw r2,-32668(gp)
*/
static ALT_INLINE void ALT_ALWAYS_INLINE
alt_irq_enable_all (alt_irq_context context)
{
803c90: e0800117 ldw r2,4(fp)
803c94: e0800415 stw r2,16(fp)
NIOS2_WRITE_STATUS (context);
803c98: e0800417 ldw r2,16(fp)
803c9c: 1001703a wrctl status,r2
#ifdef ALT_STACK_CHECK
/*
* If the stack and heap are contiguous then extending the heap reduces the
* space available for the stack. If we are still using the default stack
* then adjust the stack limit to note this, while checking for stack
* pointer overflow.
* If the stack limit isn't pointing at the top of the heap then the code
* is using a different stack so none of this needs to be done.
*/
if (alt_stack_limit() == prev_heap_end)
{
if (alt_stack_pointer() <= heap_end)
alt_report_stack_overflow();
alt_set_stack_limit(heap_end);
}
#ifdef ALT_EXCEPTION_STACK
/*
* If we are executing from the exception stack then compare against the
* stack we switched away from as well. The exception stack is a fixed
* size so doesn't need to be checked.
*/
if (alt_exception_old_stack_limit == prev_heap_end)
{
if (alt_exception_old_stack_limit <= heap_end)
alt_report_stack_overflow();
alt_exception_old_stack_limit = heap_end;
}
#endif
#endif
alt_irq_enable_all(context);
return (caddr_t) prev_heap_end;
803ca0: e0800217 ldw r2,8(fp)
803ca4: e0800515 stw r2,20(fp)
}
803ca8: e0800517 ldw r2,20(fp)
803cac: df000617 ldw fp,24(sp)
803cb0: dec00704 addi sp,sp,28
803cb4: f800283a ret
Maintained by John Loomis, last updated 13 November 2008