Skip to content

Commit 6a92832

Browse files
author
tthomps
committed
Remove temporary "multiEnable" boolean and "multi" command. Multi-tasking is working well enough that they aren't needed. Also, "single-tasking" had regressed and wasn't working.
(Apps can be run without task-switching with the "run exclusive" command from the command shell.)
1 parent f776e18 commit 6a92832

File tree

8 files changed

+5
-41
lines changed

8 files changed

+5
-41
lines changed

MyOS_1/Build_Number.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// Define a build number. This number will be incremented by a simple console program called by a post-build event
44
// It's put here in its own file to keep the other program from messing up the source
55
#define \
6-
BUILD_NUMBER 6461
6+
BUILD_NUMBER 6464

MyOS_1/Console_Shell.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -969,14 +969,6 @@ void Shell_Process_command(void)
969969
return;
970970
}
971971

972-
// Temporary command to enable multi-tasking
973-
if (strcmp(currentCommand, "multi") == 0)
974-
{
975-
kprintf("Enabling multi-tasking...\n");
976-
multiEnable = true;
977-
return;
978-
}
979-
980972
// Runhi command - used to load GUI at a different memory address than other programs, mapped into kernel space
981973
memset(subCommand, 0, MAX_COMMAND_LENGTH);
982974
strncpy(subCommand, currentCommand, strlen("runhi"));

MyOS_1/Executables/PE32.c

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -175,33 +175,8 @@ bool loadAndRunPE(uint8_t *executableDestination, DOS_Header *mzAddress, const c
175175
terminal_newline();
176176
}
177177

178-
if (multiEnable)
179-
{
180-
DispatchNewTask((uint32_t)entryPoint, newPageDirectory, 0x20000, imageName, exclusive);
181-
}
182-
else
183-
{
184-
// Re-enable interrupts
185-
_enable();
186-
187-
/*_asm {
188-
// Setup the program's stack
189-
mov [espVal], esp
190-
mov esp, 0x440000
191-
pushad
192-
}*/
193-
// This is where the exit() system call will return to. If setjmp() doesn't return 0, then the executable used exit().
194-
if (setjmp(peReturnBuf) == 0)
195-
{
196-
// run the program
197-
(*entryPoint)();
198-
}
199-
/*_asm
200-
{
201-
popad
202-
mov esp, [espVal]
203-
}*/
204-
}
178+
// Run it!
179+
DispatchNewTask((uint32_t)entryPoint, newPageDirectory, 0x20000, imageName, exclusive);
205180

206181
if (debugLevel)
207182
{

MyOS_1/Tasks/Context.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ extern int currentTask;
5757

5858
extern uint32_t nextPID;
5959

60-
extern bool multiEnable; // TEMPTEMP
61-
6260
void CloseApp(uint32_t PID);
6361

6462
void DispatchNewTask(uint32_t programStart, PAGE_DIRECTORY_ENTRY *newPageDirectory, uint32_t stackSize, const char *imageName, bool exclusive);

MyOS_1/Tasks/Dispatcher.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ void ExitApp()
283283
// Make sure interrupts are disabled
284284
_disable();
285285

286-
// TODO: handle multiEnable = false
287286
// If the ready-queue is empty or contains only this task,
288287
// or if we're not running in multitasking mode, there's nothing we can do here
289288
if (!readyQueueHead || (!readyQueueHead->nextEntry && readyQueueHead->taskIndex == currentTask))

MyOS_1/Timers/PIT.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void PIT_Set_Interval(uint32_t hz)
6363
uint32_t espVal;
6464
uint32_t oldTaskIndex;
6565
READY_QUEUE_ENTRY *oldHead;
66-
bool multiEnable = false; // TEMPTEMP HACKHACK
66+
6767
// Interrupt handler for the PIT
6868
void _declspec(naked) timer_interrupt_handler(void)
6969
{
@@ -82,7 +82,7 @@ void _declspec(naked) timer_interrupt_handler(void)
8282
if (!tasks[currentTask].exclusive && readyQueueHead)
8383
{
8484
--ticksLeftInTask;
85-
if (ticksLeftInTask <= 0 && multiEnable)
85+
if (ticksLeftInTask <= 0)
8686
{
8787
if(debugLevel)
8888
kprintf("Saving %s.", tasks[currentTask].imageName);

Release/MyOS_1.dll

0 Bytes
Binary file not shown.

Release/myos.iso

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)