UbixOS
2.0
bioscall.c
Go to the documentation of this file.
1
/*-
2
* Copyright (c) 2002-2018 The UbixOS Project.
3
* All rights reserved.
4
*
5
* This was developed by Christopher W. Olsen for the UbixOS Project.
6
*
7
* Redistribution and use in source and binary forms, with or without modification, are permitted
8
* provided that the following conditions are met:
9
*
10
* 1) Redistributions of source code must retain the above copyright notice, this list of
11
* conditions, the following disclaimer and the list of authors.
12
* 2) Redistributions in binary form must reproduce the above copyright notice, this list of
13
* conditions, the following disclaimer and the list of authors in the documentation and/or
14
* other materials provided with the distribution.
15
* 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to
16
* endorse or promote products derived from this software without specific prior written
17
* permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
20
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*/
28
29
#include <
sys/tss.h
>
30
#include <
ubixos/sched.h
>
31
#include <
vmm/vmm.h
>
32
#include <
lib/kmalloc.h
>
33
#include <
lib/bioscall.h
>
34
#include <lib/string.h>
35
#include <
sys/video.h
>
36
#include <
assert.h
>
37
38
39
asm
(
40
".globl bios16Code\n"
41
".code16 \n"
42
"bios16Code: \n"
43
"int $0x10 \n"
44
"int $0x69 \n"
45
".code32 \n"
46
);
47
48
49
void
biosCall
(
int
biosInt,
int
eax,
int
ebx,
int
ecx,
int
edx,
int
esi,
int
edi,
int
es,
int
ds) {
50
short
segment = 0x0,offset = 0x0;
51
uInt32
tmpAddr = (
uInt32
)&
bios16Code
;
52
kTask_t
*newProcess = 0x0;
53
54
offset = tmpAddr & 0xF;
// lower 4 bits
55
segment = tmpAddr >> 4;
56
57
newProcess =
schedNewTask
();
58
assert
(newProcess);
59
60
61
newProcess->
tss
.
back_link
= 0x0;
62
newProcess->
tss
.
esp0
= (
uInt32
)
kmalloc
(0x2000)+0x2000;
63
newProcess->
tss
.
ss0
= 0x10;
64
newProcess->
tss
.
esp1
= 0x0;
65
newProcess->
tss
.
ss1
= 0x0;
66
newProcess->
tss
.
esp2
= 0x0;
67
newProcess->
tss
.
ss2
= 0x0;
68
newProcess->
tss
.
cr3
= (
uInt32
)
_current
->
tss
.
cr3
;
//(uInt32)vmmCreateVirtualSpace(newProcess->id);
69
newProcess->
tss
.
eip
= offset & 0xFFFF;
70
newProcess->
tss
.
eflags
= 2 |
EFLAG_IF
|
EFLAG_VM
;
71
newProcess->
tss
.
eax
= eax & 0xFFFF;
72
newProcess->
tss
.
ebx
= ebx & 0xFFFF;
73
newProcess->
tss
.
ecx
= ecx & 0xFFFF;
74
newProcess->
tss
.
edx
= edx & 0xFFFF;
75
newProcess->
tss
.
esp
= 0x1000 & 0xFFFF;
76
newProcess->
tss
.
ebp
= 0x1000 & 0xFFFF;
77
newProcess->
tss
.
esi
= esi & 0xFFFF;
78
newProcess->
tss
.
edi
= edi & 0xFFFF;
79
newProcess->
tss
.
es
= es & 0xFFFF;
80
newProcess->
tss
.
cs
= segment & 0xFFFF;
81
newProcess->
tss
.
ss
= 0x1000 & 0xFFFF;
82
newProcess->
tss
.
ds
= ds & 0xFFFF;
83
newProcess->
tss
.
fs
= 0x0 & 0xFFFF;
84
newProcess->
tss
.
gs
= 0x0 & 0xFFFF;
85
newProcess->
tss
.
ldt
= 0x0 & 0xFFFF;
86
newProcess->
tss
.
trace_bitmap
= 0x0 & 0xFFFF;
87
newProcess->
tss
.
io_map
= 0x0 & 0xFFFF;
88
newProcess->
tss
.
io_map
=
sizeof
(
struct
tssStruct
)-8192;
89
newProcess->
oInfo
.
v86Task
= 0x1;
90
91
newProcess->
state
=
READY
;
92
93
while
(newProcess->
state
> 0);
94
95
return
;
96
}
97
98
/***
99
END
100
***/
101
taskStruct
Definition:
sched.h:62
uInt32
unsigned long int uInt32
Definition:
objgfx30.h:49
tssStruct::eip
long eip
Definition:
tss.h:47
tssStruct::ebx
long ebx
Definition:
tss.h:49
tssStruct::edx
long edx
Definition:
tss.h:49
tssStruct::ss1
short ss1
Definition:
tss.h:41
video.h
tssStruct::ldt
short ldt
Definition:
tss.h:66
tssStruct::ds
short ds
Definition:
tss.h:60
assert
#define assert(e)
Definition:
assert.h:64
assert.h
tssStruct::eflags
long eflags
Definition:
tss.h:48
vmm.h
tssStruct::esp0
long esp0
Definition:
tss.h:37
tssStruct::back_link
short back_link
Definition:
tss.h:35
taskStruct::tss
struct tssStruct tss
Definition:
sched.h:67
tssStruct::ss0
short ss0
Definition:
tss.h:38
sched.h
biosCall
void biosCall(int biosInt, int eax, int ebx, int ecx, int edx, int esi, int edi, int es, int ds)
Definition:
bioscall.c:49
tssStruct::ss2
short ss2
Definition:
tss.h:44
tssStruct::esp
long esp
Definition:
tss.h:50
EFLAG_IF
#define EFLAG_IF
Definition:
bioscall.h:35
tssStruct::ss
short ss
Definition:
tss.h:58
tssStruct::esp1
long esp1
Definition:
tss.h:40
osInfo::v86Task
uInt8 v86Task
Definition:
sched.h:52
tssStruct
Definition:
tss.h:34
tssStruct::es
short es
Definition:
tss.h:54
_current
kTask_t * _current
Definition:
sched.c:50
tssStruct::cs
short cs
Definition:
tss.h:56
schedNewTask
kTask_t * schedNewTask()
Definition:
sched.c:135
tssStruct::fs
short fs
Definition:
tss.h:62
tssStruct::edi
long edi
Definition:
tss.h:53
tssStruct::ecx
long ecx
Definition:
tss.h:49
tssStruct::io_map
short io_map
Definition:
tss.h:69
tssStruct::ebp
long ebp
Definition:
tss.h:51
kmalloc
void * kmalloc(uInt32 len)
Definition:
kmalloc.c:241
taskStruct::state
tState state
Definition:
sched.h:72
tssStruct::esi
long esi
Definition:
tss.h:52
READY
Definition:
sched.h:47
tssStruct::trace_bitmap
short trace_bitmap
Definition:
tss.h:68
bioscall.h
bios16Code
void bios16Code()
tssStruct::cr3
long cr3
Definition:
tss.h:46
tssStruct::esp2
long esp2
Definition:
tss.h:43
tssStruct::gs
short gs
Definition:
tss.h:64
EFLAG_VM
#define EFLAG_VM
Definition:
bioscall.h:37
kmalloc.h
tss.h
taskStruct::oInfo
struct osInfo oInfo
Definition:
sched.h:69
tssStruct::eax
long eax
Definition:
tss.h:49
arch
armv6
bioscall.c
Generated by
1.8.16