Fixed tesing

Add mocking of functions


Added new function type


Fixed up the mock testing


Working mock_framework :), fixed up all tests for VGA and TTY


Adding tests


VGA testing done


Fin vga and tty mock testing


Fixed build


Removed white spaces


WIP


Added tests for all build modes + reduced import string length for testing


Added comments refactoring


Re-added constants


Added some comments


Updated to master of zig


Added unit tests to pipeline


PR comments


Fixed typos
This commit is contained in:
ED 2019-09-08 20:48:23 +01:00
parent 89c47d064b
commit d5d4082a66
24 changed files with 1812 additions and 829 deletions

View file

@ -1,5 +1,6 @@
// Zig version: 0.4.0
const std = @import("std");
const builtin = @import("builtin");
const gdt = @import("gdt.zig");
const idt = @import("idt.zig");
@ -7,6 +8,8 @@ const irq = @import("irq.zig");
const isr = @import("isr.zig");
const log = @import("../../log.zig");
const pit = @import("pit.zig");
const paging = @import("paging.zig");
const MemProfile = @import("../../mem.zig").MemProfile;
const syscalls = @import("syscalls.zig");
pub const InterruptContext = struct {
@ -39,9 +42,6 @@ pub const InterruptContext = struct {
user_esp: u32,
ss: u32,
};
const paging = @import("paging.zig");
const std = @import("std");
const MemProfile = @import("../../mem.zig").MemProfile;
///
/// Initialise the architecture

View file

@ -1,4 +1,4 @@
const constants = @import("constants.zig");
const constants = @import("constants");
const ALIGN = 1 << 0;
const MEMINFO = 1 << 1;

View file

@ -7,7 +7,8 @@ const MemProfile = @import("../../mem.zig").MemProfile;
const testing = @import("std").testing;
const expectEqual = testing.expectEqual;
const expect = testing.expect;
const constants = @import("constants.zig");
extern var KERNEL_ADDR_OFFSET: *u32;
const ENTRIES_PER_DIRECTORY = 1024;
@ -34,7 +35,7 @@ const ENTRY_AVAILABLE = 0xE00;
const ENTRY_PAGE_ADDR = 0xFFC00000;
const Directory = packed struct {
entries: [ENTRIES_PER_DIRECTORY]DirectoryEntry
entries: [ENTRIES_PER_DIRECTORY]DirectoryEntry,
};
const PagingError = error {
@ -42,7 +43,7 @@ const PagingError = error {
InvalidVirtAddresses,
PhysicalVirtualMismatch,
UnalignedPhysAddresses,
UnalignedVirtAddresses
UnalignedVirtAddresses,
};
///
@ -140,7 +141,7 @@ pub fn init(mem_profile: *const MemProfile, allocator: *std.mem.Allocator) void
@memset(@ptrCast([*]u8, kernel_directory), 0, @sizeOf(Directory));
mapDir(kernel_directory, p_start, p_end, v_start, v_end, allocator) catch unreachable;
const dir_physaddr = @ptrToInt(kernel_directory) - constants.KERNEL_ADDR_OFFSET;
const dir_physaddr = @ptrToInt(kernel_directory) - @ptrToInt(&KERNEL_ADDR_OFFSET);
asm volatile ("mov %[addr], %%cr3" :: [addr] "{eax}" (dir_physaddr));
isr.registerIsr(14, pageFault) catch unreachable;
}