Implemented DMA.
[planlOS.git] / system / include / ke / cpu.h
blob806ab7326b421d832fa1ae02c6c4450644ea79f3
1 /*
2 Copyright (C) 2008 Mathias Gottschlag
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in the
6 Software without restriction, including without limitation the rights to use,
7 copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8 Software, and to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 #ifndef KE_CPU_H_INCLUDED
23 #define KE_CPU_H_INCLUDED
25 #include <stdint.h>
26 #include "ke/thread.h"
28 typedef struct
30 uint32_t id;
31 uint32_t running;
32 KeThread *idlethread;
33 KeThread *currentthread;
34 uint32_t interrupt;
35 } KeCPU;
37 // TODO: cpuid
38 int keCPUID(uint32_t code, uint32_t *output);
40 void keWriteMSR(uint32_t index, uint64_t value);
41 uint64_t keReadMSR(uint32_t index);
43 KeCPU *keAddCPU(uint32_t id);
44 KeCPU *keGetCurrentCPU(void);
45 uint32_t keGetCPUCount(void);
47 #endif