m1x/x86_64: Load global descriptor table
Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
@@ -22,6 +22,7 @@ CFLAGS = \
|
|||||||
-D_KERNEL \
|
-D_KERNEL \
|
||||||
-I../../target/ \
|
-I../../target/ \
|
||||||
-I../../include/ \
|
-I../../include/ \
|
||||||
|
-I../../../sdk/include/
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(OFILES) $(ASMOFILES)
|
all: $(OFILES) $(ASMOFILES)
|
||||||
|
|||||||
17
src/m1x/arch/x86_64/cpu/cpu_init.c
Normal file
17
src/m1x/arch/x86_64/cpu/cpu_init.c
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2026, Mirocom Laboratories
|
||||||
|
* Provided under the BSD-3 clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/* From cpu/locore.S */
|
||||||
|
extern void md_cpu_lgdt(void *gdtr);
|
||||||
|
extern char g_GDTR[];
|
||||||
|
|
||||||
|
void
|
||||||
|
hal_cpu_init(void)
|
||||||
|
{
|
||||||
|
/* Load the GDT */
|
||||||
|
md_cpu_lgdt(g_GDTR);
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ _start:
|
|||||||
1: hlt
|
1: hlt
|
||||||
jmp 1b
|
jmp 1b
|
||||||
|
|
||||||
|
.globl md_cpu_lgdt
|
||||||
md_cpu_lgdt:
|
md_cpu_lgdt:
|
||||||
push %r12
|
push %r12
|
||||||
push %r13
|
push %r13
|
||||||
|
|||||||
14
src/m1x/include/hal/cpu.h
Normal file
14
src/m1x/include/hal/cpu.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2026, Mirocom Laboratories
|
||||||
|
* Provided under the BSD-3 clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_CPU_H_
|
||||||
|
#define _HAL_CPU_H_ 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the current processor
|
||||||
|
*/
|
||||||
|
void hal_cpu_init(void);
|
||||||
|
|
||||||
|
#endif /* !_HAL_CPU_H_ */
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <dev/cons/cons.h>
|
#include <dev/cons/cons.h>
|
||||||
|
#include <hal/cpu.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
kmain(void)
|
kmain(void)
|
||||||
@@ -11,5 +12,8 @@ kmain(void)
|
|||||||
/* Initialize the console */
|
/* Initialize the console */
|
||||||
cons_init();
|
cons_init();
|
||||||
|
|
||||||
|
/* Initialize the BSP */
|
||||||
|
hal_cpu_init();
|
||||||
|
|
||||||
for (;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user