3 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 #define outb(value,port) \
29 __asm__ ("outb %%al,%%dx"::"a" (value),"d" (port))
31 #define outw(value,port) \
32 __asm__ ("outw %%ax,%%dx"::"a" (value),"d" (port))
34 #define outl(value,port) \
35 __asm__ ("outl %%eax,%%dx"::"a" (value),"d" (port))
37 #define inb(port) ({ \
39 __asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \
43 #define inw(port) ({ \
45 __asm__ volatile ("inw %%dx,%%ax":"=a" (_v):"d" (port)); \
49 #define inl(port) ({ \
51 __asm__ volatile ("inl %%dx,%%eax":"=a" (_v):"d" (port)); \
55 #define outb_p(value,port) \
56 __asm__ ("outb %%al,%%dx\n" \
59 "1:"::"a" (value),"d" (port))
61 #define inb_p(port) ({ \
63 __asm__ volatile ("inb %%dx,%%al\n" \
66 "1:":"=a" (_v):"d" (port)); \
70 #define outw_p(value,port) \
71 __asm__ ("outw %%ax,%%dx\n" \
74 "1:"::"a" (value),"dN" (port))
99 unsigned long err_code
;
102 unsigned long eflags
;
103 unsigned long useresp
;
107 #define _set_gate(gate_addr, type, dpl, addr) \
108 __asm__ ("movw %%dx,%%ax\n\t" \
110 "movl %%eax,%1\n\t" \
113 : "i" ((short) (0x8000+(dpl<<13)+(type<<8))), \
114 "o" (*((char *) (gate_addr))), \
115 "o" (*(4+(char *) (gate_addr))), \
116 "d" ((char *) (addr)),"a" (0x00080000))