From 28301499381cb541eec4eb99f61e3d1a193c5a2d Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Mon, 6 Mar 2017 02:15:28 +0100 Subject: gdt: expose code segment offset in GDT gdt_get_code_offset() returns the offset of the code segment in the GDT relative to the address of the GDT itself. This offset is for example required when setting the interrupt desriptor table. --- core/gdt.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core') diff --git a/core/gdt.c b/core/gdt.c index 708e2c5..b59bf9e 100644 --- a/core/gdt.c +++ b/core/gdt.c @@ -74,3 +74,8 @@ void gdt_init(void) gdtset(gdtp); } + +uint16_t gdt_get_code_offset(void) +{ + return GDT_SGMT_CODE * sizeof(*gdt); +} -- cgit v1.2.1