From 1ae4339d7a34b908ea2bc61a1ca5ee9b4cfc2c58 Mon Sep 17 00:00:00 2001 From: Curle Date: Sat, 22 Jun 2019 18:54:21 +0100 Subject: [PATCH] Minor changes for parity --- arch/i386/boot.s | 56 +++++++++++++++++++++--------------------- arch/i386/linker.ld | 42 ++++++++++++++----------------- bochsrc.txt | 24 ++++++++---------- iso/boot/grub/grub.cfg | 7 ++++++ 4 files changed, 63 insertions(+), 66 deletions(-) create mode 100644 iso/boot/grub/grub.cfg diff --git a/arch/i386/boot.s b/arch/i386/boot.s index a381081..2104a19 100755 --- a/arch/i386/boot.s +++ b/arch/i386/boot.s @@ -1,42 +1,39 @@ -MBOOT_ALIGN equ 1<<0 -MBOOT_MEMINFO equ 1<<1 -MBOOT_FLAGS equ MBOOT_ALIGN | MBOOT_MEMINFO -MBOOT_MAGIC equ 0x1BADB002 -MBOOT_CHECKSUM equ -(MBOOT_MAGIC + MBOOT_FLAGS) - [BITS 32] -[GLOBAL mboot] -[SECTION .multiboot] +[GLOBAL start] +start: + mov esp, _sys_stack + jmp stublet + ALIGN 4 -mboot: - dd MBOOT_MAGIC - dd MBOOT_FLAGS - dd MBOOT_CHECKSUM +mboot: + MULTIBOOT_ALIGN equ 1<<0 + MULTIBOOT_MEM equ 1<<1 + MULTIBOOT_AOUT equ 1<<16 + MULTIBOOT_MAGIC equ 0x1BADB002 + MULTIBOOT_FLAGS equ MULTIBOOT_ALIGN | MULTIBOOT_MEM | MULTIBOOT_AOUT + MULTIBOOT_CHECKSUM equ -(MULTIBOOT_MAGIC + MULTIBOOT_FLAGS) + EXTERN code, bss, end -SECTION .bss -ALIGN 16 -stack_bottom: -RESB 16384 -stack_top: + dd MULTIBOOT_MAGIC + dd MULTIBOOT_FLAGS + dd MULTIBOOT_CHECKSUM + dd mboot + dd code + dd bss + dd end + dd start -SECTION .text -[GLOBAL _start] -[EXTERN kernel_main] - -_start: - push ebx - - cli +stublet: + EXTERN kernel_main call kernel_main jmp $ [GLOBAL load_gdt] ; Allows the C code to call gdt_flush(). - +[EXTERN gp] load_gdt: - mov eax, [esp+4] ; Get the pointer to the GDT, passed as a parameter. - lgdt [eax] ; Load the new GDT pointer + lgdt [gp] ; Load the new GDT pointer mov ax, 0x10 ; 0x10 is the offset in the GDT to our data segment mov ds, ax ; Load all data segment selectors @@ -184,3 +181,6 @@ idt_load: lidt [eax] ret +SECTION .bss + resb 8192 +_sys_stack: diff --git a/arch/i386/linker.ld b/arch/i386/linker.ld index 6fe18ab..a210d4d 100755 --- a/arch/i386/linker.ld +++ b/arch/i386/linker.ld @@ -1,31 +1,25 @@ - -ENTRY(_start) - +OUTPUT_FORMAT("binary") +ENTRY(start) +phys = 0x00100000; SECTIONS { - - . = 1M; - - .text BLOCK(4K) : ALIGN(4K) - { - *(.multiboot) - *(.text) + .text phys : AT(phys) { + code = .; + *(.text) + *(.rodata) + . = ALIGN(4096); } - - .rodata BLOCK(4K) : ALIGN(4K) + .data : AT(phys + (data - code)) { - *(.rodata) + data = .; + *(.data) + . = ALIGN(4096); } - - .data BLOCK(4K) : ALIGN(4K) + .bss : AT(phys + (bss - code)) { - *(.data) + bss = .; + *(.bss) + . = ALIGN(4096); } - - .bss BLOCK(4K) : ALIGN(4K) - { - *(COMMON) - *(.bss) - } - -} \ No newline at end of file + end = .; +} diff --git a/bochsrc.txt b/bochsrc.txt index 702a52a..38aa570 100644 --- a/bochsrc.txt +++ b/bochsrc.txt @@ -3,18 +3,14 @@ plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1 config_interface: textconfig display_library: x memory: host=32, guest=32 -romimage: file="/usr/share/bochs/BIOS-bochs-latest", options=none +romimage: file="/usr/share/bochs/BIOS-bochs-latest", address=0x0, options=none vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest" -boot: floppy -floppy_bootsig_check: disabled=0 -#floppya: 1_44=red.img, status=inserted +boot: a +floppy_bootsig_check: disabled=1 +floppya: 1_44=/dev/loop0, status=inserted # no floppyb -ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14 -ata0-master: type=cdrom, path=red.iso, status=inserted -ata0-slave: type=none -ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15 -ata1-master: type=none -ata1-slave: type=none +ata0: enabled=0 +ata1: enabled=0 ata2: enabled=0 ata3: enabled=0 optromimage1: file=none @@ -27,20 +23,20 @@ optramimage3: file=none optramimage4: file=none pci: enabled=1, chipset=i440fx vga: extension=vbe, update_freq=5, realtime=1 -cpu: count=1:1:1, ips=4000000, quantum=16, model=bx_generic, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0 +cpu: count=1:1:1, ips=1000000, quantum=16, model=bx_generic, reset_on_triple_fault=0, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0 cpuid: level=6, stepping=3, model=3, family=6, vendor_string="AuthenticAMD", brand_string="AMD Athlon(tm) processor" cpuid: mmx=1, apic=xapic, simd=sse2, sse4a=0, misaligned_sse=0, sep=1, movbe=0, adx=0 cpuid: aes=0, sha=0, xsave=0, xsaveopt=0, avx_f16c=0, avx_fma=0, bmi=0, xop=0, fma4=0 cpuid: tbm=0, x86_64=1, 1g_pages=0, pcid=0, fsgsbase=0, smep=0, smap=0, mwait=1 print_timestamps: enabled=0 -debugger_log: - -magic_break: enabled=0 +debugger_log: ../red.debug +magic_break: enabled=1 port_e9_hack: enabled=0 private_colormap: enabled=0 clock: sync=none, time0=local, rtc_sync=0 # no cmosimage # no loader -log: - +log: ../red.log logprefix: %t%e%d debug: action=ignore info: action=report diff --git a/iso/boot/grub/grub.cfg b/iso/boot/grub/grub.cfg new file mode 100644 index 0000000..a661ef3 --- /dev/null +++ b/iso/boot/grub/grub.cfg @@ -0,0 +1,7 @@ +set timeout=10 +set default=0 + +menuentry "ProjectRED" { + multiboot /boot/red.kernel + boot +}