Assembly
-
[Multithreaded Kernel] 2-1. Protected ModeOS/Multi-threaded Kernel from Scratch 2021. 8. 23. 12:27
서론 이번 글에서는 32bit protected mode 개발에 대해 다루겠습니다. 에 대해 알아보겠습니다. 이론 Protected Mode Protected Mode에서는 다음 기능을 지원합니다. 메모리&하드웨어 보호 각 프로세스에 대한 접근 제한 설정 가능 (Ring 0, Ring 1, ...; Ring 0: Kernel) 다양한 메모리 Scheme Segmentation 레지스터가 차지하는 메모리 범위와 접근 권한을 담은 특정 자료구조를 가리킴 Paging: 가상 주소가 실제 주소를 가리키게 함 4Gb 메모리 사용 가능 (Real Mode에서는 1Mb만 사용 가능했음) Protected Mode로 진입하는 순서는 다음과 같습니다. Interrupt 비활성화 GDT Load CPU의 control 레..
-
[Multithreaded Kernel] 1. Real ModeOS/Multi-threaded Kernel from Scratch 2021. 8. 1. 23:18
서론 이번 글에서는 16bit real mode 개발에 대해 다루겠습니다. Bootloader, Segmentation, BPB, Interrupt Vector Table, Disk I/O에 대해 알아보겠습니다. 이론 Bios & Bootloader Bios는 ROM(Read Only Memory)에 상주하는 프로그램으로써 하드웨어들을 초기화/점검하고 Bootloader을 불러오며, Bootloader는 Kernel을 불러옵니다. 컴퓨터가 켜지면서 Bios는 스스로 RAM위에 올려져 실행됩니다. Bios는 16bit code만 실행 가능 Bios는 Bootloader를 불러오기 위해 모든 저장장치(하드디스크, USB, Floppu Disk etc)들의 첫 번째 Sector를 확인하면서 Boot Signa..
-
[Multi-threaded Kernel] 0. Basic AssemblyOS/Multi-threaded Kernel from Scratch 2021. 7. 29. 18:03
서론 이번 강의에서 Kernel 개발을 위해 필요한 Assembly 문법을 배워보겠습니다. 이론 Register ax ah (High Byte) al (Low Byte) ip: 현재 진행되고 있는 instruction의 주소 가리킴 sp: Stack 포인터 ds: Data Segment Assembly에서 메모리 주소에 접근할 때 Data Segment 고려 절대 주소 계산: (ds값)*16+offset 메모리 주소가 매우 크기 때문에 하나의 레지스터로 표현 못하기 때문 ss: Stack Segment cs: Code Segment org 100h 작성한 프로그램이 해당 메모리 주소(100h; h: 16진수)에 불러오게 하여 offset 설정 int 10h 10h Interrupt 호출; 10h: 화면에..
-
[OS] 18. InterruptsOS/OS from Scratch 2021. 7. 3. 16:43
서론 이번 강의에서는 Interrupt Service를 구현해보겠습니다. 해당 Github 강의는 다음과 같습니다. https://github.com/cfenollosa/os-tutorial/tree/master/18-interrupts cfenollosa/os-tutorial How to create an OS from scratch. Contribute to cfenollosa/os-tutorial development by creating an account on GitHub. github.com 이론 ISR (Interrupt Service Routine) CPU가 A 작업을 하고 있다가 키보드 입력과 같은 Interrupt을 받으면 CPU는 현재 진행 중인 A 작업을 멈추고 Interrupt S..
-
[OS] 16. Video DriverOS/OS from Scratch 2021. 7. 2. 14:08
서론 이번 강의에서는 이전 강의에서 사용했던 이론과 코드를 응용해 화면에 문자열을 출력해보겠습니다. 해당 Github 강의는 다음과 같습니다. https://github.com/jschang0215/os-tutorial/tree/master/16-video-driver jschang0215/os-tutorial How to create an OS from scratch. Contribute to jschang0215/os-tutorial development by creating an account on GitHub. github.com 코드 screen.h #define VIDEO_ADDRESS 0xb8000 #define MAX_ROWS 25 #define MAX_COLS 80 #define WHIT..
-
[OS] 15. Video PortsOS/OS from Scratch 2021. 6. 30. 20:19
서론 이번 강의에서는 VGA와 Data Ports의 사용법에 대해 공부하겠습니다. 해당 Github 강의는 다음과 같습니다. https://github.com/cfenollosa/os-tutorial/tree/master/15-video-ports cfenollosa/os-tutorial How to create an OS from scratch. Contribute to cfenollosa/os-tutorial development by creating an account on GitHub. github.com 이론 I/O Programming Input/Output을 담당하는 하드웨어 장치는 Controller Chip을 통해 CPU와 상호작용합니다. Controller Chip에는 CPU가 읽고 쓸..
-
[OS] 13. Kernel BarebonesOS/OS from Scratch 2021. 6. 27. 15:07
서론 이번 강의에서는 Kernel과 boot sector를 연결해 kernel을 실행시켜 보겠습니다. 해당 Github 강의는 다음과 같습니다. https://github.com/cfenollosa/os-tutorial/tree/master/13-kernel-barebones cfenollosa/os-tutorial How to create an OS from scratch. Contribute to cfenollosa/os-tutorial development by creating an account on GitHub. github.com 이론 Kernel Kernel은 하드웨어 바로 위 단계에서 작동하며 애플리케이션들의 CPU와 메모리 등의 리소스를 관리하는 메모리에 항상 상주하고 있는 프로그램입니다..
-
[OS] 12. Kernel COS/OS from Scratch 2021. 6. 26. 15:41
서론 이번 강의에서는 C언어로 지금까지 작성했던 Low-Level 코드들을 만들겠습니다. 해당 Github 강의는 다음과 같습니다. https://github.com/cfenollosa/os-tutorial/tree/master/12-kernel-c cfenollosa/os-tutorial How to create an OS from scratch. Contribute to cfenollosa/os-tutorial development by creating an account on GitHub. github.com 이론 Linking 이 블로그에서 Linking에 대해 알기 쉽게 설명해 놓았습니다. A.cpp라는 파일을 컴파일하면 A.o라는 Object Code가 생성되는데, 이 Object Code는 ..