Compare commits

..

No commits in common. "f9dcdf5cc985f422949809b25ce9dfdef765abeb" and "ebbe1d9346e2d7bc7469f2b63ec0a205302b8179" have entirely different histories.

4 changed files with 26 additions and 31 deletions

View File

@ -5,7 +5,6 @@ kernel\syscalls.c
kernel\utils.c
kernel\graphics.c
kernel\print.c
kernel\interrupts.c
kernel\memory.c
kernel\memory\memmove.c
kernel\memory\memcmp.c

View File

@ -15,24 +15,22 @@ HFILES = "-Iinclude/ -Iinclude/reqs/ -Iinclude/bitfont/"
OBJECTS = ""
with open('c_files.txt') as file:
line = file.readline().strip()
line = file.readline()
while line:
line = line[:-2]
line = line[:-3]
if line == "kernel\interrupts":
print(f'{HFILES}')
subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', '-ffreestanding', '-march=skylake', '-mgeneral-regs-only', '-fno-exceptions', '-fno-stack-protector', '-fno-stack-check', '-fno-strict-aliasing', '-fno-merge-all-constants', '-mno-stack-arg-probe', '-m64', '-mno-red-zone', '-maccumulate-outgoing-args', '--std=gnu11', '-Iinclude/', '-Iinclude/reqs', '-Iinclude/bitfont', '-Og', '-g3', '-Wall', '-Wextra', '-Wdouble-promotion', '-Wpedantic', '-fmessage-length=0', '-ffunction-sections', '-c', '-MMD', '-MP', f'-Wa,-adghlmns={line}.out', f'-MT{line}.o', '-o', f'{line}.o', f'{line}.c'], shell=True)
subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', '-ffreestanding', '-march=skylake', '-mgeneral-regs-only', '-fno-exceptions', '-fno-stack-protector', '-fno-stack-check', '-fno-strict-aliasing', '-fno-merge-all-constants', '-mno-stack-arg-probe', '-m64', '-mno-red-zone', '-maccumulate-outgoing-args', '--std=gnu11', '-Iinclude/', '-Iinclude/reqs', '-Iinclude/bitfont', '-Og', '-g3', '-Wall', '-Wextra', '-Wdouble-promotion', '-Wpedantic', '-fmessage-length=0', '-ffunction-sections', '-c', '-MMD', '-MP', f'-Wa,-adghlmns="{line}.out"', f'-MT"{line}.o"', '-o', f'{line}.o', f'{line}.c'], shell=True)
else:
print(f'{HFILES}')
subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', '-ffreestanding', '-march=skylake', '-mavx2', '-fno-exceptions', '-fno-stack-protector', '-fno-stack-check', '-fno-strict-aliasing', '-fno-merge-all-constants', '-mno-stack-arg-probe', '-m64', '-mno-red-zone', '-maccumulate-outgoing-args', '--std=gnu11', '-Iinclude/', '-Iinclude/reqs', '-Iinclude/bitfont', '-Og', '-g3', '-Wall', '-Wextra', '-Wdouble-promotion', '-Wpedantic', '-fmessage-length=0', '-ffunction-sections', '-c', '-MMD', '-MP', f'-Wa,-adghlmns={line}.out', f'-MT{line}.o', '-o', f'{line}.o', f'{line}.c'], shell=True)
OBJECTS = line + ".o "
os.path.normpath(OBJECTS)
subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', '-ffreestanding', '-march=skylake', '-mavx2', '-fno-exceptions', '-fno-stack-protector', '-fno-stack-check', '-fno-strict-aliasing', '-fno-merge-all-constants', '-mno-stack-arg-probe', '-m64', '-mno-red-zone', '-maccumulate-outgoing-args', '--std=gnu11', '-Iinclude/', '-Iinclude/reqs', '-Iinclude/bitfont', '-Og', '-g3', '-Wall', '-Wextra', '-Wdouble-promotion', '-Wpedantic', '-fmessage-length=0', '-ffunction-sections', '-c', '-MMD', '-MP', f'-Wa,-adghlmns="{line}.out"', f'-MT"{line}.o"', '-o', f'{line}.o', f'{line}.c'], shell=True)
OBJECTS = line + ".o"
OBJECTS.replace('\\', '/')
OBJECTS.replace(' ', '')
with open('objects.list', 'a') as objectsfile:
ofile = OBJECTS.replace('\\', '/')
objectsfile.write(ofile + "\n")
objectsfile.write(OBJECTS)
line = file.readline().strip()
line = file.readline()
subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', "-march=skylake", "-mavx2", "-s", "-nostdlib", "-static-pie", "-Wl,--allow-multiple-definition", "-Wl,-e,kernel_main", "-Wl,--dynamicbase,--export-all-symbols", "-Wl,--subsystem,10", "-Wl,-Map=output.map", "-Wl,--gc-sections", "-o Sync.exe", "@objects.list"])
subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', "-march=skylake", "-mavx2", "-s", "-nostdlib", "-Wl,-e,kernel_main", "-Wl,--dynamicbase,--export-all-symbols", "-Wl,--subsystem,10", "-Wl,-Map=output.map", "-Wl,--gc-sections", "-o \"Sync.exe\"", "@\"objects.list\""])

View File

@ -246,11 +246,6 @@ __attribute__((interrupt)) void ISR31Handler(INTERRUPT_FRAME* Frame) {
ISR_Common(Frame, 31);
}
__attribute__((interrupt)) void ReservedISRHandler(INTERRUPT_FRAME* Frame) {
ISR_Common(Frame, 33); // if < 32, isn't handled.
// Effectively disables this ISR.
}
__attribute__((interrupt)) void irq0(INTERRUPT_FRAME* Frame) {
IRQ_Common(Frame, 0);

View File

@ -12,7 +12,10 @@
* Some testing will be needed to know for certain whether this will work.
* Until then, this is to be put on hold. 21/07/19 - Curle */
#include <kernel.h>
#include <kernel/utils.h>
#include <stdarg.h>
#include <stdint.h>
#include <stddef.h>
#define SERIAL_DATA_PORT(base) (base)
#define SERIAL_FIFO_COMMAND_PORT(base) (base + 2)
@ -34,14 +37,14 @@
*/
void serial_set_baud_rate(uint16_t com, uint16_t divisor) {
WritePort(SERIAL_LINE_COMMAND_PORT(com),
SERIAL_LINE_ENABLE_DLAB, 8);
outb(SERIAL_LINE_COMMAND_PORT(com),
SERIAL_LINE_ENABLE_DLAB);
WritePort(SERIAL_DATA_PORT(com),
(divisor >> 8) & 0x00FF, 8);
outb(SERIAL_DATA_PORT(com),
(divisor >> 8) & 0x00FF);
WritePort(SERIAL_DATA_PORT(com),
divisor & 0x00FF, 8);
outb(SERIAL_DATA_PORT(com),
divisor & 0x00FF);
}
@ -58,7 +61,7 @@ void serial_configure_line(uint16_t com) {
* Value: | 0 | 0 | 0 0 0 | 0 | 1 1 | = 0x03
*/
WritePort(SERIAL_LINE_COMMAND_PORT(com), 0x0B, 8);
outb(SERIAL_LINE_COMMAND_PORT(com), 0x0B);
}
/** serial_configure_buffers:
@ -75,7 +78,7 @@ void serial_configure_buffers(uint16_t com) {
* Value: | 1 1 | 0 | 0 | 0 | 1 | 1 | 1 | = 0xC7
*/
WritePort(SERIAL_FIFO_COMMAND_PORT(com), 0xC7, 8);
outb(SERIAL_FIFO_COMMAND_PORT(com), 0xC7);
}
/** serial_configure_modem
@ -88,7 +91,7 @@ void serial_configure_modem(uint16_t com) {
* Value: | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | = 0x03
*/
WritePort(SERIAL_MODEM_COMMAND_PORT(com), 0x3, 8);
outb(SERIAL_MODEM_COMMAND_PORT(com), 0x3);
}
/** serial_check_tqueue:
@ -100,7 +103,7 @@ void serial_configure_modem(uint16_t com) {
*/
int serial_check_tqueue(uint16_t com) {
return ReadPort(SERIAL_LINE_STATUS_PORT(com), 8) & 0x20;
return inb(SERIAL_LINE_STATUS_PORT(com)) & 0x20;
}
/** serial_write:
@ -113,7 +116,7 @@ int serial_check_tqueue(uint16_t com) {
void serial_write(uint16_t com, const char chr) {
//Hang until we have access to the COM port.
while(serial_check_tqueue(com) == 0);
WritePort(com, chr, 0);
outb(com, chr);
}
/** serial_print:
@ -182,7 +185,7 @@ void serial_printf(uint16_t com, const char* format, ...) {
void init_serial() {
// Disable interrupts
WritePort(SERIAL_COM1_BASE + 1, 0x00, 0);
outb(SERIAL_COM1_BASE + 1, 0x00);
// Set baud rate divisor.
serial_set_baud_rate(SERIAL_COM1_BASE, 3);