* fiq_claim: * * Claim the FIQ vector. */
| 85 | * Claim the FIQ vector. |
| 86 | */ |
| 87 | int |
| 88 | fiq_claim(struct fiqhandler *fh) |
| 89 | { |
| 90 | struct fiqhandler *ofh; |
| 91 | u_int oldirqstate; |
| 92 | int error = 0; |
| 93 | |
| 94 | if (fh->fh_size > 0x100) |
| 95 | return (EFBIG); |
| 96 | |
| 97 | oldirqstate = disable_interrupts(PSR_F); |
| 98 | |
| 99 | if ((ofh = TAILQ_FIRST(&fiqhandler_stack)) != NULL) { |
| 100 | if ((ofh->fh_flags & FH_CANPUSH) == 0) { |
| 101 | error = EBUSY; |
| 102 | goto out; |
| 103 | } |
| 104 | |
| 105 | /* Save the previous FIQ handler's registers. */ |
| 106 | if (ofh->fh_regs != NULL) |
| 107 | fiq_getregs(ofh->fh_regs); |
| 108 | } |
| 109 | |
| 110 | /* Set FIQ mode registers to ours. */ |
| 111 | if (fh->fh_regs != NULL) |
| 112 | fiq_setregs(fh->fh_regs); |
| 113 | |
| 114 | TAILQ_INSERT_HEAD(&fiqhandler_stack, fh, fh_list); |
| 115 | |
| 116 | /* Now copy the actual handler into place. */ |
| 117 | fiq_installhandler(fh->fh_func, fh->fh_size); |
| 118 | |
| 119 | /* Make sure FIQs are enabled when we return. */ |
| 120 | oldirqstate &= ~PSR_F; |
| 121 | |
| 122 | out: |
| 123 | restore_interrupts(oldirqstate); |
| 124 | return (error); |
| 125 | } |
| 126 | |
| 127 | /* |
| 128 | * fiq_release: |
nothing calls this directly
no test coverage detected