home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.2 / LINUX-1.2 / LINUX-1 / linux / arch / mips / kernel / entry.S < prev    next >
Encoding:
Text File  |  1995-01-25  |  18.8 KB  |  974 lines

  1. /*
  2.  * arch/mips/kernel/entry.S
  3.  *
  4.  * Copyright (C) 1994, 1995 Waldorf Electronics
  5.  * written by Ralf Baechle
  6.  */
  7.  
  8. /*
  9.  * entry.S contains the system-call and fault low-level handling routines.
  10.  * This also contains the timer-interrupt handler, as well as all interrupts
  11.  * and faults that can result in a task-switch.
  12.  */
  13.  
  14. #include <linux/sys.h>
  15. #include <linux/autoconf.h>
  16. #include <asm/segment.h>
  17. #include <asm/mipsregs.h>
  18. #include <asm/mipsconfig.h>
  19. #include <asm/page.h>
  20. #include <asm/stackframe.h>
  21. #include <asm/regdef.h>
  22. #include <asm/processor.h>
  23.  
  24. /*
  25.  * These are offsets into the task-struct.
  26.  */
  27. state        =  0
  28. counter        =  4
  29. priority    =  8
  30. signal        = 12
  31. blocked        = 16
  32. flags        = 20
  33. errno        = 24            #/* MIPS OK */
  34. exec_domain    = 60            #/* ??? */
  35.  
  36. ENOSYS        = 38
  37.  
  38.         .globl    ret_from_sys_call
  39.         .globl    _sys_call_table
  40.  
  41.         .text
  42.         .set    noreorder
  43.         .align 4
  44. handle_bottom_half:
  45.         /*
  46.          * If your assembler breaks on the next line it's
  47.          * time to update!
  48.          */
  49.         lui    s0,%hi(_intr_count)
  50.         lw    s1,%lo(_intr_count)(s0)
  51.         mfc0    s3,CP0_STATUS            # Enable IRQs
  52.         addiu    s2,s1,1
  53.         sw    s2,%lo(_intr_count)(s0)
  54.         ori    t0,s3,0x1f
  55.         xori    t0,t0,0x1e
  56.         jal    _do_bottom_half
  57.         mtc0    t0,CP0_STATUS            # delay slot
  58.         mtc0    s3,CP0_STATUS            # Restore old IRQ state
  59.         j    9f
  60.         sw    s1,%lo(_intr_count)(s0)        # delay slot
  61.  
  62.         .set    reorder
  63. reschedule:
  64.         la    ra,ret_from_sys_call
  65.         j    _schedule
  66.         nop
  67.  
  68.         .align    5
  69.         .globl    _handle_sys
  70. _handle_sys:
  71.         .set    noreorder
  72.         .set    noat
  73.         SAVE_ALL
  74.         .set    at
  75.         STI
  76.         /*
  77.          * Compute return address. For now we assume that syscalls never
  78.          * appear in branch delay slots. For the Linux/MIPS standard
  79.          * libraries this assumption is always try.
  80.          */
  81.         lw    t3,FR_EPC(sp)
  82.         lw    s1,FR_REG2(sp)
  83.         li    t0,-ENOSYS
  84.         addiu    t3,t3,4
  85.         sw    t3,FR_EPC(sp)
  86.         li    t2,NR_syscalls
  87.         bge    s1,t2,ret_from_sys_call
  88.         sw    t0,FR_REG2(sp)        # delay slot
  89.         sll    s1,s1,2
  90.         lw    s1,_sys_call_table(s1)
  91.         lw    s0,_current
  92.  
  93.         beqz    s1,ret_from_sys_call
  94.         lw    t0,flags(s0)
  95.         sll    t0,t0,2            # PF_TRACESYS
  96.         bltz    t0,1f
  97.         sw    zero,errno(s0)        # delay slot
  98.  
  99.         lw    a0,FR_REG4(sp)
  100.         lw    a1,FR_REG5(sp)
  101.         lw    a2,FR_REG6(sp)
  102.         lw    a3,FR_REG7(sp)
  103.         lw    t0,FR_REG3(sp)
  104.         jalr    s1            # do the real work
  105.         sw    t0,16(sp)        # delay slot
  106.  
  107.         lw    t0,errno(s0)
  108.         sw    v0,FR_REG2(sp)        # save the return value
  109.         subu    t0,zero,t0        # t0 = -t0
  110.         beqz    t0,ret_from_sys_call
  111.         nop
  112.         /*
  113.          * Fixme: should set error flag
  114.          */
  115.         j    ret_from_sys_call
  116.         sw    t0,FR_REG2(sp)        # delay slot
  117.  
  118.         .align    4
  119. 1:        jal    _syscall_trace
  120.         nop                # delay slot
  121.  
  122.         lw    a0,FR_REG4(sp)
  123.         lw    a1,FR_REG5(sp)
  124.         lw    a2,FR_REG6(sp)
  125.         lw    a3,FR_REG7(sp)
  126.         lw    t0,FR_REG3(sp)
  127.         jalr    s1            # do the real work
  128.         sw    t0,16(sp)        # delay slot
  129.  
  130.         lw    t0,errno(s0)
  131.         sw    v0,FR_REG2(sp)        # save the return value
  132.         subu    t0,zero,t0
  133.         beqz    t0,1f
  134.         nop                # delay slot
  135.         sw    t1,FR_REG2(sp)
  136.         /*
  137.          * Fixme: should set error flag
  138.          */
  139. 1:        jal    _syscall_trace
  140.         nop
  141.  
  142.         .align    4
  143. ret_from_sys_call:
  144.         lw    t0,_intr_count        # bottom half
  145.         bnez    t0,2f
  146. 9:
  147.         lw    t0,_bh_mask        # delay slot
  148.         lw    t1,_bh_active        # unused delay slot
  149.         and    t0,t1
  150.         bnez    t0,handle_bottom_half
  151.  
  152.         lw    t0,FR_STATUS(sp)    # returning to supervisor ?
  153.         andi    t1,t0,0x10
  154.         beqz    t1,2f
  155.  
  156.         mfc0    t0,CP0_STATUS        # delay slot
  157.         lw    t1,_need_resched
  158.         ori    t0,0x1f            # enable irqs
  159.         xori    t0,0x1e
  160.         bnez    t1,reschedule
  161.         mtc0    t0,CP0_STATUS        # delay slot
  162.  
  163.         lw    s0,_current
  164.         lw    t0,_task
  165.         lw    t1,state(s0)        # state
  166.         beq    s0,t0,2f        # task[0] cannot have signals
  167.         lw    t0,counter(s0)        # counter
  168.         bnez    t1,reschedule        # state == 0 ?
  169.         lw    a0,blocked(s0)
  170.                         # save blocked in a0 for
  171.                         # signal handling
  172.         beqz    t0,reschedule        # counter == 0 ?
  173.         lw    t0,signal(s0)
  174.         nor    t1,zero,a0
  175.         and    t1,t0,t1
  176.         beqz    t1,skip_signal_return
  177.         nop
  178.  
  179.         jal    _do_signal
  180.         move    a1,sp            # delay slot
  181.         
  182. skip_signal_return:
  183.         .set    noreorder
  184.         .set    noat
  185. 2:
  186. return:        RESTORE_ALL
  187.         .set    at
  188.  
  189. #ifdef CONFIG_DESKSTATION_TYNE
  190. /*
  191.  * Deskstation Tyne interrupt handler
  192.  */
  193.         .text
  194.         .set    noreorder
  195.         .set    noat
  196.         .globl    _deskstation_tyne_handle_int
  197.         .align    5
  198. _deskstation_tyne_handle_int:
  199.         SAVE_ALL
  200.         .set    at
  201.         CLI
  202.         lui    s0,%hi(PORT_BASE)
  203.         li    t1,0x0f
  204.         sb    t1,%lo(PORT_BASE+0x20)(s0)    # poll command
  205.         lb    t1,%lo(PORT_BASE+0x20)(s0)    # read result
  206.         li    s1,1
  207.         bgtz    t1,Lpoll_second
  208.         andi    t1,t1,7
  209.         /*
  210.          * Acknowledge first pic
  211.          */
  212.         lb    t2,%lo(PORT_BASE+0x21)(s0)
  213.         lui    s4,%hi(_cache_21)
  214.         lb    t0,%lo(_cache_21)(s4)
  215.         sllv    s1,s1,t1
  216.         or    t0,t0,s1
  217.         sb    t0,%lo(_cache_21)(s4)
  218.         sb    t0,%lo(PORT_BASE+0x21)(s0)
  219.         lui    s3,%hi(_intr_count)
  220.         lw    t0,%lo(_intr_count)(s3)
  221.         li    t2,0x20
  222.         sb    t2,%lo(PORT_BASE+0x20)(s0)
  223.         /*
  224.          * Now call the real handler
  225.          */
  226.         la    t3,_IRQ_vectors
  227.         sll    t2,t1,2
  228.         addu    t3,t3,t2
  229.         lw    t3,(t3)
  230.         addiu    t0,t0,1
  231.         jalr    t3
  232.         sw    t0,%lo(_intr_count)(s3)        # delay slot
  233.         lw    t0,%lo(_intr_count)(s3)
  234.         /*
  235.          * Unblock first pic
  236.          */
  237.         lbu    t1,%lo(PORT_BASE+0x21)(s0)
  238.         lb    t1,%lo(_cache_21)(s4)
  239.         subu    t0,t0,1
  240.         sw    t0,%lo(_intr_count)(s3)
  241.         nor    s1,zero,s1
  242.         and    t1,t1,s1
  243.         sb    t1,%lo(_cache_21)(s4)
  244.         jr    v0
  245.         sb    t1,%lo(PORT_BASE+0x21)(s0)    # delay slot
  246.  
  247.         .align    5
  248. Lpoll_second:    li    t1,0x0f
  249.         sb    t1,%lo(PORT_BASE+0xa0)(s0)    # poll command
  250.         lb    t1,%lo(PORT_BASE+0xa0)(s0)    # read result
  251.         lui    s4,%hi(_cache_A1)
  252.         bgtz    t1,Lspurious_interrupt
  253.         andi    t1,t1,7
  254.         /*
  255.          * Acknowledge second pic
  256.          */
  257.         lbu    t2,%lo(PORT_BASE+0xa1)(s0)
  258.         lb    t3,%lo(_cache_A1)(s4)
  259.         sllv    s1,s1,t1
  260.         or    t3,t3,s1
  261.         sb    t3,%lo(_cache_A1)(s4)
  262.         sb    t3,%lo(PORT_BASE+0xa1)(s0)
  263.         li    t3,0x20
  264.         sb    t3,%lo(PORT_BASE+0xa0)(s0)
  265.         lui    s3,%hi(_intr_count)
  266.         lw    t0,%lo(_intr_count)(s3)
  267.         sb    t3,%lo(PORT_BASE+0x20)(s0)
  268.         /*
  269.          * Now call the real handler
  270.          */
  271.         la    t0,_IRQ_vectors
  272.         sll    t2,t1,2
  273.         addu    t0,t0,t2
  274.         lw    t0,32(t0)
  275.         addiu    t0,t0,1
  276.         jalr    t0
  277.         sw    t0,%lo(_intr_count)(s3)        # delay slot
  278.         lw    t0,%lo(_intr_count)(s3)
  279.         /*
  280.          * Unblock second pic
  281.          */
  282.         lb    t1,%lo(PORT_BASE+0xa1)(s0)
  283.         lb    t1,%lo(_cache_A1)(s4)
  284.         subu    t0,t0,1
  285.         lw    t0,%lo(_intr_count)(s3)
  286.         nor    s1,zero,s1
  287.         and    t1,t1,s1
  288.         sb    t1,%lo(_cache_A1)(s4)
  289.         jr    v0
  290.         sb    t1,%lo(PORT_BASE+0xa1)(s0)    # delay slot
  291.  
  292.         .align    5
  293. Lspurious_interrupt:
  294.         /*
  295.          * Nothing happened... (whistle)
  296.          */
  297.         lui    t1,%hi(_spurious_count)
  298.         lw    t0,%lo(_spurious_count)(t1)
  299.         la    v0,return
  300.         addiu    t0,t0,1
  301.         jr    ra
  302.         sw    t0,%lo(_spurious_count)(t1)
  303. #endif /* CONFIG_DESKSTATION_TYNE */
  304.         
  305. #ifdef CONFIG_ACER_PICA_61
  306. /*
  307.  * Acer PICA interrupt handler dummy
  308.  */
  309.         .set    noreorder
  310.         .set    noat
  311.         .globl    _acer_pica_61_handle_int
  312.         .align    5
  313. _acer_pica_61_handle_int:
  314.         la    a0,acer_text
  315.         jal    _panic
  316.         nop
  317. 1:        b    1b
  318.         nop
  319. acer_text:    .asciz    "Interrupt handler for Acer PICA not written yet"
  320.         .align    2
  321. #endif /* CONFIG_ACER_PICA_61 */
  322.  
  323.         .text
  324.         .set    noreorder
  325.         .set    at
  326.         .globl    _interrupt
  327.         .align    5
  328. _interrupt:    move    s2,ra
  329.         mfc0    t0,CP0_STATUS
  330.         ori    t0,t0,0x1f
  331.         xori    t0,t0,0x1e
  332.         mtc0    t0,CP0_STATUS
  333.         move    a0,t1
  334.         jal    _do_IRQ
  335.         move    a1,sp                # delay slot
  336.         mfc0    t0,CP0_STATUS
  337.         ori    t0,t0,1
  338.         xori    t0,t0,1
  339.         la    v0,ret_from_sys_call
  340.         jr    s2
  341.         mtc0    t0,CP0_STATUS            # delay slot
  342.  
  343.         .globl    _fast_interrupt
  344.         .align    5
  345. _fast_interrupt:
  346.         move    s2,ra
  347.         move    a0,t1
  348.         jal    _do_fast_IRQ
  349.         move    a1,sp                # delay slot
  350.         la    v0,return
  351.         jr    s2
  352.         nop                    # delay slot
  353.  
  354.         .globl    _bad_interrupt
  355. _bad_interrupt:
  356.         /*
  357.          * Don't return & unblock the pic
  358.          */
  359.         j    return
  360.         nop
  361.  
  362.         .globl    _handle_tlbl
  363.         .align    5
  364. _handle_tlbl:
  365.         .set    noreorder
  366.         .set    noat
  367.         /*
  368.          * Check whether this is a refill or an invalid exception
  369.          *
  370.          * NOTE: Some MIPS manuals say that the R4x00 sets the
  371.          * BadVAddr only when EXL == 0. This is wrong - BadVaddr
  372.          * is being set for all Reload, Invalid and Modified
  373.          * exceptions.
  374.          */
  375.         mfc0    k0,CP0_BADVADDR
  376.         mfc0    k1,CP0_ENTRYHI
  377.         ori    k0,k0,0x1fff
  378.         xori    k0,k0,0x1fff
  379.         andi    k1,k1,0xff
  380.         or    k0,k0,k1
  381.         mfc0    k1,CP0_ENTRYHI
  382.         mtc0    k0,CP0_ENTRYHI
  383.         nop                    # for R4[04]00 pipeline
  384.         nop
  385.         nop
  386.         tlbp
  387.         nop                    # for R4[04]00 pipeline
  388.         nop
  389.         mfc0    k0,CP0_INDEX
  390.         srl    k0,k0,31
  391.         beqz    k0,invalid_tlbl
  392.         mtc0    k1,CP0_ENTRYHI            # delay slot
  393.         /*
  394.          * Not in tlb -> nested refill exception
  395.          * Load the missing entry and return. This is the most
  396.          * efficient way to regain the faulting address.
  397.          */
  398.         dmfc0    k1,CP0_CONTEXT
  399.         dsra    k1,k1,1
  400.         lwu    k0,(k1)            # Never causes another exception
  401.         lwu    k1,4(k1)
  402.         dsrl    k0,k0,6            # Convert to EntryLo format
  403.         dsrl    k1,k1,6            # Convert to EntryLo format
  404.         dmtc0    k0,CP0_ENTRYLO0
  405.         dmtc0    k1,CP0_ENTRYLO1
  406.         nop                # for R4[04]00 pipeline
  407.         tlbwr
  408.         eret
  409.  
  410.         /*
  411.          * Handle invalid exception
  412.          *
  413.          * There are two possible causes for an invalid (tlbl)
  414.          * exception:
  415.          * 1) pages that have the present bit set but the valid bit
  416.          *    unset.
  417.          * 2) pages that don't exist
  418.          * Case one needs fast handling, therefore don't save
  419.          * registers yet.
  420.          *
  421.          * k0 now contains the bad virtual address.
  422.          */
  423. invalid_tlbl:
  424.         /*
  425.          * Remove entry so we don't need to care later
  426.          */
  427.         mfc0    k0,CP0_INDEX
  428.         lui    k1,0x0008
  429.         or    k0,k0,k1
  430.         dsll    k0,k0,13
  431.         dmtc0    k0,CP0_ENTRYHI
  432.         dmtc0    zero,CP0_ENTRYLO0
  433.         dmtc0    zero,CP0_ENTRYLO1
  434.         /*
  435.          * Test whether present bit in entry is set
  436.          */
  437.         dmfc0    k0,CP0_BADVADDR
  438.         tlbwi                        # delayed, for R4[04]00 pipeline
  439.         srl    k0,k0,10
  440.         lui    k1,%HI(TLBMAP)
  441.         addu    k0,k0,k1
  442.         ori    k0,k0,3
  443.         xori    k0,k0,3
  444.         lw    k1,(k0)
  445.         andi    k1,k1,_PAGE_PRESENT
  446.         beqz    k1,nopage_tlbl
  447.         /*
  448.          * Present bit is set -> set valid and accessed bits
  449.          */
  450.         lw    k1,(k0)                # delay slot
  451.         ori    k1,k1,_PAGE_ACCESSED
  452.         sw    k1,(k0)
  453.         eret
  454.  
  455.         /*
  456.          * Page doesn't exist. Lots of work which is less important
  457.          * for speed needs to be done, so hand it all over to the
  458.          * kernel memory management routines.
  459.          */
  460. nopage_tlbl:
  461.         SAVE_ALL
  462.         .set    at
  463.         STI
  464.         /*
  465.          * Create a Intel-style errorcode
  466.          * Bit 0: P Present
  467.          *        0 == Page not in memory
  468.          *        1 == privilege violation
  469.          * Bit 1: R/W Read/Write
  470.          *        0 == ReadAccess
  471.          *        1 == WriteAccess
  472.          * Bit 2: U/S User/Supervisor
  473.          *        0 == User mode
  474.          *        1 == Kernel mode
  475.          *
  476.          * a0 (struct pt_regs *) regs
  477.          * a1 (unsigned long)    error_code
  478.          */
  479.         lw    a1,FR_STATUS(sp)
  480.         move    a0,sp
  481.         srl    a1,a1,4
  482.         andi    a1,a1,1
  483.         jal    _do_page_fault
  484.         xori    a1,a1,1                # delay slot
  485.         j    ret_from_sys_call
  486.         nop                    # delay slot
  487.  
  488.         .text
  489.         .globl    _handle_tlbs
  490.         .align    5
  491. _handle_tlbs:
  492.         .set    noreorder
  493.         .set    noat
  494.         /*
  495.          * It is impossible that is a nested reload exception.
  496.          * Therefore this must be a invalid exception.
  497.          * Two possible cases:
  498.          * 1) Page not used yet
  499.          * 2) Page doesn't exist yet. Let the kernel handle the trouble.
  500.          *
  501.          * Test whether present bit in entry is set
  502.          */
  503.         dmfc0    k0,CP0_BADVADDR
  504.         srl    k0,k0,10
  505.         lui    k1,%HI(TLBMAP)
  506.         addu    k0,k0,k1
  507.         ori    k0,k0,3
  508.         xori    k0,k0,3
  509.         lw    k1,(k0)
  510.         andi    k1,k1,(_PAGE_PRESENT|_PAGE_RW)
  511.         beqz    k1,nopage_tlbs
  512.         /*
  513.          * Present and writable bits set -> set accessed and dirty bits.
  514.          */
  515.         lw    k1,(k0)                # delay slot
  516.         ori    k1,k1,(_PAGE_ACCESSED|_PAGE_DIRTY)
  517.         sw    k1,(k0)
  518.         /*
  519.          * Now reload the entry into the tlb
  520.          */
  521.         ori    k0,k0,0x1000
  522.         xori    k0,k0,0x1000
  523.         lw    k1,4(k0)
  524.         lw    k0,(k0)
  525.         srl    k0,k0,6
  526.         srl    k1,k1,6
  527.         dmtc0    k0,CP0_ENTRYLO0
  528.         dmtc0    k1,CP0_ENTRYLO1
  529.         tlbwi
  530.         eret
  531.  
  532.         /*
  533.          * Page doesn't exist. Lots of work which is less important
  534.          * for speed needs to be done, so hand it all over to the
  535.          * kernel memory management routines.
  536.          */
  537. nopage_tlbs:
  538. nowrite_mod:
  539.         /*
  540.          * Remove entry so we don't need to care later
  541.          */
  542.         mfc0    k0,CP0_INDEX
  543.         lui    k1,0x0008
  544.         or    k0,k0,k1
  545.         dsll    k0,k0,13
  546.         dmtc0    k0,CP0_ENTRYHI
  547.         dmtc0    zero,CP0_ENTRYLO0
  548.         dmtc0    zero,CP0_ENTRYLO1
  549.         tlbwi
  550.         SAVE_ALL
  551.         .set    at
  552.         STI
  553.         /*
  554.          * Create a Intel-style errorcode
  555.          * Bit 0: P Present
  556.          *        0 == Page not in memory
  557.          *        1 == privilege violation
  558.          * Bit 1: R/W Read/Write
  559.          *        0 == ReadAccess
  560.          *        1 == WriteAccess
  561.          * Bit 2: U/S User/Supervisor
  562.          *        0 == User mode
  563.          *        1 == Kernel mode
  564.          *
  565.          * a0 (struct pt_regs *) regs
  566.          * a1 (unsigned long)    error_code
  567.          */
  568.         lw    a1,FR_STATUS(sp)
  569.         move    a0,sp
  570.         srl    a1,a1,4
  571.         andi    a1,a1,1
  572.         jal    _do_page_fault
  573.         xori    a1,a1,3                # branch delay slot
  574.         j    ret_from_sys_call
  575.         nop                    # branch delay slot
  576.  
  577.         .globl    _handle_mod
  578.         .align    5
  579. _handle_mod:
  580.         .set    noreorder
  581.         .set    noat
  582.         /*
  583.          * Two possible cases:
  584.          * 1) Page is rw but not dirty -> set dirty and return
  585.          * 2) Page is not rw -> call C handler
  586.          */
  587.         dmfc0    k0,CP0_BADVADDR
  588.         srl    k0,k0,10
  589.         lui    k1,%HI(TLBMAP)
  590.         addu    k0,k0,k1
  591.         ori    k0,k0,3
  592.         xori    k0,k0,3
  593.         lw    k1,(k0)
  594.         andi    k1,k1,_PAGE_RW
  595.         beqz    k1,nopage_tlbs
  596.         /*
  597.          * Present and writable bits set -> set accessed and dirty bits.
  598.          */
  599.         lw    k1,(k0)                # delay slot
  600.         ori    k1,k1,(_PAGE_ACCESSED|_PAGE_DIRTY)
  601.         sw    k1,(k0)
  602.         /*
  603.          * Now reload the entry into the tlb
  604.          */
  605.         ori    k0,k0,0x1000
  606.         xori    k0,k0,0x1000
  607.         lw    k1,4(k0)
  608.         lw    k0,(k0)
  609.         srl    k0,k0,6
  610.         srl    k1,k1,6
  611.         dmtc0    k0,CP0_ENTRYLO0
  612.         dmtc0    k1,CP0_ENTRYLO1
  613.         tlbwi
  614.         eret
  615.  
  616.         .globl    _handle_adel
  617.         .align    5
  618. _handle_adel:
  619.         .set    noreorder
  620.         .set    noat
  621.         SAVE_ALL
  622.         STI
  623.         li    t0,-1
  624.         sw    t0,FR_ORIG_REG2(sp)
  625.         jal    _do_adel
  626.         move    a0,sp            # delay slot
  627.         j    ret_from_sys_call
  628.         nop                # delay slot
  629.  
  630.         .globl    _handle_ades
  631.         .align    5
  632. _handle_ades:
  633.         .set    noreorder
  634.         .set    noat
  635.         SAVE_ALL
  636.         STI
  637.         li    t0,-1
  638.         sw    t0,FR_ORIG_REG2(sp)
  639.         jal    _do_ades
  640.         move    a0,sp            # delay slot
  641.         j    ret_from_sys_call
  642.         nop                # delay slot
  643.  
  644.         .globl    _handle_ibe
  645.         .align    5
  646. _handle_ibe:
  647.         .set    noreorder
  648.         .set    noat
  649.         SAVE_ALL
  650.         STI
  651.         li    t0,-1
  652.         sw    t0,FR_ORIG_REG2(sp)
  653.         jal    _do_ibe
  654.         move    a0,sp            # delay slot
  655.         j    ret_from_sys_call
  656.         nop                # delay slot
  657.  
  658.         .globl    _handle_dbe
  659.         .align    5
  660. _handle_dbe:
  661.         .set    noreorder
  662.         .set    noat
  663.         SAVE_ALL
  664.         STI
  665.         li    t0,-1
  666.         sw    t0,FR_ORIG_REG2(sp)
  667.         jal    _do_dbe
  668.         move    a0,sp            # delay slot
  669.         j    ret_from_sys_call
  670.         nop                # delay slot
  671.  
  672.         .globl    _handle_ov
  673.         .align    5
  674. _handle_ov:
  675.         .set    noreorder
  676.         .set    noat
  677.         SAVE_ALL
  678.         STI
  679.         li    t0,-1
  680.         sw    t0,FR_ORIG_REG2(sp)
  681.         jal    _do_ov
  682.         move    a0,sp            # delay slot
  683.         j    ret_from_sys_call
  684.         nop                # delay slot
  685.  
  686.         .globl    _handle_fpe
  687.         .align    5
  688. _handle_fpe:
  689.         .set    noreorder
  690.         .set    noat
  691.         SAVE_ALL
  692.         STI
  693.         li    t0,-1
  694.         sw    t0,FR_ORIG_REG2(sp)
  695.         jal    _do_fpe
  696.         move    a0,sp            # delay slot
  697.         j    ret_from_sys_call
  698.         nop                # delay slot
  699.  
  700.         .globl    _handle_bp
  701.         .align    5
  702. _handle_bp:
  703.         .set    noreorder
  704.         .set    noat
  705.         SAVE_ALL
  706.         STI
  707.         li    t0,-1
  708.         sw    t0,FR_ORIG_REG2(sp)
  709.         jal    _do_bp
  710.         move    a0,sp            # delay slot
  711.         j    ret_from_sys_call
  712.         nop                # delay slot
  713.  
  714.         .globl    _handle_tr
  715.         .align    5
  716. _handle_tr:
  717.         .set    noreorder
  718.         .set    noat
  719.         SAVE_ALL
  720.         STI
  721.         li    t0,-1
  722.         sw    t0,FR_ORIG_REG2(sp)
  723.         jal    _do_tr
  724.         move    a0,sp            # delay slot
  725.         j    ret_from_sys_call
  726.         nop                # delay slot
  727.  
  728.         .globl    _handle_ri
  729.         .align    5
  730. _handle_ri:
  731.         .set    noreorder
  732.         .set    noat
  733.         SAVE_ALL
  734.         STI
  735.         li    t0,-1
  736.         sw    t0,FR_ORIG_REG2(sp)
  737.         jal    _do_ri
  738.         move    a0,sp            # delay slot
  739.         j    ret_from_sys_call
  740.         nop                # delay slot
  741.  
  742.         .globl    _handle_cpu
  743.         .align    5
  744. _handle_cpu:
  745.         .set    noreorder
  746.         .set    noat
  747.         SAVE_ALL
  748.         STI
  749.         li    t0,-1
  750.         sw    t0,FR_ORIG_REG2(sp)
  751.         jal    _do_cpu
  752.         move    a0,sp            # delay slot
  753.         j    ret_from_sys_call
  754.         nop                # delay slot
  755.  
  756.         .globl    _handle_vcei
  757.         .align    5
  758. _handle_vcei:
  759.         .set    noreorder
  760.         .set    noat
  761.         SAVE_ALL
  762.         STI
  763.         li    t0,-1
  764.         sw    t0,FR_ORIG_REG2(sp)
  765.         jal    _do_vcei
  766.         move    a0,sp            # delay slot
  767.         j    ret_from_sys_call
  768.         nop                # delay slot
  769.  
  770.         .globl    _handle_vced
  771.         .align    5
  772. _handle_vced:
  773.         .set    noreorder
  774.         .set    noat
  775.         SAVE_ALL
  776.         STI
  777.         li    t0,-1
  778.         sw    t0,FR_ORIG_REG2(sp)
  779.         jal    _do_vced
  780.         move    a0,sp            # delay slot
  781.         j    ret_from_sys_call
  782.         nop                # delay slot
  783.  
  784.         .globl    _handle_watch
  785.         .align    5
  786. _handle_watch:
  787.         .set    noreorder
  788.         .set    noat
  789.         SAVE_ALL
  790.         STI
  791.         li    t0,-1
  792.         sw    t0,FR_ORIG_REG2(sp)
  793.         jal    _do_watch
  794.         move    a0,sp            # delay slot
  795.         j    ret_from_sys_call
  796.         nop                # delay slot
  797.  
  798.         .globl    _handle_reserved
  799.         .align    5
  800. _handle_reserved:
  801.         .set    noreorder
  802.         .set    noat
  803.         SAVE_ALL
  804.         STI
  805.         li    t0,-1
  806.         sw    t0,FR_ORIG_REG2(sp)
  807.         jal    _do_reserved
  808.         move    a0,sp            # delay slot
  809.         j    ret_from_sys_call
  810.         nop                # delay slot
  811.  
  812. /*
  813.  * Exception handler table with 32 entries.
  814.  * This might be extended to handle software exceptions
  815.  */
  816.         .bss
  817.         .globl    _exception_handlers
  818.         .align    2
  819. _exception_handlers:
  820.         .fill    32,4,0
  821.  
  822. /*
  823.  * Table of syscalls
  824.  */
  825.         .data
  826. _sys_call_table:
  827.         .word    _sys_setup        /* 0 */
  828.         .word    _sys_exit
  829.         .word    _sys_fork
  830.         .word    _sys_read
  831.         .word    _sys_write
  832.         .word    _sys_open        /* 5 */
  833.         .word    _sys_close
  834.         .word    _sys_waitpid
  835.         .word    _sys_creat
  836.         .word    _sys_link
  837.         .word    _sys_unlink        /* 10 */
  838.         .word    _sys_execve
  839.         .word    _sys_chdir
  840.         .word    _sys_time
  841.         .word    _sys_mknod
  842.         .word    _sys_chmod        /* 15 */
  843.         .word    _sys_chown
  844.         .word    _sys_break
  845.         .word    _sys_stat
  846.         .word    _sys_lseek
  847.         .word    _sys_getpid        /* 20 */
  848.         .word    _sys_mount
  849.         .word    _sys_umount
  850.         .word    _sys_setuid
  851.         .word    _sys_getuid
  852.         .word    _sys_stime        /* 25 */
  853.         .word    _sys_ptrace
  854.         .word    _sys_alarm
  855.         .word    _sys_fstat
  856.         .word    _sys_pause
  857.         .word    _sys_utime        /* 30 */
  858.         .word    _sys_stty
  859.         .word    _sys_gtty
  860.         .word    _sys_access
  861.         .word    _sys_nice
  862.         .word    _sys_ftime        /* 35 */
  863.         .word    _sys_sync
  864.         .word    _sys_kill
  865.         .word    _sys_rename
  866.         .word    _sys_mkdir
  867.         .word    _sys_rmdir        /* 40 */
  868.         .word    _sys_dup
  869.         .word    _sys_pipe
  870.         .word    _sys_times
  871.         .word    _sys_prof
  872.         .word    _sys_brk        /* 45 */
  873.         .word    _sys_setgid
  874.         .word    _sys_getgid
  875.         .word    _sys_signal
  876.         .word    _sys_geteuid
  877.         .word    _sys_getegid        /* 50 */
  878.         .word    _sys_acct
  879.         .word    _sys_phys
  880.         .word    _sys_lock
  881.         .word    _sys_ioctl
  882.         .word    _sys_fcntl        /* 55 */
  883.         .word    _sys_mpx
  884.         .word    _sys_setpgid
  885.         .word    _sys_ulimit
  886.         .word    _sys_olduname
  887.         .word    _sys_umask        /* 60 */
  888.         .word    _sys_chroot
  889.         .word    _sys_ustat
  890.         .word    _sys_dup2
  891.         .word    _sys_getppid
  892.         .word    _sys_getpgrp        /* 65 */
  893.         .word    _sys_setsid
  894.         .word    _sys_sigaction
  895.         .word    _sys_sgetmask
  896.         .word    _sys_ssetmask
  897.         .word    _sys_setreuid        /* 70 */
  898.         .word    _sys_setregid
  899.         .word    _sys_sigsuspend
  900.         .word    _sys_sigpending
  901.         .word    _sys_sethostname
  902.         .word    _sys_setrlimit        /* 75 */
  903.         .word    _sys_getrlimit
  904.         .word    _sys_getrusage
  905.         .word    _sys_gettimeofday
  906.         .word    _sys_settimeofday
  907.         .word    _sys_getgroups        /* 80 */
  908.         .word    _sys_setgroups
  909.         .word    _sys_select
  910.         .word    _sys_symlink
  911.         .word    _sys_lstat
  912.         .word    _sys_readlink        /* 85 */
  913.         .word    _sys_uselib
  914.         .word    _sys_swapon
  915.         .word    _sys_reboot
  916.         .word    _sys_readdir
  917.         .word    _sys_mmap        /* 90 */
  918.         .word    _sys_munmap
  919.         .word    _sys_truncate
  920.         .word    _sys_ftruncate
  921.         .word    _sys_fchmod
  922.         .word    _sys_fchown        /* 95 */
  923.         .word    _sys_getpriority
  924.         .word    _sys_setpriority
  925.         .word    _sys_profil
  926.         .word    _sys_statfs
  927.         .word    _sys_fstatfs        /* 100 */
  928.         .word    _sys_ioperm
  929.         .word    _sys_socketcall
  930.         .word    _sys_syslog
  931.         .word    _sys_setitimer
  932.         .word    _sys_getitimer        /* 105 */
  933.         .word    _sys_newstat
  934.         .word    _sys_newlstat
  935.         .word    _sys_newfstat
  936.         .word    _sys_uname
  937.         .word    _sys_iopl        /* 110 */
  938.         .word    _sys_vhangup
  939.         .word    _sys_idle
  940.         .word    0 #_sys_vm86
  941.         .word    _sys_wait4
  942.         .word    _sys_swapoff        /* 115 */
  943.         .word    _sys_sysinfo
  944.         .word    _sys_ipc
  945.         .word    _sys_fsync
  946.         .word    _sys_sigreturn
  947.         .word    _sys_clone        /* 120 */
  948.         .word    _sys_setdomainname
  949.         .word    _sys_newuname
  950.         .word    0 #_sys_modify_ldt
  951.         .word    _sys_adjtimex
  952.         .word    _sys_mprotect        /* 125 */
  953.         .word    _sys_sigprocmask
  954.         .word    _sys_create_module
  955.         .word    _sys_init_module
  956.         .word    _sys_delete_module
  957.         .word    _sys_get_kernel_syms    /* 130 */
  958.         .word    _sys_quotactl
  959.         .word    _sys_getpgid
  960.         .word    _sys_fchdir
  961.         .word    _sys_bdflush
  962.         .word    _sys_sysfs        /* 135 */
  963.         .word    _sys_personality
  964.         .word    0            /* for afs_syscall */
  965.         .word    _sys_setfsuid
  966.         .word    _sys_setfsgid
  967.         .word    _sys_llseek        /* 140 */
  968.         .space    (NR_syscalls-140)*4
  969.  
  970.         .bss
  971.         .globl    _IRQ_vectors
  972. _IRQ_vectors:    .fill    16,4,0
  973.  
  974.