BarryServer : Git

All the code for all my projects
// BarryServer : Git / Orion / blob / d41a53cbc7d055b1c00cf0a339dbed6925f4f02c / proc / load.S

// Related

Orion

Barry Importing existing Orion kernel d41a53c (2 years, 4 months ago)
; This file is responsible for loading the tables onto the CPU.  The functions
; will load the GDT, IDT and TSS onto the CPU running the function.  They only
; provide a wrapper for the relevant x86 instruction, and do not do any table
; creation.  See the relevant C files for the table setup routines.  The GDT and
; IDT require a pointer to the table, while the TSS can be loaded from the
; currently loaded GDT.

[bits 32]

; Load the IDT
[global load_idt]
load_idt:
	mov eax, [esp + 4]
	lidt [eax]
	ret

; Load the GDT
[global load_gdt]
load_gdt:
	mov eax, [esp + 4]
	lgdt [eax]

	mov ax, 0x10
	mov ds, ax
	mov es, ax
	mov fs, ax
	mov gs, ax
	mov ss, ax
	jmp 0x08:.flush
.flush:
	ret

; Load the TSS
[global load_tss]
load_tss:
	mov ax, 0x28 | 3
	ltr ax
	ret