Fix running on bochs by forcing x86 pentium codegen
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
clang_res_dir := $(shell $(cc) -print-resource-dir)
|
||||
|
||||
kernel_cflags := --target=i386-none-elf \
|
||||
-march=pentium \
|
||||
-nostdinc \
|
||||
-nostdlib \
|
||||
-ffreestanding \
|
||||
@ -8,7 +9,8 @@ kernel_cflags := --target=i386-none-elf \
|
||||
-std=c11 \
|
||||
-pedantic \
|
||||
-Wall \
|
||||
-Wextra
|
||||
-Wextra \
|
||||
-ffunction-sections -fdata-sections
|
||||
|
||||
ifeq ($(build),debug)
|
||||
kernel_cflags += -O0 -g
|
||||
@ -27,6 +29,8 @@ kernel_ldflags := -mcpu=i386 \
|
||||
-flto \
|
||||
-static \
|
||||
-Wl,--build-id=none \
|
||||
-Wl,--gc-sections \
|
||||
-Wl,--strip-all \
|
||||
$(clang_res_dir)/lib/*/libclang_rt.builtins-i386.a
|
||||
|
||||
ifeq ($(build),debug)
|
||||
|
||||
@ -79,7 +79,7 @@ static void pmm_init1(void) {
|
||||
}
|
||||
|
||||
void bootmain(void *mbootptr) {
|
||||
multiboot_set((struct multiboot *)VIRT(mbootptr));
|
||||
multiboot_set((struct multiboot *)((uptr_t)mbootptr + VIRT_BASE));
|
||||
|
||||
cpu_init();
|
||||
|
||||
|
||||
@ -39,11 +39,11 @@ SECTIONS {
|
||||
. = 0x00100000;
|
||||
|
||||
.multiboot ALIGN(4K): {
|
||||
*(.multiboot)
|
||||
KEEP(*(.multiboot))
|
||||
}
|
||||
|
||||
.boot ALIGN(4K) : {
|
||||
*(.boot)
|
||||
KEEP(*(.boot))
|
||||
}
|
||||
|
||||
. += VIRT_BASE;
|
||||
@ -64,5 +64,11 @@ SECTIONS {
|
||||
*(.bss)
|
||||
}
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.eh_frame)
|
||||
*(.comment)
|
||||
*(.note.gnu.build-id)
|
||||
}
|
||||
|
||||
__kernel_end = .;
|
||||
}
|
||||
|
||||
@ -89,6 +89,7 @@ static void tss_init(void) {
|
||||
tss.fs = 0x10 | 0x3;
|
||||
tss.fs = 0x10 | 0x3;
|
||||
tss.ss = 0x10 | 0x3;
|
||||
tss.iomap = sizeof(tss);
|
||||
|
||||
tss_flush();
|
||||
}
|
||||
|
||||
@ -38,7 +38,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <sync/spinlock.h>
|
||||
|
||||
#define VIRT_BASE 0xC0000000
|
||||
#define VIRT(x) (((uptr_t)(x)) + VIRT_BASE)
|
||||
|
||||
#define PAGE_SIZE 0x1000
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
megs: 128
|
||||
cpu: model=pentium
|
||||
# roms
|
||||
romimage: file=/usr/share/bochs/BIOS-bochs-latest
|
||||
romimage: file=/usr/share/bochs/BIOS-bochs-latest, options=fastboot
|
||||
vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest.bin
|
||||
# device config
|
||||
ata0: enabled=1
|
||||
|
||||
@ -3,4 +3,5 @@ set default=0
|
||||
|
||||
menuentry "mop3" {
|
||||
multiboot /boot/kernel.elf
|
||||
boot
|
||||
}
|
||||
|
||||
@ -22,6 +22,6 @@ i386_pc_qemu: $(srctree)/out/i386_pc/mop3.iso
|
||||
|
||||
i386_pc_bochs: $(srctree)/out/i386_pc/mop3.iso
|
||||
rm -f $(srctree)/bochs.log
|
||||
bochs -f $(srctree)/platform/i386_pc/bochsrc.txt -q
|
||||
-bochs -f $(srctree)/platform/i386_pc/bochsrc.txt -q
|
||||
|
||||
.PHONY: i386_pc_qemu i386_pc_bochs
|
||||
|
||||
Reference in New Issue
Block a user