OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [i386/] [kernel/] [vm86.c] - Blame information for rev 1765

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1623 jcastillo
/*
2
 *  linux/kernel/vm86.c
3
 *
4
 *  Copyright (C) 1994  Linus Torvalds
5
 */
6
#include <linux/errno.h>
7
#include <linux/sched.h>
8
#include <linux/kernel.h>
9
#include <linux/signal.h>
10
#include <linux/string.h>
11
#include <linux/ptrace.h>
12
#include <linux/mm.h>
13
 
14
#include <asm/segment.h>
15
#include <asm/pgtable.h>
16
#include <asm/io.h>
17
 
18
/*
19
 * Known problems:
20
 *
21
 * Interrupt handling is not guaranteed:
22
 * - a real x86 will disable all interrupts for one instruction
23
 *   after a "mov ss,xx" to make stack handling atomic even without
24
 *   the 'lss' instruction. We can't guarantee this in v86 mode,
25
 *   as the next instruction might result in a page fault or similar.
26
 * - a real x86 will have interrupts disabled for one instruction
27
 *   past the 'sti' that enables them. We don't bother with all the
28
 *   details yet..
29
 *
30
 * Hopefully these problems do not actually matter for anything.
31
 */
32
 
33
 
34
#define KVM86   ((struct kernel_vm86_struct *)regs)
35
#define VMPI    KVM86->vm86plus
36
 
37
 
38
/*
39
 * 8- and 16-bit register defines..
40
 */
41
#define AL(regs)        (((unsigned char *)&((regs)->eax))[0])
42
#define AH(regs)        (((unsigned char *)&((regs)->eax))[1])
43
#define IP(regs)        (*(unsigned short *)&((regs)->eip))
44
#define SP(regs)        (*(unsigned short *)&((regs)->esp))
45
 
46
/*
47
 * virtual flags (16 and 32-bit versions)
48
 */
49
#define VFLAGS  (*(unsigned short *)&(current->tss.v86flags))
50
#define VEFLAGS (current->tss.v86flags)
51
 
52
#define set_flags(X,new,mask) \
53
((X) = ((X) & ~(mask)) | ((new) & (mask)))
54
 
55
#define SAFE_MASK       (0xDD5)
56
#define RETURN_MASK     (0xDFF)
57
 
58
 
59
asmlinkage struct pt_regs * save_v86_state(struct vm86_regs * regs)
60
{
61
        if (!current->tss.vm86_info) {
62
                printk("no vm86_info: BAD\n");
63
                do_exit(SIGSEGV);
64
        }
65
        set_flags(regs->eflags, VEFLAGS, VIF_MASK | current->tss.v86mask);
66
        memcpy_tofs(&current->tss.vm86_info->regs,regs,sizeof(*regs));
67
        put_fs_long(current->tss.screen_bitmap,&current->tss.vm86_info->screen_bitmap);
68
        current->tss.esp0 = current->saved_kernel_stack;
69
        current->saved_kernel_stack = 0;
70
        return KVM86->regs32;
71
}
72
 
73
static void mark_screen_rdonly(struct task_struct * tsk)
74
{
75
        pgd_t *pgd;
76
        pmd_t *pmd;
77
        pte_t *pte;
78
        int i;
79
 
80
        pgd = pgd_offset(tsk->mm, 0xA0000);
81
        if (pgd_none(*pgd))
82
                return;
83
        if (pgd_bad(*pgd)) {
84
                printk("vm86: bad pgd entry [%p]:%08lx\n", pgd, pgd_val(*pgd));
85
                pgd_clear(pgd);
86
                return;
87
        }
88
        pmd = pmd_offset(pgd, 0xA0000);
89
        if (pmd_none(*pmd))
90
                return;
91
        if (pmd_bad(*pmd)) {
92
                printk("vm86: bad pmd entry [%p]:%08lx\n", pmd, pmd_val(*pmd));
93
                pmd_clear(pmd);
94
                return;
95
        }
96
        pte = pte_offset(pmd, 0xA0000);
97
        for (i = 0; i < 32; i++) {
98
                if (pte_present(*pte))
99
                        set_pte(pte, pte_wrprotect(*pte));
100
                pte++;
101
        }
102
        flush_tlb();
103
}
104
 
105
 
106
 
107
static int do_vm86_irq_handling(int subfunction, int irqnumber);
108
static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk);
109
 
110
asmlinkage int sys_vm86old(struct vm86_struct * v86)
111
{
112
        struct kernel_vm86_struct info; /* declare this _on top_,
113
                                         * this avoids wasting of stack space.
114
                                         * This remains on the stack until we
115
                                         * return to 32 bit user space.
116
                                         */
117
        struct task_struct *tsk = current;
118
        int error;
119
 
120
        if (tsk->saved_kernel_stack)
121
                return -EPERM;
122
        /* v86 must be readable (now) and writable (for save_v86_state) */
123
        error = verify_area(VERIFY_WRITE,v86,sizeof(*v86));
124
        if (error)
125
                return error;
126
        memcpy_fromfs(&info,v86,sizeof(struct vm86_struct));
127
        memset(&info.vm86plus, 0, (int)&info.regs32 - (int)&info.vm86plus);
128
        info.regs32 = (struct pt_regs *) &v86;
129
        tsk->tss.vm86_info = v86;
130
        do_sys_vm86(&info, tsk);
131
        return 0;        /* we never return here */
132
}
133
 
134
 
135
asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct * v86)
136
{
137
        struct kernel_vm86_struct info; /* declare this _on top_,
138
                                         * this avoids wasting of stack space.
139
                                         * This remains on the stack until we
140
                                         * return to 32 bit user space.
141
                                         */
142
        struct task_struct *tsk = current;
143
        int error;
144
 
145
        switch (subfunction) {
146
                case VM86_REQUEST_IRQ:
147
                case VM86_FREE_IRQ:
148
                case VM86_GET_IRQ_BITS:
149
                case VM86_GET_AND_RESET_IRQ:
150
                        return do_vm86_irq_handling(subfunction,(int)v86);
151
                case VM86_PLUS_INSTALL_CHECK:
152
                        /* NOTE: on old vm86 stuff this will return the error
153
                           from verify_area(), because the subfunction is
154
                           interpreted as (invalid) address to vm86_struct.
155
                           So the installation check works.
156
                         */
157
                        return 0;
158
        }
159
 
160
        /* we come here only for functions VM86_ENTER, VM86_ENTER_NO_BYPASS */
161
        if (tsk->saved_kernel_stack)
162
                return -EPERM;
163
        /* v86 must be readable (now) and writable (for save_v86_state) */
164
        error = verify_area(VERIFY_WRITE,v86,sizeof(struct vm86plus_struct));
165
        if (error)
166
                return error;
167
        memcpy_fromfs(&info,v86,sizeof(struct vm86plus_struct));
168
        info.regs32 = (struct pt_regs *) &subfunction;
169
        info.vm86plus.is_vm86pus = 1;
170
        tsk->tss.vm86_info = (struct vm86_struct *)v86;
171
        do_sys_vm86(&info, tsk);
172
        return 0;        /* we never return here */
173
}
174
 
175
 
176
static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk)
177
{
178
/*
179
 * make sure the vm86() system call doesn't try to do anything silly
180
 */
181
        info->regs.__null_ds = 0;
182
        info->regs.__null_es = 0;
183
        info->regs.__null_fs = 0;
184
        info->regs.__null_gs = 0;
185
/*
186
 * The eflags register is also special: we cannot trust that the user
187
 * has set it up safely, so this makes sure interrupt etc flags are
188
 * inherited from protected mode.
189
 */
190
        VEFLAGS = info->regs.eflags;
191
        info->regs.eflags &= SAFE_MASK;
192
        info->regs.eflags |= info->regs32->eflags & ~SAFE_MASK;
193
        info->regs.eflags |= VM_MASK;
194
 
195
        switch (info->cpu_type) {
196
                case CPU_286:
197
                        tsk->tss.v86mask = 0;
198
                        break;
199
                case CPU_386:
200
                        tsk->tss.v86mask = NT_MASK | IOPL_MASK;
201
                        break;
202
                case CPU_486:
203
                        tsk->tss.v86mask = AC_MASK | NT_MASK | IOPL_MASK;
204
                        break;
205
                default:
206
                        tsk->tss.v86mask = ID_MASK | AC_MASK | NT_MASK | IOPL_MASK;
207
                        break;
208
        }
209
 
210
/*
211
 * Save old state, set default return value (%eax) to 0
212
 */
213
        info->regs32->eax = 0;
214
        tsk->saved_kernel_stack = tsk->tss.esp0;
215
        tsk->tss.esp0 = (unsigned long) &info->VM86_TSS_ESP0;
216
 
217
        tsk->tss.screen_bitmap = info->screen_bitmap;
218
        if (info->flags & VM86_SCREEN_BITMAP)
219
                mark_screen_rdonly(tsk);
220
        __asm__ __volatile__(
221
                "movl %0,%%esp\n\t"
222
                "jmp ret_from_sys_call"
223
                : /* no outputs */
224
                :"r" (&info->regs));
225
        /* we never return here */
226
}
227
 
228
static inline void return_to_32bit(struct vm86_regs * regs16, int retval)
229
{
230
        struct pt_regs * regs32;
231
 
232
        regs32 = save_v86_state(regs16);
233
        regs32->eax = retval;
234
        __asm__ __volatile__("movl %0,%%esp\n\t"
235
                "jmp ret_from_sys_call"
236
                : : "r" (regs32));
237
}
238
 
239
static inline void set_IF(struct vm86_regs * regs)
240
{
241
        VEFLAGS |= VIF_MASK;
242
        if (VEFLAGS & VIP_MASK)
243
                return_to_32bit(regs, VM86_STI);
244
}
245
 
246
static inline void clear_IF(struct vm86_regs * regs)
247
{
248
        VEFLAGS &= ~VIF_MASK;
249
}
250
 
251
static inline void clear_TF(struct vm86_regs * regs)
252
{
253
        regs->eflags &= ~TF_MASK;
254
}
255
 
256
static inline void set_vflags_long(unsigned long eflags, struct vm86_regs * regs)
257
{
258
        set_flags(VEFLAGS, eflags, current->tss.v86mask);
259
        set_flags(regs->eflags, eflags, SAFE_MASK);
260
        if (eflags & IF_MASK)
261
                set_IF(regs);
262
}
263
 
264
static inline void set_vflags_short(unsigned short flags, struct vm86_regs * regs)
265
{
266
        set_flags(VFLAGS, flags, current->tss.v86mask);
267
        set_flags(regs->eflags, flags, SAFE_MASK);
268
        if (flags & IF_MASK)
269
                set_IF(regs);
270
}
271
 
272
static inline unsigned long get_vflags(struct vm86_regs * regs)
273
{
274
        unsigned long flags = regs->eflags & RETURN_MASK;
275
 
276
        if (VEFLAGS & VIF_MASK)
277
                flags |= IF_MASK;
278
        return flags | (VEFLAGS & current->tss.v86mask);
279
}
280
 
281
static inline int is_revectored(int nr, struct revectored_struct * bitmap)
282
{
283
        __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
284
                :"=r" (nr)
285
                :"m" (*bitmap),"r" (nr));
286
        return nr;
287
}
288
 
289
/*
290
 * Boy are these ugly, but we need to do the correct 16-bit arithmetic.
291
 * Gcc makes a mess of it, so we do it inline and use non-obvious calling
292
 * conventions..
293
 */
294
#define pushb(base, ptr, val) \
295
__asm__ __volatile__( \
296
        "decw %w0\n\t" \
297
        "movb %2,%%fs:0(%1,%0)" \
298
        : "=r" (ptr) \
299
        : "r" (base), "q" (val), "0" (ptr))
300
 
301
#define pushw(base, ptr, val) \
302
__asm__ __volatile__( \
303
        "decw %w0\n\t" \
304
        "movb %h2,%%fs:0(%1,%0)\n\t" \
305
        "decw %w0\n\t" \
306
        "movb %b2,%%fs:0(%1,%0)" \
307
        : "=r" (ptr) \
308
        : "r" (base), "q" (val), "0" (ptr))
309
 
310
#define pushl(base, ptr, val) \
311
__asm__ __volatile__( \
312
        "decw %w0\n\t" \
313
        "rorl $16,%2\n\t" \
314
        "movb %h2,%%fs:0(%1,%0)\n\t" \
315
        "decw %w0\n\t" \
316
        "movb %b2,%%fs:0(%1,%0)\n\t" \
317
        "decw %w0\n\t" \
318
        "rorl $16,%2\n\t" \
319
        "movb %h2,%%fs:0(%1,%0)\n\t" \
320
        "decw %w0\n\t" \
321
        "movb %b2,%%fs:0(%1,%0)" \
322
        : "=r" (ptr) \
323
        : "r" (base), "q" (val), "0" (ptr))
324
 
325
#define popb(base, ptr) \
326
({ unsigned long __res; \
327
__asm__ __volatile__( \
328
        "movb %%fs:0(%1,%0),%b2\n\t" \
329
        "incw %w0" \
330
        : "=r" (ptr), "=r" (base), "=q" (__res) \
331
        : "0" (ptr), "1" (base), "2" (0)); \
332
__res; })
333
 
334
#define popw(base, ptr) \
335
({ unsigned long __res; \
336
__asm__ __volatile__( \
337
        "movb %%fs:0(%1,%0),%b2\n\t" \
338
        "incw %w0\n\t" \
339
        "movb %%fs:0(%1,%0),%h2\n\t" \
340
        "incw %w0" \
341
        : "=r" (ptr), "=r" (base), "=q" (__res) \
342
        : "0" (ptr), "1" (base), "2" (0)); \
343
__res; })
344
 
345
#define popl(base, ptr) \
346
({ unsigned long __res; \
347
__asm__ __volatile__( \
348
        "movb %%fs:0(%1,%0),%b2\n\t" \
349
        "incw %w0\n\t" \
350
        "movb %%fs:0(%1,%0),%h2\n\t" \
351
        "incw %w0\n\t" \
352
        "rorl $16,%2\n\t" \
353
        "movb %%fs:0(%1,%0),%b2\n\t" \
354
        "incw %w0\n\t" \
355
        "movb %%fs:0(%1,%0),%h2\n\t" \
356
        "incw %w0\n\t" \
357
        "rorl $16,%2" \
358
        : "=r" (ptr), "=r" (base), "=q" (__res) \
359
        : "0" (ptr), "1" (base)); \
360
__res; })
361
 
362
static void do_int(struct vm86_regs *regs, int i, unsigned char * ssp, unsigned long sp)
363
{
364
        unsigned long *intr_ptr, segoffs;
365
 
366
        if (regs->cs == BIOSSEG)
367
                goto cannot_handle;
368
        if (is_revectored(i, &KVM86->int_revectored))
369
                goto cannot_handle;
370
        if (i==0x21 && is_revectored(AH(regs),&KVM86->int21_revectored))
371
                goto cannot_handle;
372
        intr_ptr = (unsigned long *) (i << 2);
373
        if (verify_area(VERIFY_READ, intr_ptr, 4) < 0)
374
                goto cannot_handle;
375
        segoffs = get_fs_long(intr_ptr);
376
        if ((segoffs >> 16) == BIOSSEG)
377
                goto cannot_handle;
378
        pushw(ssp, sp, get_vflags(regs));
379
        pushw(ssp, sp, regs->cs);
380
        pushw(ssp, sp, IP(regs));
381
        regs->cs = segoffs >> 16;
382
        SP(regs) -= 6;
383
        IP(regs) = segoffs & 0xffff;
384
        clear_TF(regs);
385
        clear_IF(regs);
386
        return;
387
 
388
cannot_handle:
389
        return_to_32bit(regs, VM86_INTx + (i << 8));
390
}
391
 
392
 
393
 
394
int handle_vm86_trap(struct vm86_regs * regs, long error_code, int trapno)
395
{
396
        if (VMPI.is_vm86pus) {
397
                if ( (trapno==3) || (trapno==1) )
398
                        return_to_32bit(regs, VM86_TRAP + (trapno << 8));
399
                do_int(regs, trapno, (unsigned char *) (regs->ss << 4), SP(regs));
400
                return 0;
401
        }
402
        if (trapno !=1)
403
                return 1; /* we let this handle by the calling routine */
404
        if (current->flags & PF_PTRACED)
405
                current->blocked &= ~(1 << (SIGTRAP-1));
406
        send_sig(SIGTRAP, current, 1);
407
        current->tss.trap_no = trapno;
408
        current->tss.error_code = error_code;
409
        return 0;
410
}
411
 
412
 
413
void handle_vm86_fault(struct vm86_regs * regs, long error_code)
414
{
415
        unsigned char *csp, *ssp;
416
        unsigned long ip, sp;
417
 
418
#define CHECK_IF_IN_TRAP \
419
        if (VMPI.vm86dbg_active && VMPI.vm86dbg_TFpendig) \
420
                pushw(ssp,sp,popw(ssp,sp) | TF_MASK);
421
#define VM86_FAULT_RETURN \
422
        if (VMPI.force_return_for_pic  && (VEFLAGS & IF_MASK)) \
423
                return_to_32bit(regs, VM86_PICRETURN); \
424
        return;
425
 
426
        csp = (unsigned char *) (regs->cs << 4);
427
        ssp = (unsigned char *) (regs->ss << 4);
428
        sp = SP(regs);
429
        ip = IP(regs);
430
 
431
        switch (popb(csp, ip)) {
432
 
433
        /* operand size override */
434
        case 0x66:
435
                switch (popb(csp, ip)) {
436
 
437
                /* pushfd */
438
                case 0x9c:
439
                        SP(regs) -= 4;
440
                        IP(regs) += 2;
441
                        pushl(ssp, sp, get_vflags(regs));
442
                        VM86_FAULT_RETURN;
443
 
444
                /* popfd */
445
                case 0x9d:
446
                        SP(regs) += 4;
447
                        IP(regs) += 2;
448
                        CHECK_IF_IN_TRAP
449
                        set_vflags_long(popl(ssp, sp), regs);
450
                        VM86_FAULT_RETURN;
451
 
452
                /* iretd */
453
                case 0xcf:
454
                        SP(regs) += 12;
455
                        IP(regs) = (unsigned short)popl(ssp, sp);
456
                        regs->cs = (unsigned short)popl(ssp, sp);
457
                        CHECK_IF_IN_TRAP
458
                        set_vflags_long(popl(ssp, sp), regs);
459
                        VM86_FAULT_RETURN;
460
                /* need this to avoid a fallthrough */
461
                default:
462
                        return_to_32bit(regs, VM86_UNKNOWN);
463
                }
464
 
465
        /* pushf */
466
        case 0x9c:
467
                SP(regs) -= 2;
468
                IP(regs)++;
469
                pushw(ssp, sp, get_vflags(regs));
470
                VM86_FAULT_RETURN;
471
 
472
        /* popf */
473
        case 0x9d:
474
                SP(regs) += 2;
475
                IP(regs)++;
476
                CHECK_IF_IN_TRAP
477
                set_vflags_short(popw(ssp, sp), regs);
478
                VM86_FAULT_RETURN;
479
 
480
        /* int xx */
481
        case 0xcd: {
482
                int intno=popb(csp, ip);
483
                IP(regs) += 2;
484
                if (VMPI.vm86dbg_active) {
485
                        if ( (1 << (intno &7)) & VMPI.vm86dbg_intxxtab[intno >> 3] )
486
                                return_to_32bit(regs, VM86_INTx + (intno << 8));
487
                }
488
                do_int(regs, intno, ssp, sp);
489
                return;
490
        }
491
 
492
        /* iret */
493
        case 0xcf:
494
                SP(regs) += 6;
495
                IP(regs) = popw(ssp, sp);
496
                regs->cs = popw(ssp, sp);
497
                CHECK_IF_IN_TRAP
498
                set_vflags_short(popw(ssp, sp), regs);
499
                VM86_FAULT_RETURN;
500
 
501
        /* cli */
502
        case 0xfa:
503
                IP(regs)++;
504
                clear_IF(regs);
505
                VM86_FAULT_RETURN;
506
 
507
        /* sti */
508
        /*
509
         * Damn. This is incorrect: the 'sti' instruction should actually
510
         * enable interrupts after the /next/ instruction. Not good.
511
         *
512
         * Probably needs some horsing around with the TF flag. Aiee..
513
         */
514
        case 0xfb:
515
                IP(regs)++;
516
                set_IF(regs);
517
                VM86_FAULT_RETURN;
518
 
519
        default:
520
                return_to_32bit(regs, VM86_UNKNOWN);
521
        }
522
}
523
 
524
/* ---------------- vm86 special IRQ passing stuff ----------------- */
525
 
526
#define VM86_IRQNAME            "vm86irq"
527
 
528
static struct vm86_irqs {
529
        struct task_struct *tsk;
530
        int sig;
531
} vm86_irqs[16] = {{0},};
532
static int irqbits=0;
533
 
534
#define ALLOWED_SIGS ( 1 /* 0 = don't send a signal */ \
535
        | (1 << SIGUSR1) | (1 << SIGUSR2) | (1 << SIGIO)  | (1 << SIGURG) \
536
        | (1 << SIGUNUSED) )
537
 
538
static void irq_handler(int intno, void *dev_id, struct pt_regs * regs) {
539
        int irq_bit;
540
        unsigned long flags;
541
 
542
        save_flags(flags);
543
        cli();
544
        irq_bit = 1 << intno;
545
        if ((irqbits & irq_bit) || ! vm86_irqs[intno].tsk) {
546
                restore_flags(flags);
547
                return;
548
        }
549
        irqbits |= irq_bit;
550
        if (vm86_irqs[intno].sig)
551
                send_sig(vm86_irqs[intno].sig, vm86_irqs[intno].tsk, 1);
552
        /* else user will poll for IRQs */
553
        restore_flags(flags);
554
}
555
 
556
static inline void free_vm86_irq(int irqnumber)
557
{
558
        free_irq(irqnumber,0);
559
        vm86_irqs[irqnumber].tsk = 0;
560
        irqbits &= ~(1 << irqnumber);
561
}
562
 
563
static inline int task_valid(struct task_struct *tsk)
564
{
565
        struct task_struct *p;
566
 
567
        for_each_task(p) {
568
                if ((p == tsk) && (p->sig)) return 1;
569
        }
570
        return 0;
571
}
572
 
573
static inline void handle_irq_zombies(void)
574
{
575
        int i;
576
        for (i=3; i<16; i++) {
577
                if (vm86_irqs[i].tsk) {
578
                        if (task_valid(vm86_irqs[i].tsk)) continue;
579
                        free_vm86_irq(i);
580
                }
581
        }
582
}
583
 
584
static inline int get_and_reset_irq(int irqnumber)
585
{
586
        int bit;
587
        unsigned long flags;
588
 
589
        if ( (irqnumber<3) || (irqnumber>15) ) return 0;
590
        if (vm86_irqs[irqnumber].tsk != current) return 0;
591
        save_flags(flags);
592
        cli();
593
        bit = irqbits & (1 << irqnumber);
594
        irqbits &= ~bit;
595
        restore_flags(flags);
596
        return bit;
597
}
598
 
599
 
600
static int do_vm86_irq_handling(int subfunction, int irqnumber)
601
{
602
        int ret;
603
        switch (subfunction) {
604
                case VM86_GET_AND_RESET_IRQ: {
605
                        return get_and_reset_irq(irqnumber);
606
                }
607
                case VM86_GET_IRQ_BITS: {
608
                        return irqbits;
609
                }
610
                case VM86_REQUEST_IRQ: {
611
                        int sig = irqnumber >> 8;
612
                        int irq = irqnumber & 255;
613
                        handle_irq_zombies();
614
                        if (!suser() || securelevel > 0) return -EPERM;
615
                        if (!((1 << sig) & ALLOWED_SIGS)) return -EPERM;
616
                        if ( (irq<3) || (irq>15) ) return -EPERM;
617
                        if (vm86_irqs[irq].tsk) return -EPERM;
618
                        ret = request_irq(irq, &irq_handler, 0, VM86_IRQNAME, 0);
619
                        if (ret) return ret;
620
                        vm86_irqs[irq].sig = sig;
621
                        vm86_irqs[irq].tsk = current;
622
                        return irq;
623
                }
624
                case  VM86_FREE_IRQ: {
625
                        handle_irq_zombies();
626
                        if ( (irqnumber<3) || (irqnumber>15) ) return -EPERM;
627
                        if (!vm86_irqs[irqnumber].tsk) return 0;
628
                        if (vm86_irqs[irqnumber].tsk != current) return -EPERM;
629
                        free_vm86_irq(irqnumber);
630
                        return 0;
631
                }
632
        }
633
        return -EINVAL;
634
}
635
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.