Clubcos  0.0.0
Clubcos - Clubc Operating System
 모두 데이타 구조 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 매크로 페이지들
port.h
이 파일의 문서화 페이지로 가기
1 // Copyright (c) 2014, 임경현 (dlarudgus20)
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 //
7 // * Redistributions of source code must retain the above copyright notice, this
8 // list of conditions and the following disclaimer.
9 //
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 
33 #ifndef PORT_H_
34 #define PORT_H_
35 
36 #include <stddef.h>
37 #include <stdint.h>
38 #include <stdbool.h>
39 
40 enum
41 {
42  EFLAG_2 = 0x00000002, // eflag에는 이 비트가 활성화되야 하는 것 같다.
43  EFLAG_IF = 0x00000200,
44  EFLAG_AC = 0x00040000,
45 };
46 
52 void ckAsmFarJmp(uint32_t eip, uint16_t cs);
53 
55 static inline uint8_t ckPortInByte(uint16_t port);
57 static inline void ckPortOutByte(uint16_t port, uint8_t data);
58 
64 static inline void ckAsmGetTimeStamp(uint32_t *high, uint32_t *low);
65 
67 static inline uint32_t ckAsmGetEFlag(void);
69 static inline void ckAsmSetEFlag(uint32_t eflag);
70 
72 static inline void ckAsmCli(void);
74 static inline void ckAsmSti(void);
76 static inline void ckAsmHlt(void);
77 
82 #define INTERRUPT_LOCK() \
83  uint32_t _eflag = ckAsmGetEFlag(); \
84  ckAsmCli()
85 
90 #define INTERRUPT_UNLOCK() \
91  ckAsmSetEFlag(_eflag)
92 
93 #include "port_impl.h"
94 
95 #include "control_register.h"
96 
97 #endif /* PORT_H_ */
Definition: port.h:43
Definition: port.h:42
uint8_t data[512]
Definition: task.h:819
void ckAsmFarJmp(uint32_t eip, uint16_t cs)
far jmp를 수행하는 어셈블리 함수입니다.
Definition: port.h:44