MCPcopy Create free account
hub / github.com/F-Stack/f-stack / fiq_claim

Function fiq_claim

freebsd/arm/arm/fiq.c:87–125  ·  view source on GitHub ↗

* fiq_claim: * * Claim the FIQ vector. */

Source from the content-addressed store, hash-verified

85 * Claim the FIQ vector.
86 */
87int
88fiq_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:

Callers

nothing calls this directly

Calls 3

disable_interruptsFunction · 0.85
fiq_installhandlerFunction · 0.85
restore_interruptsFunction · 0.85

Tested by

no test coverage detected