Skip to content

Commit 4c2b3e5

Browse files
authored
Merge pull request #119 from assembler-0/Development
Many fixes
2 parents 5f3b621 + becb3ff commit 4c2b3e5

File tree

6 files changed

+32
-37
lines changed

6 files changed

+32
-37
lines changed

kernel/core/Kernel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,8 @@ void KernelMainHigherHalf(void) {
805805
PrintKernelSuccess("System: Initializing interrupts...\n");
806806

807807
#ifdef VF_CONFIG_SNOOZE_ON_BOOT
808+
ClearScreen();
808809
Unsnooze();
809-
ClearScreen();
810810
#endif
811811

812812
sti();

kernel/etc/Shell.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ void ArpRequestTestProcess() {
131131
packet.arp.target_ip[3] = 1;
132132

133133
uint32_t packet_size = sizeof(EthernetHeader) + sizeof(ArpPacket);
134+
PrintKernel("Sending packet(s) for RTL8139");
134135
Rtl8139_SendPacket(&packet, packet_size);
136+
PrintKernel("Sending packet(s) for E1000");
135137
E1000_SendPacket(&packet, packet_size);
136138
}
137139

@@ -1123,7 +1125,6 @@ static void PcBeepHandler(const char * args) {
11231125
KernelFree(size_str);
11241126
}
11251127

1126-
11271128
static const ShellCommand commands[] = {
11281129
{"help", HelpHandler},
11291130
{"ps", PSHandler},
@@ -1215,6 +1216,7 @@ void ShellInit(void) {
12151216

12161217
void ShellProcess(void) {
12171218
PrintKernelSuccess("System: VoidFrame Shell v0.0.2-development1 ('help' for list of commands)\n");
1219+
ExecuteCommand("help");
12181220
while (1) {
12191221
if (HasInput()) {
12201222
const char c = GetChar();
@@ -1240,4 +1242,4 @@ void ShellProcess(void) {
12401242
MLFQYield();
12411243
}
12421244
}
1243-
}
1245+
}

kernel/sched/MLFQ.c

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,6 @@ static void Astra(void) {
15191519
if (VfsCreateFile(astra_path) != 0) PANIC("Failed to create Astra process info file");
15201520

15211521
PrintKernelSuccess("Astra: Astra active.\n");
1522-
15231522
uint64_t last_check = 0;
15241523

15251524
uint64_t last_integrity_scan = 0;
@@ -1605,27 +1604,21 @@ static void Astra(void) {
16051604
}
16061605
#endif
16071606

1608-
if (LIKELY(VfsIsFile(astra_path))) {
1609-
if (current_tick % 1000 == 0) {
1610-
char buff[1] = {0};
1611-
int rd = VfsReadFile(astra_path, buff, sizeof(buff));
1612-
if (rd > 0) {
1613-
switch (buff[0]) {
1614-
case 'p': PANIC("Astra: CRITICAL: Manual panic triggered via ProcINFO\n"); break;
1615-
case 't': threat_level += 10; break; // for fun
1616-
case 'k': ASTerminate(current->pid, "ProcINFO"); break;
1617-
case 'a': CreateSecureProcess(Astra, PROC_PRIV_SYSTEM, PROC_FLAG_CORE); break;
1618-
default: break;
1619-
}
1620-
int del_rc = VfsDelete(astra_path, false);
1621-
int cr_rc = VfsCreateFile(astra_path);
1622-
if (del_rc != 0 || (cr_rc != 0 && !VfsIsFile(astra_path))) {
1623-
PrintKernelWarning("Astra: ProcINFO reset failed\n");
1624-
}
1625-
}
1607+
if (current_tick % 250 == 0) {
1608+
char buff[1] = {0};
1609+
if (VfsReadFile(astra_path, buff, sizeof(buff)) == -1) PANIC("Failed to read Astra process info file");
1610+
switch (buff[0]) {
1611+
case 'p': PANIC("Astra: CRITICAL: Manual panic triggered via ProcINFO\n"); break;
1612+
case 't': threat_level += 10; break; // for fun
1613+
case 'k': ASTerminate(current->pid, "ProcINFO"); break;
1614+
case 'a': CreateSecureProcess(Astra, PROC_PRIV_SYSTEM, PROC_FLAG_CORE); break;
1615+
default: break;
1616+
}
1617+
int del_rc = VfsDelete(astra_path, false);
1618+
int cr_rc = VfsCreateFile(astra_path);
1619+
if (del_rc != 0 || (cr_rc != 0 && !VfsIsFile(astra_path))) {
1620+
PANIC("Astra: ProcINFO reset failed\n");
16261621
}
1627-
} else {
1628-
(void)VfsCreateFile(astra_path);
16291622
}
16301623

16311624
// 1. Token integrity verification
@@ -1957,4 +1950,4 @@ void MLFQGetProcessStats(uint32_t pid, uint32_t* cpu_time, uint32_t* io_ops, uin
19571950
if (io_ops) *io_ops = proc->io_operations;
19581951
if (preemptions) *preemptions = proc->preemption_count;
19591952
ReadUnlock(&process_table_rwlock, pid);
1960-
}
1953+
}

meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ vf_config_flags = [
188188
'-DVF_CONFIG_USE_DYNAMOX',
189189
'-DVF_CONFIG_USE_ASTRA',
190190
'-DVF_CONFIG_USE_CERBERUS',
191-
'-DVF_CONFIG_CERBERUS_VFS_LOGGING',
191+
# '-DVF_CONFIG_CERBERUS_VFS_LOGGING',
192192
'-DVF_CONFIG_CERBERUS_THREAT_REPORTING',
193-
#'-DVF_CONFIG_CERBERUS_STACK_PROTECTION',
193+
# '-DVF_CONFIG_CERBERUS_STACK_PROTECTION',
194194
'-DVF_CONFIG_SCHED_MLFQ',
195195
'-DVF_CONFIG_PROCINFO_AUTO_CLEANUP',
196196
#'-DVF_CONFIG_PANIC_OVERRIDE',

mm/MemOps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,4 @@ int FastMemcmp(const void* ptr1, const void* ptr2, uint64_t size) {
237237
size--;
238238
}
239239
return 0;
240-
}
240+
}

ports/6502/6502.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// #include "Console.h"
1+
#include "Console.h"
22

33
// Helper types
44
using Byte = unsigned char;
@@ -349,7 +349,7 @@ struct CPU {
349349
case INS_NOP: { Cycles--; } break;
350350

351351
default: {
352-
// PrintKernelF("Instruction not handled: %d\n", static_cast<int>(Instruction));
352+
PrintKernelF("Instruction not handled: %d\n", static_cast<int>(Instruction));
353353
Cycles = 0; // Stop execution
354354
} break;
355355
}
@@ -390,10 +390,10 @@ extern "C" void Entry6502(const char * args){
390390
// PC already set by reset vector
391391
// Execute for a number of cycles
392392
cpu.Execute(50, mem);
393-
// PrintKernelF("A: %d\n", static_cast<int>(cpu.A));
394-
// PrintKernelF("X: %d\n", static_cast<int>(cpu.X));
395-
// PrintKernelF("Value at 0x10: %d\n", static_cast<int>(mem[0x10]));
396-
// PrintKernelF("Zero Flag: %d\n", static_cast<int>(cpu.Z));
397-
// PrintKernelF("PC: %d\n", cpu.PC);
398-
// PrintKernelSuccess("6502 emulation complete.\n");
399-
}
393+
PrintKernelF("A: %d\n", static_cast<int>(cpu.A));
394+
PrintKernelF("X: %d\n", static_cast<int>(cpu.X));
395+
PrintKernelF("Value at 0x10: %d\n", static_cast<int>(mem[0x10]));
396+
PrintKernelF("Zero Flag: %d\n", static_cast<int>(cpu.Z));
397+
PrintKernelF("PC: %d\n", cpu.PC);
398+
PrintKernelSuccess("6502 emulation complete.\n");
399+
}

0 commit comments

Comments
 (0)