Skip to content

Commit 08793d8

Browse files
committed
* partialy Implemented task changing
* Added new command tsk
1 parent de32de2 commit 08793d8

File tree

7 files changed

+93
-96
lines changed

7 files changed

+93
-96
lines changed

.github/workflows/BASIC.yml

-34
This file was deleted.

.github/workflows/c-cpp.yml

+10-19
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,29 @@
1-
name: Build ISO
2-
31
on:
42
push:
53
branches: [ master ]
64
pull_request:
75
branches: [ master ]
86

97
jobs:
10-
build:
8+
build_stable:
119

1210
runs-on: ubuntu-latest
1311

1412
steps:
1513
- uses: actions/checkout@v2
1614
- name: install tools
1715
run: make prep
18-
- name: Install grub
19-
run: make Install-Grub-BIOS
2016
- name: make move
21-
run: make move
17+
run: make move GRUB=pt
2218

2319
- name: Upload Build files
2420
uses: actions/upload-artifact@v2
2521
with:
26-
name: SectorOS_Artifact-Build
27-
path: Build_files
28-
29-
- name: Create release
30-
uses: "marvinpinto/action-automatic-releases@latest"
31-
with:
32-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
33-
automatic_release_tag: "latest"
34-
prerelease: false
35-
title: Automatic Release Commit
36-
files: |
37-
Build_files/*.iso
38-
Build_files/*.bin
22+
name: SectorOS_ISO
23+
path: Build_files/SectorOS.iso
24+
25+
- name: Upload Build files
26+
uses: actions/upload-artifact@v2
27+
with:
28+
name: SectorOS_Kernel
29+
path: Build_files/SectorOS_Kernel.bin

CPU/Interrupts.cpp

+12-11
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,6 @@ uint32_t InterruptManager::DoHandleInterrupt(uint8_t interrupt, uint32_t esp)
173173
printf(foo);
174174
printHex(interrupt);
175175
}
176-
/*
177-
else if(interrupt == 0x0D)
178-
{
179-
printf("\5");
180-
printf("A Kernel Panic Occured. HALTING...\nSYSMSG:: EXCEPTION: GENERAL PROTECTION FAULT\n");
181-
printf("An exception has occured in the system during execution which cannot fix itself.The general protection fault is called when a function is improperly executed which leads to memory corruption.Restarting may solve thr problem.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
182-
printf("Execption stack pointer = 0x"); printHex(esp);
183-
printf("\nExecption interrupt number = 0x"); printHex(interrupt);
184-
Power.halt();
185-
}
186-
*/
187176
else if(interrupt = 0x20)
188177
{
189178
if(isTaskAllowed)
@@ -209,3 +198,15 @@ void InterruptManager::UseMultiTask(int OPT)
209198
else if(OPT == 0)
210199
isTaskAllowed = false;
211200
}
201+
202+
/*
203+
void InterruptManager::HandleException0x0D()
204+
{
205+
printf("\5");
206+
printf("A Kernel Panic Occured. HALTING...\nSYSMSG:: EXCEPTION: GENERAL PROTECTION FAULT\n");
207+
printf("An exception has occured in the system during execution which cannot fix itself.The general protection fault is called when a function is improperly executed which leads to memory corruption.Restarting may solve thr problem.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
208+
//printf("Extended stack pointer = 0x"); printHex(esp);
209+
//printf("\nExecption interrupt number = 0x"); printHex(interrupt);
210+
Power.halt();
211+
}
212+
*/

Drivers/Keyboard.cpp

+27-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ void PrintDate();
1010
char* INTTOCHARPOINT(int num);
1111
void ColourPrint(int type);
1212
bool txtcolor;
13+
bool isESPChanged = false;
14+
GlobalDescriptorTable gdt;
15+
void taskA();
16+
void taskB();
1317
const void* mb;
1418
void PrintHDD();
1519
void detect_cpu();
@@ -26,6 +30,10 @@ DataPort(0x60),
2630
CommandPort(0x64)
2731
{
2832
isTxtMode = false;
33+
Task task1(&gdt, taskA);
34+
Task task2(&gdt, taskB);
35+
taskManager.AddTask(&task1);
36+
taskManager.AddTask(&task2);
2937
}
3038

3139
KeyboardDriver::~KeyboardDriver()
@@ -47,6 +55,17 @@ void KeyboardDriver::activate()
4755

4856
uint32_t KeyboardDriver::HandleInterrupt(uint32_t esp)
4957
{
58+
esp2 = esp;
59+
if(isESPChanged)
60+
{
61+
printf("\n");
62+
printHex(esp);
63+
printf(":");
64+
printHex(esp1);
65+
printf("task changed");
66+
isESPChanged = false;
67+
return esp1;
68+
}
5069
uint8_t key = DataPort.ReadFromPort(); // The variable where a single keystroke is stored
5170
if(key < 0x80 & key != 0x3A & key != 0x2A & key != 0x2A & key != 0x36 & key != 0x3A & key != 0x0E & key != 0x38 & key != 0x1D ){
5271
key_buffer[keybufferpoint] = KeycodeToASCII(key);
@@ -309,7 +328,7 @@ void KeyboardDriver::CommandInterpreter() // SOSH v1.0.3 [SectorOS SHell]. 11 Co
309328
else if (key_buffer[5] == "3")
310329
printf("Help page 3:\nspi : To print the data in serial port 0x3F8.\nspo : To write data to serial port 0x3F8.\nsysinfo [option] : To get info about system.\nvga : To use experimental vga graphics.");
311330
else if (key_buffer[5] == "4")
312-
printf("Help page 4:\nlspt: To list partitions in a drive.");
331+
printf("Help page 4:\nlspt: To list partitions in a drive.\ntsk:to change instance.[EXPERIMENTAL]");
313332
else
314333
printf("Help page 1:\necho <message> : to print the message in the console \nhelp : to show this message \nclear : to clear the screen \nsd <options> : controls the power of the computer ");
315334
}
@@ -461,6 +480,13 @@ void KeyboardDriver::CommandInterpreter() // SOSH v1.0.3 [SectorOS SHell]. 11 Co
461480
COMNAME = "lspt";
462481
PrintPartitions();
463482
}
483+
else if(key_buffer[0] == "t" && key_buffer[1] == "s" && key_buffer[2] == "k")
484+
{
485+
esp1 = (uint32_t)taskManager.Schedule((CPUState*)esp1);
486+
printf("esp1 is :"); printHex(esp1); printf("\n");
487+
printf("esp2 is :"); printHex(esp2);
488+
isESPChanged = true;
489+
}
464490
else
465491
{
466492
printf("Unknown Command. Type help in console to get all the commands");

Drivers/Keyboard.h

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ class KeyboardDriver : public InterruptHandler, public Driver // Driver for keyb
2929
~KeyboardDriver();
3030
virtual uint32_t HandleInterrupt(uint32_t esp);
3131
// To change the keycode to ascii to write it into string
32+
TaskManager taskManager;
33+
uint32_t esp1;
34+
uint32_t esp2;
3235
char* KeycodeToASCII(uint8_t Keycode);
3336
char* key_buffer[256]; // To Save the keystrokes in memory to use them later. Max number keystroke to save in the buffer is 256 Chars
3437
// To clear the keystrokes in the keyboard buffer

Includes/Public_VAR.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
inline char* OS_NAME = "SectorOS";
55

66
inline char* KERNEL_NAME = "SectorOS";
7-
inline char* KERNEL_VERSION = "V2.1.0";
8-
inline char* KERNEL_BUILD = "Build: 2021-11-25";
7+
inline char* KERNEL_VERSION = "V2.1.3";
8+
inline char* KERNEL_BUILD = "Build: 2021-12-02";
99
inline char* KERNEL_ARCH = "x86";
1010

1111
inline char* SHELL_NAME = "SOSH";
12-
inline char* SHELL_VER = "V1.0.7";
12+
inline char* SHELL_VER = "V1.0.8";
1313

1414
#endif

kernel/kernel.cpp

+38-28
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include"../CPU/Interrupts.h"
44
#include "../Drivers/IOPorts.h"
55
#include "../Drivers/Keyboard.h"
6+
#include "../Includes/multiboot.h"
67
#include "../Drivers/Mouse.h"
78
#include "../Drivers/Driver.h"
89
#include "../Drivers/RTC.h"
@@ -22,6 +23,9 @@ static bool useMouse = true;
2223
bool isused;
2324
bool isTxtMode;
2425
extern const void* mb;
26+
uint32_t mm;
27+
extern GlobalDescriptorTable gdt;
28+
extern TaskManager taskManager;
2529
AdvancedTechnologyAttachment ata0m(0x1F0, true);
2630
AdvancedTechnologyAttachment ata0s(0x1F0, false);
2731

@@ -703,29 +707,40 @@ class MouseToConsole : public MouseEventHandler
703707

704708
};
705709

706-
void taskA()
710+
void taskB()
707711
{
708-
while(1)
709-
{
710-
printf("A");
711-
}
712+
printf("Welcome to SectorOS Shell instance 2\nRun help to get the list of commands which is implemented \n \n");
713+
TaskManager taskManager;
714+
GlobalDescriptorTable gdt;
715+
InterruptManager interrupts(0x20, &gdt, &taskManager);
716+
KeyboardDriver boardDriver(&interrupts);
717+
DriverManager drvmgr;
718+
drvmgr.AddDriver(&boardDriver);
719+
PCI PCICONT;
720+
PCICONT.SelectDrivers(&drvmgr, &interrupts);
721+
drvmgr.activateall();
722+
printf("#:");
723+
while (1);
712724
}
713-
void NewInstance()
714-
{
715-
printf("\5");
716-
717-
printf("Welcome to SectorOS Monolithic kernel ");PrintDate();printf(" Type: Shell\nhttps://github.com/Arun007coder/SectorOS \n");
718-
719-
printf("Instance 2\n");
720725

721-
printf("Initializing SOSH V1.0.2\n\n");
722-
723-
printf("Welcome to SectorOS Shell\nRun help to get the list of commands which is implemented \n \n");
724-
725-
printf("$: ");
726-
while(1);
726+
void taskA()
727+
{
728+
printf("Welcome to SectorOS Shell instance 2\nRun help to get the list of commands which is implemented \n \n");
729+
TaskManager taskManager;
730+
GlobalDescriptorTable gdt;
731+
InterruptManager interrupts(0x20, &gdt, &taskManager);
732+
KeyboardDriver boardDriver(&interrupts);
733+
DriverManager drvmgr;
734+
drvmgr.AddDriver(&boardDriver);
735+
PCI PCICONT;
736+
PCICONT.SelectDrivers(&drvmgr, &interrupts);
737+
drvmgr.activateall();
738+
printf("$:");
739+
while (1);
740+
727741
}
728742

743+
729744
typedef void (*constructor)();
730745
extern "C" constructor start_ctors;
731746
extern "C" constructor end_ctors;
@@ -737,8 +752,10 @@ extern "C" void callConstructors()
737752

738753

739754

740-
extern "C" void kernelMain(const void* multiboot_structure, uint32_t /*multiboot_magic*/)
755+
extern "C" void kernelMain(const void* multiboot_structure, uint32_t multiboot_m)
741756
{
757+
TaskManager taskManager;
758+
uint32_t mm = multiboot_m;
742759
printf("Initializing SectorOS Kernel ");printf(KERNEL_VERSION); printf(" "); printf(KERNEL_BUILD); printf("....\n");
743760
SerialPort sp;
744761
sp.INITSerial();
@@ -754,15 +771,6 @@ extern "C" void kernelMain(const void* multiboot_structure, uint32_t /*multiboot
754771

755772
GlobalDescriptorTable gdt;
756773

757-
758-
TaskManager taskManager;
759-
/*
760-
Task task1(&gdt, taskA);
761-
Task task2(&gdt, NewInstance);
762-
taskManager.AddTask(&task1);
763-
taskManager.AddTask(&task2);
764-
*/
765-
766774
InterruptManager interrupts(0x20, &gdt, &taskManager);
767775

768776
DriverManager drvmgr;
@@ -829,6 +837,8 @@ extern "C" void kernelMain(const void* multiboot_structure, uint32_t /*multiboot
829837

830838
printf("\n\n");
831839

840+
841+
832842
printf("Welcome to SectorOS Shell\nRun help to get the list of commands which is implemented \n \n");
833843

834844
//ata0s.Read28(4);

0 commit comments

Comments
 (0)