Compare commits

..

No commits in common. "0d10e698dad2db6bbf84731416df00685be9d647" and "d7e2df626d47383c6f98145872b9a27592269c25" have entirely different histories.

5 changed files with 11 additions and 34 deletions

View File

@ -12,30 +12,22 @@ SECTIONS
.text ALIGN(4K) :
{
_text_start = .;
/* KEEP(*(.text*)) */
}
_text_end = .;
.rodata ALIGN(4K) :
{
_rodata_start = .;
/* KEEP(*(.rodata*)) */
}
_rodata_end = .;
.data ALIGN(4K) :
{
_data_start = .;
/* KEEP(*(.data*)) */
}
_data_end = .;
.bss ALIGN(4K) :
{
_bss_start = .;
/* KEEP(*(COMMON)) */
/* KEEP(*(.bss*)) */
}
_bss_end = .;
}

View File

@ -1,5 +1,5 @@
const std = @import("std");
var buf: [512*1024]u8 = undefined;
var buf: [1024*1024]u8 = undefined;
pub var KAlloc = std.heap.FixedBufferAllocator.init(&buf);
// pub var KAlloc = std.heap.GeneralPurposeAllocator(.{.thread_safe=false}){.backing_allocator = &GlobAlloc.allocator};

View File

@ -31,24 +31,9 @@ struct stivale2_header header2 = {
.tags = (uint64_t)&smp_request
};
extern void* _text_start;
extern void* _text_end;
extern void* _rodata_start;
extern void* _rodata_end;
extern void* _data_start;
extern void* _data_end;
extern void* _bss_start;
extern void* _bss_end;
void stivale2_main(struct stivale2_struct *info) {
parse_stivale2(info);
print_stivale2_memmap(info);
printf("text section: %x-%x\n", &_text_start, &_text_end);
printf("rodata section: %x-%x\n", &_rodata_start, &_rodata_end);
printf("data section: %x-%x\n", &_data_start, &_data_end);
printf("bss section: %x-%x\n", &_bss_start, &_bss_end);
// print_stivale2_memmap(info);
uint64_t* cr3;
__asm__ __volatile__ (
@ -60,7 +45,7 @@ void stivale2_main(struct stivale2_struct *info) {
printf("PAGE TABLE AT: %x\n", cr3);
loadgdt();
// print_gdt();
print_gdt();
setup_ints();

View File

@ -20,6 +20,7 @@ void setup_idt();
void setup_ints() {
setup_idt();
init_idt();
set_idt_ent(0x80, (uint64_t)&isr_wrapper128, 0, 0, INT64);
__asm__ volatile("int $0x80");

View File

@ -56,15 +56,14 @@ export fn zigmain() void {
const msg = std.fmt.allocPrint(alloc, "Hello {}!", .{"ziguser"});
std.log.debug("message: {}", .{msg});
if(@hasDecl(arch, "paging")) {
arch.paging.showActive();
arch.paging.activate();
}
// var cr3: usize = asm volatile (
// "mov %%cr3, %%rax" : [cr3] "={rax}" (-> usize) ::
// );
// std.log.info("cr3 = {x}", .{cr3});
if(@hasDecl(arch, "cpuid")) {
_ = arch.cpuid.getVendor();
_ = arch.cpuid.getName();
}
// const page_lvl4 = @intToPtr(*[512]u64, cr3);
// arch.paging.showTable(page_lvl4.*);
// time.displayTime(debug.AWriter) catch unreachable;