Compare commits

...

4 Commits

Author SHA1 Message Date
f9dcdf5cc9 Update compiler script.
It all works now.
\o/
2019-07-24 21:50:26 +01:00
d2d532c535 Add missing file to c_files.txt 2019-07-24 21:50:01 +01:00
7cafb959dd Add missing Reserved ISR Handler function. 2019-07-24 21:49:49 +01:00
5ed922bd20 Update serial functions for new WritePort system. 2019-07-24 21:49:35 +01:00
4 changed files with 31 additions and 26 deletions

View File

@ -5,6 +5,7 @@ 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,22 +15,24 @@ HFILES = "-Iinclude/ -Iinclude/reqs/ -Iinclude/bitfont/"
OBJECTS = ""
with open('c_files.txt') as file:
line = file.readline()
line = file.readline().strip()
while line:
line = line[:-3]
line = line[:-2]
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)
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(' ', '')
os.path.normpath(OBJECTS)
with open('objects.list', 'a') as objectsfile:
objectsfile.write(OBJECTS)
ofile = OBJECTS.replace('\\', '/')
objectsfile.write(ofile + "\n")
line = file.readline()
line = file.readline().strip()
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\""])
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"])

View File

@ -246,6 +246,11 @@ __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,10 +12,7 @@
* 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/utils.h>
#include <stdarg.h>
#include <stdint.h>
#include <stddef.h>
#include <kernel.h>
#define SERIAL_DATA_PORT(base) (base)
#define SERIAL_FIFO_COMMAND_PORT(base) (base + 2)
@ -37,14 +34,14 @@
*/
void serial_set_baud_rate(uint16_t com, uint16_t divisor) {
outb(SERIAL_LINE_COMMAND_PORT(com),
SERIAL_LINE_ENABLE_DLAB);
WritePort(SERIAL_LINE_COMMAND_PORT(com),
SERIAL_LINE_ENABLE_DLAB, 8);
outb(SERIAL_DATA_PORT(com),
(divisor >> 8) & 0x00FF);
WritePort(SERIAL_DATA_PORT(com),
(divisor >> 8) & 0x00FF, 8);
outb(SERIAL_DATA_PORT(com),
divisor & 0x00FF);
WritePort(SERIAL_DATA_PORT(com),
divisor & 0x00FF, 8);
}
@ -61,7 +58,7 @@ void serial_configure_line(uint16_t com) {
* Value: | 0 | 0 | 0 0 0 | 0 | 1 1 | = 0x03
*/
outb(SERIAL_LINE_COMMAND_PORT(com), 0x0B);
WritePort(SERIAL_LINE_COMMAND_PORT(com), 0x0B, 8);
}
/** serial_configure_buffers:
@ -78,7 +75,7 @@ void serial_configure_buffers(uint16_t com) {
* Value: | 1 1 | 0 | 0 | 0 | 1 | 1 | 1 | = 0xC7
*/
outb(SERIAL_FIFO_COMMAND_PORT(com), 0xC7);
WritePort(SERIAL_FIFO_COMMAND_PORT(com), 0xC7, 8);
}
/** serial_configure_modem
@ -91,7 +88,7 @@ void serial_configure_modem(uint16_t com) {
* Value: | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | = 0x03
*/
outb(SERIAL_MODEM_COMMAND_PORT(com), 0x3);
WritePort(SERIAL_MODEM_COMMAND_PORT(com), 0x3, 8);
}
/** serial_check_tqueue:
@ -103,7 +100,7 @@ void serial_configure_modem(uint16_t com) {
*/
int serial_check_tqueue(uint16_t com) {
return inb(SERIAL_LINE_STATUS_PORT(com)) & 0x20;
return ReadPort(SERIAL_LINE_STATUS_PORT(com), 8) & 0x20;
}
/** serial_write:
@ -116,7 +113,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);
outb(com, chr);
WritePort(com, chr, 0);
}
/** serial_print:
@ -185,7 +182,7 @@ void serial_printf(uint16_t com, const char* format, ...) {
void init_serial() {
// Disable interrupts
outb(SERIAL_COM1_BASE + 1, 0x00);
WritePort(SERIAL_COM1_BASE + 1, 0x00, 0);
// Set baud rate divisor.
serial_set_baud_rate(SERIAL_COM1_BASE, 3);