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 CLDSCR=-T kernel.ld
CWARNS=-pedantic -Wall -Wextra -Werror CWARNS=-pedantic -Wall -Wextra -Werror
CFLAGS=-nostdlib -ffreestanding -mcmodel=large -mno-red-zone -mno-mmx -mno-sse -mno-sse2 CFLAGS=-nostdlib -ffreestanding -mcmodel=large -mno-red-zone -mno-mmx -mno-sse -mno-sse2
CINCLUDES=-I./kaleid CINCLUDES=-isystem.
CDEFINES= CDEFINES=
CC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CDEFINES) $(CINCLUDES) CC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CDEFINES) $(CINCLUDES)

View File

@ -11,7 +11,7 @@
#define _KALCOMM_ASSERT_H #define _KALCOMM_ASSERT_H
#ifndef _KALCOMM_COMMON_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 #endif
#ifdef _OSK_SOURCE #ifdef _OSK_SOURCE

View File

@ -11,7 +11,7 @@
#define _KALCOMM_ATOMIC_H #define _KALCOMM_ATOMIC_H
#ifndef _KALCOMM_COMMON_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 #endif
// atomic_t defined in common/types.h // atomic_t defined in common/types.h

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,7 +11,7 @@
#define _KALCOMM_STATUS_H #define _KALCOMM_STATUS_H
#ifndef _KALCOMM_COMMON_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 #endif
#ifndef _OSK_SOURCE #ifndef _OSK_SOURCE

View File

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

View File

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

View File

@ -12,7 +12,7 @@
#define _KALCOMM_TYPES_H #define _KALCOMM_TYPES_H
#ifndef _KALCOMM_COMMON_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 #endif
typedef unsigned char uchar; typedef unsigned char uchar;

View File

@ -7,18 +7,25 @@
// Desc: Kernel entry point // // Desc: Kernel entry point //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include "kernel/init.h" #include <kaleid/kernel/init.h>
#include "kernel/ke/panic.h" #include <kaleid/kernel/ke/panic.h>
#include "kernel/io/terminal.h" #include <kaleid/kernel/io/terminal.h>
// //
// Entry point of kaleid-kernel.elf // 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); DosSetKernState(KSTATE_INIT);
// kernel terminals
DosInitTerms(); DosInitTerms();
// we're out
DosPanic("Goodbye World :("); DosPanic("Goodbye World :(");
} }

View File

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

View File

@ -7,7 +7,7 @@
// Desc: Ports I/O // // 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 #define _KALKERN_IO_PORTS_H
#ifndef _KALCOMM_COMMON_H #ifndef _KALCOMM_COMMON_H
#include "common/common.h" #include <kaleid/common/common.h>
#endif #endif
#define DosWriteByteOnPort(port,val) asm volatile ("outb %1, %0" : : "dN" (port), "a" (value)) #define DosWriteByteOnPort(port,val) asm volatile ("outb %1, %0" : : "dN" (port), "a" (value))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,5 +8,5 @@
// Only exists to trigger Neox // // 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 #ifndef _KALKERN_MM_MALLOC_H
#define _KALKERN_MM_MALLOC_H #define _KALKERN_MM_MALLOC_H
#include "common/common.h" #include <kaleid/common/common.h>
#endif #endif

View File

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

View File

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