Added gdt unit and runtime tests
Updated runtime tests Added doc comments for runtime tests PR review WIP Fixed testing Import GDT to run the unit tests Removed redundant arch tests Removed whitespace
This commit is contained in:
parent
9c35de8673
commit
07cc1ae89b
18 changed files with 1141 additions and 590 deletions
|
|
@ -1,7 +1,8 @@
|
|||
const std = @import("std");
|
||||
const MemProfile = @import("mem_mock.zig").MemProfile;
|
||||
const expect = std.testing.expect;
|
||||
const warn = std.debug.warn;
|
||||
const Allocator = std.mem.Allocator;
|
||||
const mem = @import("mem_mock.zig");
|
||||
const MemProfile = mem.MemProfile;
|
||||
const gdt = @import("gdt_mock.zig");
|
||||
|
||||
const mock_framework = @import("mock_framework.zig");
|
||||
pub const initTest = mock_framework.initTest;
|
||||
|
|
@ -11,29 +12,20 @@ pub const addConsumeFunction = mock_framework.addConsumeFunction;
|
|||
pub const addRepeatFunction = mock_framework.addRepeatFunction;
|
||||
|
||||
pub const InterruptContext = struct {
|
||||
// Extra segments
|
||||
gs: u32,
|
||||
fs: u32,
|
||||
es: u32,
|
||||
ds: u32,
|
||||
|
||||
// Destination, source, base pointer
|
||||
edi: u32,
|
||||
esi: u32,
|
||||
ebp: u32,
|
||||
esp: u32,
|
||||
|
||||
// General registers
|
||||
ebx: u32,
|
||||
edx: u32,
|
||||
ecx: u32,
|
||||
eax: u32,
|
||||
|
||||
// Interrupt number and error code
|
||||
int_num: u32,
|
||||
error_code: u32,
|
||||
|
||||
// Instruction pointer, code segment and flags
|
||||
eip: u32,
|
||||
cs: u32,
|
||||
eflags: u32,
|
||||
|
|
@ -41,10 +33,6 @@ pub const InterruptContext = struct {
|
|||
ss: u32,
|
||||
};
|
||||
|
||||
pub fn init(mem_profile: *const MemProfile, allocator: *std.mem.Allocator, comptime options: type) void {
|
||||
//return mock_framework.performAction("init", void, mem_profile, allocator);
|
||||
}
|
||||
|
||||
pub fn outb(port: u16, data: u8) void {
|
||||
return mock_framework.performAction("outb", void, port, data);
|
||||
}
|
||||
|
|
@ -57,20 +45,20 @@ pub fn ioWait() void {
|
|||
return mock_framework.performAction("ioWait", void);
|
||||
}
|
||||
|
||||
pub fn registerInterruptHandler(int: u16, ctx: fn (ctx: *InterruptContext) void) void {
|
||||
return mock_framework.performAction("registerInterruptHandler", void, int, ctx);
|
||||
}
|
||||
|
||||
pub fn lgdt(gdt_ptr: *const gdt.GdtPtr) void {
|
||||
return mock_framework.performAction("lgdt", void, gdt_ptr.*);
|
||||
return mock_framework.performAction("lgdt", void, gdt_ptr);
|
||||
}
|
||||
|
||||
pub fn ltr() void {
|
||||
return mock_framework.performAction("ltr", void);
|
||||
pub fn sgdt() gdt.GdtPtr {
|
||||
return mock_framework.performAction("sgdt", gdt.GdtPtr);
|
||||
}
|
||||
|
||||
pub fn ltr(offset: u16) void {
|
||||
return mock_framework.performAction("ltr", void, offset);
|
||||
}
|
||||
|
||||
pub fn lidt(idt_ptr: *const idt.IdtPtr) void {
|
||||
return mock_framework.performAction("lidt", void, idt_ptr.*);
|
||||
return mock_framework.performAction("lidt", void, idt_ptr);
|
||||
}
|
||||
|
||||
pub fn enableInterrupts() void {
|
||||
|
|
@ -92,3 +80,9 @@ pub fn spinWait() noreturn {
|
|||
pub fn haltNoInterrupts() noreturn {
|
||||
while (true) {}
|
||||
}
|
||||
|
||||
pub fn init(mem_profile: *const MemProfile, allocator: *Allocator, comptime options: type) void {
|
||||
// I'll get back to this as this doesn't effect the GDT testing.
|
||||
// When I come on to the mem.zig testing, I'll fix :)
|
||||
//return mock_framework.performAction("init", void, mem_profile, allocator);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue