FreeNOS
IntelTraps.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __LIB_LIBARCH_INTEL_INTELTRAPS_H
19 #define __LIB_LIBARCH_INTEL_INTELTRAPS_H
20 
21 #include <Types.h>
22 
52 inline ulong trapKernel1(ulong num, ulong arg1)
53 {
54  ulong ret;
55  asm volatile ("int $0x90" : "=a"(ret) : "a"(num), "c"(arg1) : "memory");
56  return ret;
57 }
58 
68 inline ulong trapKernel2(ulong num, ulong arg1, ulong arg2)
69 {
70  ulong ret;
71  asm volatile ("int $0x90" : "=a"(ret) : "a"(num), "c"(arg1), "b"(arg2) : "memory");
72  return ret;
73 }
74 
85 inline ulong trapKernel3(ulong num, ulong arg1, ulong arg2, ulong arg3)
86 {
87  ulong ret;
88  asm volatile ("int $0x90" : "=a"(ret) : "a"(num), "c"(arg1), "b"(arg2),
89  "d"(arg3) : "memory");
90  return ret;
91 }
92 
104 inline ulong trapKernel4(ulong num, ulong arg1, ulong arg2, ulong arg3,
105  ulong arg4)
106 {
107  ulong ret;
108  asm volatile ("int $0x90" : "=a"(ret) : "a"(num), "c"(arg1), "b"(arg2),
109  "d"(arg3), "S"(arg4) : "memory");
110  return ret;
111 }
112 
125 inline ulong trapKernel5(ulong num, ulong arg1, ulong arg2, ulong arg3,
126  ulong arg4, ulong arg5)
127 {
128  ulong ret;
129  asm volatile ("int $0x90" : "=a"(ret) : "a"(num), "c"(arg1), "b"(arg2),
130  "d"(arg3), "S"(arg4), "D"(arg5) : "memory");
131  return ret;
132 }
133 
141 #endif /* __LIB_LIBARCH_INTEL_INTELTRAPS_H */
trapKernel3
ulong trapKernel3(ulong num, ulong arg1, ulong arg2, ulong arg3)
Perform a kernel trap with 3 arguments.
Definition: IntelTraps.h:85
ulong
unsigned long ulong
Unsigned long number.
Definition: Types.h:47
Types.h
trapKernel1
ulong trapKernel1(ulong num, ulong arg1)
Perform a kernel trap with 1 argument.
Definition: IntelTraps.h:52
trapKernel2
ulong trapKernel2(ulong num, ulong arg1, ulong arg2)
Perform a kernel trap with 2 arguments.
Definition: IntelTraps.h:68
trapKernel4
ulong trapKernel4(ulong num, ulong arg1, ulong arg2, ulong arg3, ulong arg4)
Perform a kernel trap with 4 arguments.
Definition: IntelTraps.h:104
trapKernel5
ulong trapKernel5(ulong num, ulong arg1, ulong arg2, ulong arg3, ulong arg4, ulong arg5)
Perform a kernel trap with 5 arguments.
Definition: IntelTraps.h:125