More stuff

This commit is contained in:
Julian Barathieu 2018-12-30 20:13:56 +01:00
parent 4ae060bd5d
commit d4be0f4fd5
29 changed files with 64 additions and 47 deletions

View File

@ -13,7 +13,7 @@ COPTIM=-O2
CLDSCR=-T kernel.ld
CWARNS=-pedantic -Wall -Wextra -Werror
CFLAGS=-nostdlib -ffreestanding -mcmodel=large -mno-red-zone -mno-mmx -mno-sse -mno-sse2
CINCLUDES=-I./kaleid
CINCLUDES=-isystem.
CDEFINES=
CC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CDEFINES) $(CINCLUDES)

View File

@ -11,7 +11,7 @@
#define _KALCOMM_ASSERT_H
#ifndef _KALCOMM_COMMON_H
# error "don't include common/types.h without common/common.h"
# error "don't include kaleid/common/types.h without kaleid/common/common.h"
#endif
#ifdef _OSK_SOURCE

View File

@ -11,7 +11,7 @@
#define _KALCOMM_ATOMIC_H
#ifndef _KALCOMM_COMMON_H
# error "don't include common/types.h without common/common.h"
# error "don't include kaleid/common/types.h without kaleid/common/common.h"
#endif
// atomic_t defined in common/types.h

View File

@ -42,13 +42,13 @@
#endif
#ifdef _KALEID_KERNEL
# include "kernel/config.h"
# include <kaleid/kernel/config.h>
#endif
#include "common/types.h"
#include "common/atomic.h"
#include "common/status.h"
#include "common/assert.h"
#include <kaleid/common/types.h>
#include <kaleid/common/atomic.h>
#include <kaleid/common/status.h>
#include <kaleid/common/assert.h>
#endif

View File

@ -11,7 +11,7 @@
#define _KALCOMM_CONVERT_H
#ifndef _KALCOMM_COMMON_H
#include "common/common.h"
#include <kaleid/common/common.h>
#endif
#ifndef _OSK_SOURCE

View File

@ -7,7 +7,7 @@
// Desc: Conversion utilities //
//----------------------------------------------------------------------------//
#include "common/string.h"
#include <kaleid/common/string.h>
//
// Digits table for bases <=36

View File

@ -7,7 +7,7 @@
// Desc: mem*() functions //
//----------------------------------------------------------------------------//
#include "common/memory.h"
#include <kaleid/common/memory.h>
//
// Set "bytes"-many bytes starting from ptr to val

View File

@ -7,7 +7,7 @@
// Desc: sprintf()-related functions //
//----------------------------------------------------------------------------//
#include "common/string.h"
#include <kaleid/common/string.h>
//
// Format str according to fmt using ellipsed arguments

View File

@ -7,7 +7,7 @@
// Desc: Implementation of describe_status() //
//----------------------------------------------------------------------------//
#include "common/common.h"
#include <kaleid/common/common.h>
static const char *descriptions[] = {
[-SUCCESS] = "Success",

View File

@ -7,7 +7,7 @@
// Desc: String-related functions //
//----------------------------------------------------------------------------//
#include "common/string.h"
#include <kaleid/common/string.h>
// TODO multibyte, assembly

View File

@ -11,7 +11,7 @@
#define _KALCOMM_MEMORY_H
#ifndef _KALCOMM_COMMON_H
# include "common/common.h"
# include <kaleid/common/common.h>
#endif
#ifndef _OSK_SOURCE

View File

@ -11,7 +11,7 @@
#define _KALCOMM_STATUS_H
#ifndef _KALCOMM_COMMON_H
# error "don't include common/types.h without common/common.h"
# error "don't include kaleid/common/types.h without kaleid/common/common.h"
#endif
#ifndef _OSK_SOURCE

View File

@ -12,11 +12,11 @@
#define _KALCOMM_STRING_H
#ifndef _KALCOMM_COMMON_H
# include "common/common.h"
# include <kaleid/common/common.h>
#endif
#ifndef _KALCOMM_CONVERT_H
# include "common/convert.h"
# include <kaleid/common/convert.h>
#endif
#ifndef _OSK_SOURCE

View File

@ -10,7 +10,7 @@
// XXX to be improved before being brought back
// to be tested with more alignment sizes
#include "common/memory.h"
#include <kaleid/common/memory.h>
// to be moved
#define QWORD_SIZE 8

View File

@ -12,7 +12,7 @@
#define _KALCOMM_TYPES_H
#ifndef _KALCOMM_COMMON_H
# error "don't include common/types.h without common/common.h"
# error "don't include kaleid/common/types.h without kaleid/common/common.h"
#endif
typedef unsigned char uchar;

View File

@ -7,18 +7,25 @@
// Desc: Kernel entry point //
//----------------------------------------------------------------------------//
#include "kernel/init.h"
#include "kernel/ke/panic.h"
#include "kernel/io/terminal.h"
#include <kaleid/kernel/init.h>
#include <kaleid/kernel/ke/panic.h>
#include <kaleid/kernel/io/terminal.h>
//
// Entry point of kaleid-kernel.elf
//
void kstart(void)
void DosStartKern(void)
{
// we're not ready to deal with interrupts
DosDisableInterrupts();
// booting!
DosSetKernState(KSTATE_INIT);
// kernel terminals
DosInitTerms();
// we're out
DosPanic("Goodbye World :(");
}

View File

@ -10,10 +10,10 @@
#ifndef _KALKERN_INIT_H
#define _KALKERN_INIT_H
#include "common/common.h"
#include <kaleid/common/common.h>
// kernel entry point
void kstart(void);
void DosStartKern(void);
#endif

View File

@ -7,7 +7,7 @@
// Desc: Ports I/O //
//----------------------------------------------------------------------------//
#include "kernel/io/ports.h"
#include <kaleid/kernel/io/ports.h>

View File

@ -11,7 +11,7 @@
#define _KALKERN_IO_PORTS_H
#ifndef _KALCOMM_COMMON_H
#include "common/common.h"
#include <kaleid/common/common.h>
#endif
#define DosWriteByteOnPort(port,val) asm volatile ("outb %1, %0" : : "dN" (port), "a" (value))

View File

@ -7,7 +7,7 @@
// Desc: Early terminal functions //
//----------------------------------------------------------------------------//
#include "kernel/io/terminal.h"
#include <kaleid/kernel/io/terminal.h>
//
// VGA-related macros
@ -37,6 +37,13 @@ static terminal_t _vga_term = {
//
terminal_t *stdout;
#ifndef _NO_DEBUG
//
// Debugging terminal
//
terminal_t *stddbg;
#endif
//
// Initialize standard output
//
@ -46,6 +53,7 @@ void DosInitTerms(void)
#ifndef _NO_DEBUG
_vga_term.kt_init = TRUE;
stddbg = &_vga_term;
#endif
// to be switched to VESA

View File

@ -11,7 +11,7 @@
#define _KALKERN_IO_KTERM_H
#ifndef _KALCOMM_COMMON_H
#include "common/common.h"
#include <kaleid/common/common.h>
#endif
// all available colors
@ -53,10 +53,12 @@ status_t DosChTermColor(terminal_t *, uchar);
void DosPutOnTerm_Unlocked(terminal_t *, char);
#endif
#define ktclear() kterm_clear(kt_stdout)
#define ktputch(c) kterm_putch(kt_stdout, (c))
#define ktprint(s) kterm_print(kt_stdout, (s))
#define ktchcol(c) kterm_change_color(kt_stdout, (c))
#ifndef _NO_DEBUG
extern terminal_t *stddbg;
# define DebugLog(...) DosPutOnTerm(stddbg, __VA_ARGS__)
#else
# define DebugLog(...)
#endif
#define DosLockTerm(kt)
#define DosTryLockTerm(kt)

View File

@ -7,9 +7,9 @@
// Desc: How NOT to panic 101 //
//----------------------------------------------------------------------------//
#include "kernel/ke/panic.h"
#include "kernel/ke/state.h"
#include "kernel/io/terminal.h"
#include <kaleid/kernel/ke/panic.h>
#include <kaleid/kernel/ke/state.h>
#include <kaleid/kernel/io/terminal.h>
//
// Panic message

View File

@ -10,7 +10,7 @@
#ifndef _KALKERN_KE_PANIC_H
#define _KALKERN_KE_PANIC_H
#include "kernel/ke/state.h"
#include <kaleid/kernel/ke/state.h>
extern const char *__panicstr;
noreturn void DosPanic(const char *);

View File

@ -7,7 +7,7 @@
// Desc: Current kernel state //
//----------------------------------------------------------------------------//
#include "kernel/ke/state.h"
#include <kaleid/kernel/ke/state.h>
//
// Current kernel state

View File

@ -11,7 +11,7 @@
#define _KALKERN_KE_STATE_H
#ifndef _KALCOMM_COMMON_H
#include "common/common.h"
#include <kaleid/common/common.h>
#endif
// XXX improve this

View File

@ -8,5 +8,5 @@
// Only exists to trigger Neox //
//----------------------------------------------------------------------------//
#include "kernel/mm/malloc.h"
#include <kaleid/kernel/mm/malloc.h>

View File

@ -11,7 +11,7 @@
#ifndef _KALKERN_MM_MALLOC_H
#define _KALKERN_MM_MALLOC_H
#include "common/common.h"
#include <kaleid/common/common.h>
#endif

View File

@ -11,9 +11,9 @@
#include <stdio.h>
#define KEEP_KALCOMM_TYPES_MINIMAL
#include "common/common.h"
#include "common/string.h"
#include "common/memory.h"
#include <kaleid/common/common.h>
#include <kaleid/common/string.h>
#include <kaleid/common/memory.h>
int main(int argc, char *argv[])
{

View File

@ -1,4 +1,4 @@
ENTRY(kstart)
ENTRY(DosStartKern)
SECTIONS
{
. = 0x4000; /* XXX 0x4000 is temporary */