Linux Operating System-8

來源:Memory Addressing (22 ~ 54) Phase two Phase one只會用到實體記憶體中的24MB,phase two則是會用到所有的記憶體空間來放置kernel code。phase two有兩種不同狀況:CONFIG_HIGHMEM與CONFIG_NOHIGHMEM,CONFIG_NOHIGHMEM是指kernel能存取的實體記憶體小於1GB,而CONFIG_HIGHMEM則是kernel能夠存

Linux Operating System-7

來源:Paging in Linux(23 ~ 32, 40, 52 ~ 55),Memory Addressing (1 ~ 21) Paging in Linux 由於x86在32bit下有兩層的page table(PAE沒開情況下),而在64bit下有更多層,因此linux為了要在兩種處理器底下都能跑選擇了較高層的paging level。在2.6.10版本linux paging level有三層,從2.6.11版本之後

Linux Operating System-6

來源:Memory Addressing: Paging Unit (18 ~ 47),wiki:Paging 上禮拜講到Paging Unit是利用兩層page table來完成address轉換,這邊接著講為何需要用到兩層table。原本兩層的話是利用linear address最前面10個bit來表示page directory的entry,中間的10個bit表示page table的entry,最後12bit則是physical

Linux Operating System-5

來源:Introduction and Memory Addressing: Segmentation Unit (80 ~ 100),Memory Addressing: Paging Unit (1 ~ 18) 由於現在的電腦都是多核心架構,一台電腦在run時不會只有一顆CPU,而接下來要講的GDT這個table每一顆CPU都會有一個GDT,因此在C語言有一種特殊的宣告方式:per-CPU,他會將你宣告的值存在陣列當中,而這個陣列的

Linux Operating System-4

來源:Introduction and Memory Addressing: Segmentation Unit (21 ~ 49, 72 ~ 83) Memory Addressing(x32) 在進入主題之前,先來複習一下第一堂課講過的三種address: Logical Addresses 主要是由segment base address加上offset組成,segment base address會在segment

Linux Operating System-3

來源:Introduction (99 ~ 116),Introduction and Memory Addressing: Segmentation Unit (1 ~ 20) Execution Mode of IA32 在x86架構的processor分為real mode以及protected mode,而在protected mode底下又分為ring0、ring1、ring2、ring3,linux kernel只用到了r

Linux Operating System-2

來源:Introduction (64~98) Linux Source Code Tree Overview跟System Boot up我就跳過了… x32 Calling Conventions 這邊要介紹的是,當C呼叫一個function時參數的傳遞。關於stack frame我在網路攻防這邊有提到一些基礎知識,重複的在這邊就不再贅述。假設今天G function要呼叫H function,則我們稱呼叫者G為caller,被呼

Linux Operating System-1

來源:Introduction (1~52),x86-64,x86 Intel x86 Architecture 講x86之前當然要先講一下它的由來,x86是intel的指令集架構,Intel這家公司成立於1968年,他最早創造了全球第一顆微處理器4004,然後演變成了8位元的CPU 8008,到了1978年x86架構正式誕生,第一款x86架構的處理器是8086,它是一個16位元的處理器,直到80386之後變成了32位元的cpu,