2019-03-06 20:05:18 +01:00
|
|
|
;=----------------------------------------------------------------------------=;
|
2020-09-27 17:33:48 +02:00
|
|
|
; OS on Kaleid ;
|
2019-03-06 20:05:18 +01:00
|
|
|
; ;
|
|
|
|
; Desc: Memory Design Structures ;
|
|
|
|
; (x86_64 architecture only) ;
|
|
|
|
; ;
|
|
|
|
; ;
|
2021-02-18 19:54:35 +01:00
|
|
|
; Copyright © 2018-2021 The OS/K Team ;
|
2019-03-06 20:05:18 +01:00
|
|
|
; ;
|
|
|
|
; This file is part of OS/K. ;
|
|
|
|
; ;
|
|
|
|
; OS/K is free software: you can redistribute it and/or modify ;
|
|
|
|
; it under the terms of the GNU General Public License as published by ;
|
|
|
|
; the Free Software Foundation, either version 3 of the License, or ;
|
|
|
|
; (at your option) any later version. ;
|
|
|
|
; ;
|
|
|
|
; OS/K is distributed in the hope that it will be useful, ;
|
|
|
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of ;
|
|
|
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;
|
|
|
|
; GNU General Public License for more details. ;
|
|
|
|
; ;
|
|
|
|
; You should have received a copy of the GNU General Public License ;
|
|
|
|
; along with OS/K. If not, see <https://www.gnu.org/licenses/>. ;
|
|
|
|
;=----------------------------------------------------------------------------=;
|
|
|
|
|
|
|
|
[BITS 32]
|
2019-03-25 23:10:06 +01:00
|
|
|
extern kernelEnd
|
2019-05-11 22:26:40 +02:00
|
|
|
extern _bss
|
2019-03-25 23:10:06 +01:00
|
|
|
global newKernelEnd
|
2019-05-13 15:18:00 +02:00
|
|
|
global newStackEnd
|
2019-05-20 20:28:18 +02:00
|
|
|
global GDT64
|
2019-03-25 23:10:06 +01:00
|
|
|
|
|
|
|
[section .text]
|
2020-02-06 23:17:21 +01:00
|
|
|
KERNEL_STACK equ 8 * 1024 * 1024 ; 8MB of stack
|
2019-03-25 23:10:06 +01:00
|
|
|
newKernelEnd dq 0x0
|
2019-05-13 15:18:00 +02:00
|
|
|
newStackEnd dq 0x0
|
2019-05-11 22:26:40 +02:00
|
|
|
|
2019-03-12 22:11:00 +01:00
|
|
|
[section .rodata]
|
2019-03-06 20:05:18 +01:00
|
|
|
;; GDT WITH DOC
|
2019-03-06 20:05:18 +01:00
|
|
|
ALIGN 4096
|
2019-03-06 20:05:18 +01:00
|
|
|
GDT64:
|
2019-03-06 20:05:18 +01:00
|
|
|
;; Null selector within 64 bits
|
|
|
|
.null:
|
|
|
|
dq 0x0 ; Zero entry
|
|
|
|
;; 64-bit code selector (ring 0)
|
|
|
|
.code: equ $ - GDT64
|
|
|
|
dq (1<<43) | (1<<44) | (1<<47) | (1<<53)
|
|
|
|
; | | | |
|
|
|
|
; | | | `------ 64-bit selector
|
|
|
|
; | | `---------------- Present selector
|
|
|
|
; | `-------------------------- Descriptor type
|
|
|
|
; `------------------------------------ Executable segment
|
|
|
|
.pointer:
|
|
|
|
dw $ - GDT64 - 1
|
|
|
|
dq GDT64
|
2019-03-06 20:05:18 +01:00
|
|
|
|
2019-03-25 23:10:06 +01:00
|
|
|
|
2019-05-11 22:26:40 +02:00
|
|
|
;; EMPTY PAGE TABLES (identity of the first 4GiB)
|
2019-03-12 22:11:00 +01:00
|
|
|
[section .bss]
|
2019-03-06 20:05:18 +01:00
|
|
|
ALIGN 4096
|
2019-03-06 20:05:18 +01:00
|
|
|
PML4_table:
|
|
|
|
resb 4096
|
|
|
|
PDP_table:
|
|
|
|
resb 4096
|
|
|
|
PD_table:
|
2020-01-15 16:26:44 +01:00
|
|
|
resb 4096
|