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 ALIGN(4K) :
{ {
_text_start = .;
/* KEEP(*(.text*)) */ /* KEEP(*(.text*)) */
} }
_text_end = .;
.rodata ALIGN(4K) : .rodata ALIGN(4K) :
{ {
_rodata_start = .;
/* KEEP(*(.rodata*)) */ /* KEEP(*(.rodata*)) */
} }
_rodata_end = .;
.data ALIGN(4K) : .data ALIGN(4K) :
{ {
_data_start = .;
/* KEEP(*(.data*)) */ /* KEEP(*(.data*)) */
} }
_data_end = .;
.bss ALIGN(4K) : .bss ALIGN(4K) :
{ {
_bss_start = .;
/* KEEP(*(COMMON)) */ /* KEEP(*(COMMON)) */
/* KEEP(*(.bss*)) */ /* KEEP(*(.bss*)) */
} }
_bss_end = .;
} }

View File

@ -1,5 +1,5 @@
const std = @import("std"); 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.FixedBufferAllocator.init(&buf);
// pub var KAlloc = std.heap.GeneralPurposeAllocator(.{.thread_safe=false}){.backing_allocator = &GlobAlloc.allocator}; // 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 .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) { void stivale2_main(struct stivale2_struct *info) {
parse_stivale2(info); parse_stivale2(info);
print_stivale2_memmap(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);
uint64_t* cr3; uint64_t* cr3;
__asm__ __volatile__ ( __asm__ __volatile__ (
@ -60,7 +45,7 @@ void stivale2_main(struct stivale2_struct *info) {
printf("PAGE TABLE AT: %x\n", cr3); printf("PAGE TABLE AT: %x\n", cr3);
loadgdt(); loadgdt();
// print_gdt(); print_gdt();
setup_ints(); setup_ints();

View File

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

View File

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