make is multithreaded u know ?

This commit is contained in:
Adrien Bourmault 2019-11-11 23:57:31 +01:00
parent 54bb670023
commit c80db82346
7 changed files with 82 additions and 165 deletions

View File

@ -105,5 +105,5 @@ IDT Overhaul
2019-11-08 @os-k-team <os-k-team@os-k.eu>
* Compilation process : beginning the modernization
2019-11-11 @os-k-team <os-k-team@os-k.eu>
* Compilation process : "unrooting" and enhancing the compilation process scripts
* Compilation process : "unrooting" and enhancing the compilation process scripts, multi-threading
* ProjectTree : better tree, without useless stuff

View File

@ -24,7 +24,7 @@
.PHONY: all test test32 debug gdb install dust clean OS/K
.DELETE_ON_ERROR: $(BINDIR)/kaleid
.DEFAULT_GOAL := all
## VARIABLES ----------------------------------------------------------------- #
@ -113,16 +113,13 @@ KernSources = kernel/ke/cpuid.c kernel/mm/paging.c \
kernel/io/spkr.c kernel/po/shtdwn.c \
kernel/sh/shell.c kernel/sh/shcmds.c \
kernel/sh/musage.c kernel/io/ata.c \
kernel/sh/argv.c
kernel/sh/argv.c kernel/ke/pit.c
KernObj=$(patsubst %.c,$(KOBJDIR)/%.o,$(KernSources))
KernDep=$(patsubst %.c,$(KOBJDIR)/%.d,$(KernSources))
## KALEID MAKEFILE ----------------------------------------------------------- #
all : OS/K
all :
make OS/K -j 8
## MISC MAKEFILE ------------------------------------------------------------- #

View File

@ -1,156 +0,0 @@
#=----------------------------------------------------------------------------=#
# GNU GPL OS/K #
# #
# Desc: #
# #
# #
# Copyright © 2018-2019 The OS/K Team #
# #
# This file is part of OS/K. #
# #
# OS/K is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# any later version. #
# #
# OS/K is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY# without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=#
.
├── boot
│   ├── grub
│   │   ├── grub.cfg
│   │   └── multiboot.pdf
│   ├── loader
│   │   ├── cpu
│   │   │   ├── cpu32.inc
│   │   │   └── cpu.inc
│   │   ├── io
│   │   │   └── terminal.inc
│   │   ├── mem
│   │   │   ├── management.inc
│   │   │   └── structures.inc
│   │   ├── multiboot
│   │   │   ├── check.inc
│   │   │   └── header.inc
│   │   └── loader.asm
│   └── folder.desc
├── build
│   ├── create_disk.sh
│   ├── install-os-k.sh
│   └── kernel.ld
├── include
│   ├── ex
│   │   ├── lock.h
│   │   └── malloc.h
│   ├── init
│   │   ├── boot.h
│   │   └── mboot.h
│   ├── io
│   │   ├── ata.h
│   │   ├── cursor.h
│   │   ├── keyb.h
│   │   ├── spkr.h
│   │   └── vga.h
│   ├── ke
│   │   ├── cpuid.h
│   │   ├── idt.h
│   │   ├── proc.h
│   │   ├── sched.h
│   │   ├── spinlock.h
│   │   └── time.h
│   ├── lib
│   │   ├── buf.h
│   │   └── list.h
│   ├── mm
│   │   ├── heap.h
│   │   ├── malloc.h
│   │   └── mm.h
│   ├── po
│   │   └── shtdwn.h
│   ├── sh
│   │   ├── argv.h
│   │   └── shell.h
│   ├── asm.h
│   ├── errno.h
│   ├── kernel.h
│   ├── libc.h
│   └── vers.h
├── kaleid
│   ├── kernel
│   │   ├── init
│   │   │   ├── info.c
│   │   │   ├── init.c
│   │   │   ├── ssp.c
│   │   │   └── table.c
│   │   ├── io
│   │   │   ├── ata.asm
│   │   │   ├── ata.c
│   │   │   ├── cursor.c
│   │   │   ├── keyb.c
│   │   │   ├── spkr.c
│   │   │   └── vga.c
│   │   ├── ke
│   │   │   ├── cpuf.asm
│   │   │   ├── cpuf.inc
│   │   │   ├── cpuid.c
│   │   │   ├── idt.c
│   │   │   ├── isr.asm
│   │   │   ├── log.c
│   │   │   ├── panic.c
│   │   │   └── rtc.c
│   │   ├── mm
│   │   │   ├── gdt.asm
│   │   │   ├── gdt.c
│   │   │   ├── heap.c
│   │   │   ├── malloc.c
│   │   │   ├── map.c
│   │   │   ├── paging.asm
│   │   │   └── paging.c
│   │   ├── po
│   │   │   └── shtdwn.c
│   │   ├── ps
│   │   │   └── sched.c
│   │   └── sh
│   │   ├── argv.c
│   │   ├── musage.c
│   │   ├── shcmds.c
│   │   ├── shell.c
│   │   └── shell.h
│   ├── libbuf
│   │   ├── bclose.c
│   │   ├── bflush.c
│   │   ├── bgetc.c
│   │   ├── bmisc.c
│   │   ├── bopen.c
│   │   ├── bprint.c
│   │   ├── bputc.c
│   │   ├── bread.c
│   │   ├── bscan.c
│   │   ├── bscroll.c
│   │   └── bwrite.c
│   └── libc
│   ├── atoi.c
│   ├── ctype.c
│   ├── errno.c
│   ├── itoa.c
│   ├── mem.c
│   ├── rand.c
│   ├── sprintf.c
│   ├── string.c
│   └── strtol.c
├── AUTHORS
├── ChangeLog
├── COPYING
├── Makefile
├── ProjectTree
└── README.md
28 directories, 100 files

View File

@ -43,6 +43,11 @@ struct Time_t
uchar century;
} __attribute__((packed));
struct TimerFilo_t {
uint countDown;
ulong sema; // semaphore, don't know how it is for instance
} __attribute__((packed));
void KeSetupRTC(void);
void KeEnableRTC(void);

View File

@ -37,6 +37,7 @@ typedef Spinlock_t Lock_t;
//typedef struct Lock_t Lock_t;
typedef struct Time_t Time_t;
typedef struct TimerFilo_t TimerFilo_t;
typedef struct Buffer_t Buffer_t;
typedef struct ListHead_t ListHead_t;
typedef struct ListNode_t ListNode_t;
@ -59,7 +60,7 @@ typedef struct MemoryMap_t MemoryMap_t;
typedef struct MapEntry_t MapEntry_t;
typedef struct GdtEntry_t GdtEntry_t;
typedef struct GdtPtr_t GdtPtr_t;
typedef struct Tss_t Tss_t;
typedef struct Tss_t Tss_t;
typedef struct TssDescriptor_t TssDescriptor_t;
//----------------------------------------------------------------------------//

67
kaleid/kernel/ke/pit.c Normal file
View File

@ -0,0 +1,67 @@
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Desc: RTC Time related functions //
// //
// //
// Copyright © 2018-2019 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#include <lib/buf.h>
#include <ke/time.h>
#include <ke/idt.h>
#define COUNTDONE 1
static TimerFilo_t timerFilo[20]; //20 concurrent sleep max
//
// ISR handler for the Programmable Interval Timer
//
static void HandleTimer(ISRFrame_t *regs)
{
for (uchar i = 0; i < 20; i++) {
if (timerFilo[i].countDown > 0) {
timerFilo[i].countDown--;
if (timerFilo[i].countDown == 0)
i; //XXX SendMessage a message to timerFifo[i].sema that COUNTDONE;
}
}
}
static TimerFilo_t* KeFindTimerBlock(void)
{
for(uchar i = 0; i < 20; i++) {
if (timerFilo[i].countDown == 0)
return &timerFilo[i];
}
return NULL;
}
void KeSleep(uint delay)
{
struct TimerFilo_t *timerBlock;
if ((timerBlock = (TimerFilo_t*)KeFindTimerBlock()) == NULL)
return;
timerBlock->countDown = delay;
// wait for a message on timerFifo[i].sema
}

View File

@ -168,6 +168,9 @@ static void GetTimeFromRTC(void)
CurTime.century = OriginTime.century;
}
//
// ISR handler for the real time clock
//
static void HandleRTC(ISRFrame_t *regs)
{
IoWriteByteOnPort(0x70, 0x0C); // Selects status reg C