uKernel/src/arch/i386/gdt.S

35 lines
631 B
ArmAsm

/* $Id$ */
/* Copyright (c) 2018-2025 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS uKernel */
/* Originally from https://wiki.osdev.org/Bare_Bones */
/* text */
.section .text
/* arch_setgdt */
.global __arch_setgdt
#ifndef __clang__
.type __arch_setgdt, @function
#endif
__arch_setgdt:
lea gdt_descriptor, %ecx
/* set the offset of the GDT */
mov 0x4(%esp), %eax
mov %eax, 0x2(%ecx)
/* set the size of the GDT */
mov 0x8(%esp), %eax
dec %eax
mov %ax, (%ecx)
/* load the GDT */
lgdt (%ecx)
ret
/* bss */
.section .bss
.align 16
gdt_descriptor:
.skip 2 /* size */
.skip 4 /* offset */