Skip to content

Commit 7651b45

Browse files
author
tthomps
committed
Make sure new tasks are created with the interrupt flag set. Don't leave interrupts disabled unless necessary.
This fixes the command "run exclusive my_doom.exe". More work needs to be done before "run my_doom.exe" will work.
1 parent 3878ecb commit 7651b45

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
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 6464
6+
BUILD_NUMBER 6507

MyOS_1/Executables/PE32.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ bool loadAndRunPE(uint8_t *executableDestination, DOS_Header *mzAddress, const c
8282
}
8383
}
8484

85-
// Disable interrupts
85+
// Disable interrupts while we mess with page tables
8686
_disable();
8787

8888
// Get a new page directory for the new task
@@ -119,6 +119,9 @@ bool loadAndRunPE(uint8_t *executableDestination, DOS_Header *mzAddress, const c
119119
else
120120
newPageDirectory = pageDir;
121121

122+
// It's safe for interrupts to run again; we're done messing with the page tables
123+
_enable();
124+
122125
// TEMPTEMP - zero out 5 0x1000 sections of memory (tailored to TestApp1.exe)
123126
memset((void*)physicalLocation, 0, 0x5000);
124127

MyOS_1/Tasks/Dispatcher.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ void CloseApp(uint32_t PID)
9090

9191
void DispatchNewTask(uint32_t programStart, PAGE_DIRECTORY_ENTRY *newPageDirectory, uint32_t stackSize, const char *imageName, bool exclusive)
9292
{
93-
// disable interrupts
94-
__asm cli
95-
9693
if (debugLevel)
9794
{
9895
kprintf("Dispatching %s\n", imageName);
9996
kprintf("program starts at 0x%lX\n", programStart);
10097
}
10198

99+
// disable interrupts while we mess with task slots
100+
_disable();
101+
102102
// Find a free task slot
103103
uint16_t taskSlot;
104104
for (taskSlot = 0; taskSlot < MAX_TASKS; ++taskSlot)
@@ -180,10 +180,12 @@ void DispatchNewTask(uint32_t programStart, PAGE_DIRECTORY_ENTRY *newPageDirecto
180180
// setup stack for the task, and copy the stack to stackPtr
181181
__asm
182182
{
183+
sti
183184
push esp
184185
push [stackPtr]
185186
int SYSCALL_DISPATCH_NEW_TASK // call dispatch_new_task_interrupt_handler(eflags, cs, stackPtr, esp)
186187
add esp, 8
188+
cli
187189
}
188190

189191
// Update the task's "stack image" to represent values appropriate for the new task

Release/MyOS_1.dll

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)