From 27cbbce743df9c4209c6d63caeabc87d8a60275b Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Sat, 14 Oct 2006 10:48:43 +0000 Subject: [PATCH] Get the ol' Dreamcast target building and sort of booting again. Doesn't really work, but it definitely gets somewhat into the boot processing before asploding. git-svn-id: svn+ssh://newos.org/var/svn/newos/newos@1204 c25cc9d1-44fa-0310-b259-ad778cb1d433 --- boot/dreamcast/config.ini | 338 +++++++++++++++--------------- boot/dreamcast/makefile | 28 ++- boot/dreamcast/stage1.S | 66 +++--- boot/dreamcast/{stage2.ld => stage1.ld} | 13 +- boot/dreamcast/stage2.ld | 2 +- config/platform/make.config.dreamcast | 3 + include/arch/sh4/cpu.h | 5 +- include/arch/sh4/endian.h | 11 + include/arch/sh4/types.h | 45 ++-- include/newos/types.h | 5 + kernel/addons/ldscripts/sh4/addon.ld | 11 +- kernel/arch/sh4/arch_cpu.c | 5 + kernel/arch/sh4/arch_thread.c | 38 +++- kernel/arch/sh4/arch_time.c | 28 +++ kernel/arch/sh4/arch_vm_translation_map.c | 4 +- kernel/arch/sh4/kernel.ld | 11 +- kernel/arch/sh4/makefile | 1 + make.syscfg | 2 +- 18 files changed, 344 insertions(+), 272 deletions(-) rewrite boot/dreamcast/config.ini (73%) rewrite boot/dreamcast/stage1.S (65%) copy boot/dreamcast/{stage2.ld => stage1.ld} (77%) create mode 100644 config/platform/make.config.dreamcast create mode 100644 include/arch/sh4/endian.h rewrite include/arch/sh4/types.h (76%) create mode 100644 kernel/arch/sh4/arch_time.c diff --git a/boot/dreamcast/config.ini b/boot/dreamcast/config.ini dissimilarity index 73% index e7794e1..45e8bf7 100644 --- a/boot/dreamcast/config.ini +++ b/boot/dreamcast/config.ini @@ -1,169 +1,169 @@ -# --------------------------------------------------------------- -# The bootstrap code is where control starts once netboot, boot.com, -# etc loads the image. It creates a page table to map the kernel in -# at 0x80000000 and then jumps to the kernel entrypoint where things -# really start happening. This MUST be the first entry in the .ini -# -[bootstrap] -type=elf32 -file=build/sh4/boot/stage2 - -[kernel] -type=elf32 -file=build/sh4/kernel/kernel - -[bootscript] -type=text -file=scripts/bootscript - -[loginscript] -type=text -file=scripts/loginscript - -[addons/fs/iso9660] -type=elf32 -file=build/sh4/kernel/addons/fs/iso9660/iso9660 - -[addons/fs/nfs] -type=elf32 -file=build/sh4/kernel/addons/fs/nfs/nfs - -[addons/fs/zfs] -type=elf32 -file=build/sh4/kernel/addons/fs/zfs/zfs - -[bin/init] -type=elf32 -file=build/sh4/apps/init/init - -[bin/window_server] -type=elf32 -file=build/sh4/apps/window_server/window_server - -[bin/guiapp] -type=elf32 -file=build/sh4/apps/guiapp/guiapp - -[bin/consoled] -type=elf32 -file=build/sh4/apps/consoled/consoled - -[bin/inputd] -type=elf32 -file=build/sh4/apps/inputd/inputd - -[bin/socketd] -type=elf32 -file=build/sh4/apps/socketd/socketd - -[bin/telnetd] -type=elf32 -file=build/sh4/apps/telnetd/telnetd - -[bin/shell] -type=elf32 -file=build/sh4/apps/shell/shell - -[bin/ls] -type=elf32 -file=build/sh4/apps/ls/ls - -[bin/mount] -type=elf32 -file=build/sh4/apps/mount/mount - -[bin/unmount] -type=elf32 -file=build/sh4/apps/unmount/unmount - -[bin/fortune] -type=elf32 -file=build/sh4/apps/fortune/fortune - -[etc/fortunes] -type=data -file=apps/fortune/fortunes - -[bin/rm] -type=elf32 -file=build/sh4/apps/rm/rm - -[bin/ps] -type=elf32 -file=build/sh4/apps/ps/ps - -[bin/top] -type=elf32 -file=build/sh4/apps/top/top - -[bin/nettest] -type=elf32 -file=build/sh4/apps/nettest/nettest - -[bin/irc] -type=elf32 -file=build/sh4/apps/irc/irc - -[bin/testapp] -type=elf32 -file=build/sh4/apps/testapp/testapp - -[bin/true] -type=elf32 -file=build/sh4/apps/true/true - -[bin/false] -type=elf32 -file=build/sh4/apps/false/false - -[bin/vmtest] -type=elf32 -file=build/sh4/apps/vmtest/vmtest - -[bin/vtcolors] -type=elf32 -file=build/sh4/apps/vtcolors/vtcolors - -[bin/fibo] -type=elf32 -file=build/sh4/apps/fibo/fibo - -[libexec/rld.so] -type=elf32 -file=build/sh4/apps/rld/rld.so - -[bin/rldtest] -type=elf32 -file=build/sh4/apps/rldtest/rldtest - -[lib/librldtest.so] -type=elf32 -file=build/sh4/apps/rldtest/librldtest.so - -[lib/girlfriend.so] -type=elf32 -file=build/sh4/apps/rldtest/girlfriend.so - -[lib/libc.so] -type=elf32 -file=build/sh4/lib/libc/libc.so - -[lib/libm.so] -type=elf32 -file=build/sh4/lib/libm/libm.so - -[lib/libsocket.so] -type=elf32 -file=build/sh4/lib/libsocket/libsocket.so - -[lib/libwin.so] -type=elf32 -file=build/sh4/lib/libwin/libwin.so - -[testfile] -type=data -file=boot/testfile - -[test.iso] -type=data -file=boot/test.iso +# --------------------------------------------------------------- +# The bootstrap code is where control starts once netboot, boot.com, +# etc loads the image. It creates a page table to map the kernel in +# at 0x80000000 and then jumps to the kernel entrypoint where things +# really start happening. This MUST be the first entry in the .ini +# +[bootstrap] +type=elf32 +file=build/sh4-dreamcast/boot/dreamcast/stage2 + +[kernel] +type=elf32 +file=build/sh4-dreamcast/kernel/kernel + +[bootscript] +type=text +file=scripts/bootscript + +[loginscript] +type=text +file=scripts/loginscript + +[addons/fs/iso9660] +type=elf32 +file=build/sh4-dreamcast/kernel/addons/fs/iso9660/iso9660 + +[addons/fs/nfs] +type=elf32 +file=build/sh4-dreamcast/kernel/addons/fs/nfs/nfs + +[addons/fs/zfs] +type=elf32 +file=build/sh4-dreamcast/kernel/addons/fs/zfs/zfs + +#[bin/init] +#type=elf32 +#file=build/sh4-dreamcast/apps/init/init + +#[bin/window_server] +#type=elf32 +#file=build/sh4-dreamcast/apps/window_server/window_server + +#[bin/guiapp] +#type=elf32 +#file=build/sh4-dreamcast/apps/guiapp/guiapp + +#[bin/consoled] +#type=elf32 +#file=build/sh4-dreamcast/apps/consoled/consoled + +#[bin/inputd] +#type=elf32 +#file=build/sh4-dreamcast/apps/inputd/inputd + +#[bin/socketd] +#type=elf32 +#file=build/sh4-dreamcast/apps/socketd/socketd + +#[bin/telnetd] +#type=elf32 +#file=build/sh4-dreamcast/apps/telnetd/telnetd + +#[bin/shell] +#type=elf32 +#file=build/sh4-dreamcast/apps/shell/shell + +#[bin/ls] +#type=elf32 +#file=build/sh4-dreamcast/apps/ls/ls + +#[bin/mount] +#type=elf32 +#file=build/sh4-dreamcast/apps/mount/mount + +#[bin/unmount] +#type=elf32 +#file=build/sh4-dreamcast/apps/unmount/unmount + +#[bin/fortune] +#type=elf32 +#file=build/sh4-dreamcast/apps/fortune/fortune + +#[etc/fortunes] +#type=data +#file=apps/fortune/fortunes + +#[bin/rm] +#type=elf32 +#file=build/sh4-dreamcast/apps/rm/rm + +#[bin/ps] +#type=elf32 +#file=build/sh4-dreamcast/apps/ps/ps + +#[bin/top] +#type=elf32 +#file=build/sh4-dreamcast/apps/top/top + +#[bin/nettest] +#type=elf32 +#file=build/sh4-dreamcast/apps/nettest/nettest + +#[bin/irc] +#type=elf32 +#file=build/sh4-dreamcast/apps/irc/irc + +#[bin/testapp] +#type=elf32 +#file=build/sh4-dreamcast/apps/testapp/testapp + +#[bin/true] +#type=elf32 +#file=build/sh4-dreamcast/apps/true/true + +#[bin/false] +#type=elf32 +#file=build/sh4-dreamcast/apps/false/false + +#[bin/vmtest] +#type=elf32 +#file=build/sh4-dreamcast/apps/vmtest/vmtest + +#[bin/vtcolors] +#type=elf32 +#file=build/sh4-dreamcast/apps/vtcolors/vtcolors + +#[bin/fibo] +#type=elf32 +#file=build/sh4-dreamcast/apps/fibo/fibo + +[libexec/rld.so] +type=elf32 +file=build/sh4-dreamcast/apps/rld/rld.so + +#[bin/rldtest] +#type=elf32 +#file=build/sh4-dreamcast/apps/rldtest/rldtest + +#[lib/librldtest.so] +#type=elf32 +#file=build/sh4-dreamcast/apps/rldtest/librldtest.so + +#[lib/girlfriend.so] +#type=elf32 +#file=build/sh4-dreamcast/apps/rldtest/girlfriend.so + +#[lib/libc.so] +#type=elf32 +#file=build/sh4-dreamcast/lib/libc/libc.so + +#[lib/libm.so] +#type=elf32 +#file=build/sh4-dreamcast/lib/libm/libm.so + +#[lib/libsocket.so] +#type=elf32 +#file=build/sh4-dreamcast/lib/libsocket/libsocket.so + +#[lib/libwin.so] +#type=elf32 +#file=build/sh4-dreamcast/lib/libwin/libwin.so + +[testfile] +type=data +file=boot/testfile + +[test.iso] +type=data +file=boot/test.iso diff --git a/boot/dreamcast/makefile b/boot/dreamcast/makefile index a21a0aa..f7976c1 100644 --- a/boot/dreamcast/makefile +++ b/boot/dreamcast/makefile @@ -1,6 +1,7 @@ +LOCAL_DIR := $(GET_LOCAL_DIR) -BOOT_SRCDIR := boot/$(ARCH) -BOOT_TARGETDIR := $(call TOBUILDDIR, boot) +BOOT_SRCDIR := $(LOCAL_DIR) +BOOT_TARGETDIR := $(call TOBUILDDIR, $(BOOT_SRCDIR)) STAGE2 = $(BOOT_TARGETDIR)/stage2 @@ -20,7 +21,7 @@ MY_CFLAGS := $(KERNEL_CFLAGS) MY_LDFLAGS := -dN MY_LIBS := $(LIBS_BUILD_DIR)/libc.a MY_LIBPATHS := -MY_DEPS := +MY_DEPS := $(MY_LIBS) MY_LINKSCRIPT := $(MY_SRCDIR)/stage2.ld MY_GLUE := @@ -29,11 +30,22 @@ include templates/app.mk # build stage1 STAGE1 := $(BOOT_TARGETDIR)/stage1 -STAGE1_OBJS = \ - $(BOOT_TARGETDIR)/stage1.o +MY_TARGETDIR := $(BOOT_TARGETDIR) +MY_SRCDIR := $(BOOT_SRCDIR) +MY_TARGET := $(STAGE1) +MY_OBJS := \ + stage1.o + +MY_INCLUDES := +MY_CFLAGS := +MY_LDFLAGS := -dN +MY_LIBS := +MY_LIBPATHS := +MY_DEPS := +MY_LINKSCRIPT := $(MY_SRCDIR)/stage1.ld +MY_GLUE := -$(STAGE1): $(STAGE1_OBJS) - $(LD) $(GLOBAL_LDFLAGS) -N -Ttext 0x8c000000 $(STAGE1_OBJS) -o $(STAGE1) +include templates/app.mk $(STAGE1).bin: $(STAGE1) $(OBJCOPY) -O binary $(STAGE1) $@1 @@ -48,7 +60,7 @@ SEMIFINAL := $(BOOT_TARGETDIR)/final.bootdir $(FINAL): $(SEMIFINAL) $(STAGE1).bin cat $(STAGE1).bin $(SEMIFINAL) > $(FINAL) -$(SEMIFINAL): $(STAGE2) $(ALL) $(TOOLS) $(CONFIG_FILE) +$(SEMIFINAL): $(STAGE2) $(KERNEL) $(TOOLS) $(CONFIG_FILE) $(BOOTMAKER) --strip-debug --strip-binary $(STRIP) $(CONFIG_FILE) -o $@ diff --git a/boot/dreamcast/stage1.S b/boot/dreamcast/stage1.S dissimilarity index 65% index 24d3b14..3d2f8c0 100644 --- a/boot/dreamcast/stage1.S +++ b/boot/dreamcast/stage1.S @@ -1,39 +1,27 @@ -/* -** Copyright 2001, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ -/* addresses of values stored in the bootdir, which starts on the next - page after this code. */ -#define BASE 0x8c000000 -#define BOOTDIR_BASE (BASE + 0x1000) -#define STAGE2_BOOTDIR_PAGE (BOOTDIR_BASE + 0x60) -#define STAGE2_OFFSET (BOOTDIR_BASE + 0x74) -.text - -start: - mov.l bootdir_base,r0 - - /* load and calculate the offset of the stage2 bootloader into the bootdir */ - mov.l page_addr_addr,r1 - mov.l @r1,r1 - shll8 r1 - shll2 r1 - shll2 r1 /* multiply the offset address by 4096 */ - - /* find the offset into the stage2 bootloader where the entry point is */ - mov.l offset_addr,r2 - mov.l @r2,r2 - - /* add all of these numbers together and jump to it */ - add r1,r0 - add r2,r0 - jmp @r0 - nop - -.align 2 -bootdir_base: - .long BOOTDIR_BASE -page_addr_addr: - .long STAGE2_BOOTDIR_PAGE -offset_addr: - .long STAGE2_OFFSET +/* +** Copyright 2001-2006, Travis Geiselbrecht. All rights reserved. +** Distributed under the terms of the NewOS License. +*/ +/* addresses of values stored in the bootdir, which starts on the next + page after this code. */ +#define BASE 0x8c000000 +#define BOOTDIR_BASE (BASE + 0x1000) + +/* a couple of pointers into the second bootdir entry */ +#define STAGE2_ENTRY (BOOTDIR_BASE + 0xf4) + +.text +.globl start + +start: + /* find the offset into the stage2 bootloader where the entry point is */ + mov.l entry_addr,r0 + mov.l @r0,r0 + + /* jump into it */ + jmp @r0 + nop + +.align 2 +entry_addr: + .long STAGE2_ENTRY diff --git a/boot/dreamcast/stage2.ld b/boot/dreamcast/stage1.ld similarity index 77% copy from boot/dreamcast/stage2.ld copy to boot/dreamcast/stage1.ld index ebe352c..b5f9d02 100644 --- a/boot/dreamcast/stage2.ld +++ b/boot/dreamcast/stage1.ld @@ -1,21 +1,14 @@ OUTPUT_FORMAT("elf32-shl", "elf32-shl", "elf32-shl") OUTPUT_ARCH(sh) - PHDRS - { - text PT_LOAD; - data PT_LOAD; - } - + ENTRY(__start) SECTIONS { -/* . = 0x8c100000 + 0x1200 + SIZEOF_HEADERS; */ - . = 0x8c000000 + 0x2000 + 0x80; + . = 0x8c000000; /* text/read-only data */ .text : { *(.text .gnu.linkonce.t.*) } - - .rodata : { *(.rodata) } + .rodata : { *(.rodata .rodata.*) } /* writable data */ /* . = ALIGN(0x1000);*/ diff --git a/boot/dreamcast/stage2.ld b/boot/dreamcast/stage2.ld index ebe352c..f50a910 100644 --- a/boot/dreamcast/stage2.ld +++ b/boot/dreamcast/stage2.ld @@ -10,7 +10,7 @@ ENTRY(__start) SECTIONS { /* . = 0x8c100000 + 0x1200 + SIZEOF_HEADERS; */ - . = 0x8c000000 + 0x2000 + 0x80; + . = 0x8c000000 + 0x5000 + SIZEOF_HEADERS; /* text/read-only data */ .text : { *(.text .gnu.linkonce.t.*) } diff --git a/config/platform/make.config.dreamcast b/config/platform/make.config.dreamcast new file mode 100644 index 0000000..d3d8623 --- /dev/null +++ b/config/platform/make.config.dreamcast @@ -0,0 +1,3 @@ +#KERNEL_ADDONS += $(addprefix $(KERNEL_ADDONS_BUILD_DIR)/, \ +#) + diff --git a/include/arch/sh4/cpu.h b/include/arch/sh4/cpu.h index 9bf2df9..2d4c1d2 100644 --- a/include/arch/sh4/cpu.h +++ b/include/arch/sh4/cpu.h @@ -1,5 +1,5 @@ /* -** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. +** Copyright 2001-2006, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ #ifndef _NEWOS_ARCH_SH4_CPU_H @@ -7,8 +7,5 @@ #define PAGE_SIZE 4096 -#define _BIG_ENDIAN 0 -#define _LITTLE_ENDIAN 1 - #endif diff --git a/include/arch/sh4/endian.h b/include/arch/sh4/endian.h new file mode 100644 index 0000000..c77f3dc --- /dev/null +++ b/include/arch/sh4/endian.h @@ -0,0 +1,11 @@ +/* +** Copyright 2004-2006, Travis Geiselbrecht. All rights reserved. +** Distributed under the terms of the NewOS License. +*/ +#ifndef _NEWOS_ARCH_SH4_ENDIAN_H +#define _NEWOS_ARCH_SH4_ENDIAN_H + +#define BYTE_ORDER LITTLE_ENDIAN + +#endif + diff --git a/include/arch/sh4/types.h b/include/arch/sh4/types.h dissimilarity index 76% index 95ef7ae..56f4c5e 100644 --- a/include/arch/sh4/types.h +++ b/include/arch/sh4/types.h @@ -1,19 +1,26 @@ -/* -** Copyright 2001, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ -#ifndef _SH4_TYPES_H -#define _SH4_TYPES_H - -// XXX is this accurate? -typedef unsigned long long uint64; -typedef long long int64; -typedef unsigned int uint32; -typedef int int32; -typedef unsigned short uint16; -typedef short int16; -typedef unsigned char uint8; -typedef char int8; - -#endif - +/* +** Copyright 2001-2006, Travis Geiselbrecht. All rights reserved. +** Distributed under the terms of the NewOS License. +*/ +#ifndef _SH4_TYPES_H +#define _SH4_TYPES_H + +typedef volatile unsigned long long vuint64; +typedef unsigned long long uint64; +typedef volatile long long vint64; +typedef long long int64; +typedef volatile unsigned int vuint32; +typedef unsigned int uint32; +typedef volatile int vint32; +typedef int int32; +typedef volatile unsigned short vuint16; +typedef unsigned short uint16; +typedef volatile short vint16; +typedef short int16; +typedef volatile unsigned char vuint8; +typedef unsigned char uint8; +typedef volatile char vint8; +typedef signed char int8; + +#endif + diff --git a/include/newos/types.h b/include/newos/types.h index 207f327..93c45ce 100644 --- a/include/newos/types.h +++ b/include/newos/types.h @@ -21,6 +21,11 @@ #undef arm #define INC_ARCH(path, x) #endif +#if defined(__sh4__) || defined(__SH4__) +#undef sh4 +#define INC_ARCH(path, x) +#endif + #include INC_ARCH(arch,types.h) diff --git a/kernel/addons/ldscripts/sh4/addon.ld b/kernel/addons/ldscripts/sh4/addon.ld index 8bf42c5..3c538eb 100644 --- a/kernel/addons/ldscripts/sh4/addon.ld +++ b/kernel/addons/ldscripts/sh4/addon.ld @@ -31,17 +31,12 @@ SECTIONS .rela.bss : { *(.rela.bss) } .rel.plt : { *(.rel.plt) } .rela.plt : { *(.rela.plt) } - .init : { *(.init) } =0x9090 + .init : { *(.init) } .plt : { *(.plt) } /* text/read-only data */ - .text : { *(.text .gnu.linkonce.t.*) } =0x9090 - - .rodata : - { - *(.rodata) - . = ALIGN(0x1000); - } =0x9000 + .text : { *(.text .gnu.linkonce.t.*) } + .rodata : { *(.rodata .rodata.*) } /* writable data */ . = ALIGN(0x1000) + (. & (0x1000 - 1)); diff --git a/kernel/arch/sh4/arch_cpu.c b/kernel/arch/sh4/arch_cpu.c index c232134..0cb0b6b 100644 --- a/kernel/arch/sh4/arch_cpu.c +++ b/kernel/arch/sh4/arch_cpu.c @@ -24,6 +24,11 @@ int arch_cpu_init(kernel_args *ka) return 0; } +int arch_cpu_init_percpu(kernel_args *ka, int curr_cpu) +{ + return 0; +} + int arch_cpu_init2(kernel_args *ka) { return 0; diff --git a/kernel/arch/sh4/arch_thread.c b/kernel/arch/sh4/arch_thread.c index 9e6b5fa..1423393 100644 --- a/kernel/arch/sh4/arch_thread.c +++ b/kernel/arch/sh4/arch_thread.c @@ -1,5 +1,5 @@ /* -** Copyright 2001-2004, Travis Geiselbrecht. All rights reserved. +** Copyright 2001-2006, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ #include @@ -12,6 +12,11 @@ static struct thread *curr_thread = NULL; +int arch_thread_init(kernel_args *ka) +{ + return 0; +} + int arch_proc_init_proc_struct(struct proc *p, bool kernel) { #if 0 @@ -80,7 +85,7 @@ int arch_thread_initialize_kthread_stack(struct thread *t, int (*start_func)(voi return 0; } -void arch_thread_context_switch(struct thread *t_from, struct thread *t_to) +void arch_thread_context_switch(struct thread *t_from, struct thread *t_to, struct vm_translation_map_struct *new_tmap) { #if 0 int i; @@ -95,7 +100,7 @@ void arch_thread_context_switch(struct thread *t_from, struct thread *t_to) sh4_set_kstack(t_to->kernel_stack_base + KSTACK_SIZE); if(t_to->proc->aspace != NULL) { - sh4_set_user_pgdir(vm_translation_map_get_pgdir(&t_to->proc->aspace->translation_map)); + sh4_set_user_pgdir(vm_translation_map_get_pgdir(new_tmap)); } else { sh4_set_user_pgdir(NULL); } @@ -136,3 +141,30 @@ void arch_thread_set_current_thread(struct thread *t) curr_thread = t; } +/* signal stuff */ + + +int +arch_setup_signal_frame(struct thread *t, struct sigaction *sa, int sig, int sig_mask) +{ + PANIC_UNIMPLEMENTED(); + + return 0; +} + +int64 +arch_restore_signal_frame(void) +{ + PANIC_UNIMPLEMENTED(); + + return 0; +} + + +void +arch_check_syscall_restart(struct thread *t) +{ + PANIC_UNIMPLEMENTED(); +} + + diff --git a/kernel/arch/sh4/arch_time.c b/kernel/arch/sh4/arch_time.c new file mode 100644 index 0000000..797e0d3 --- /dev/null +++ b/kernel/arch/sh4/arch_time.c @@ -0,0 +1,28 @@ +/* +** Copyright 2006, Travis Geiselbrecht. All rights reserved. +** Distributed under the terms of the NewOS License. +*/ +#include +#include +#include +#include + +int arch_time_init(kernel_args *ka) +{ + return 0; +} + +void arch_time_tick(void) +{ +} + +bigtime_t arch_get_time_delta(void) +{ + return 0; +} + +bigtime_t arch_get_rtc_delta(void) +{ + return 0; +} + diff --git a/kernel/arch/sh4/arch_vm_translation_map.c b/kernel/arch/sh4/arch_vm_translation_map.c index ed594f3..5f2be74 100644 --- a/kernel/arch/sh4/arch_vm_translation_map.c +++ b/kernel/arch/sh4/arch_vm_translation_map.c @@ -342,8 +342,8 @@ int vm_translation_map_create(vm_translation_map *new_map, bool kernel) } else { // kernel // we already know the kernel pgdir mapping - (addr_t)new_map->arch_data->pgdir_virt = NULL; - (addr_t)new_map->arch_data->pgdir_phys = vcpu->kernel_pgdir; + new_map->arch_data->pgdir_virt = (addr_t)NULL; + new_map->arch_data->pgdir_phys = (addr_t)vcpu->kernel_pgdir; new_map->arch_data->is_user = false; } diff --git a/kernel/arch/sh4/kernel.ld b/kernel/arch/sh4/kernel.ld index a375510..0dd7c18 100644 --- a/kernel/arch/sh4/kernel.ld +++ b/kernel/arch/sh4/kernel.ld @@ -31,17 +31,12 @@ SECTIONS .rela.bss : { *(.rela.bss) } .rel.plt : { *(.rel.plt) } .rela.plt : { *(.rela.plt) } - .init : { *(.init) } =0x9090 + .init : { *(.init) } .plt : { *(.plt) } /* text/read-only data */ - .text : { *(.text .gnu.linkonce.t.*) } =0x9090 - - .rodata : - { - *(.rodata) - . = ALIGN(0x1000); - } =0x9000 + .text : { *(.text .gnu.linkonce.t.*) } + .rodata : { *(.rodata .rodata.*) } /* writable data */ . = ALIGN(0x1000); diff --git a/kernel/arch/sh4/makefile b/kernel/arch/sh4/makefile index d65c779..7c78dfa 100644 --- a/kernel/arch/sh4/makefile +++ b/kernel/arch/sh4/makefile @@ -10,6 +10,7 @@ MY_OBJS += \ $(KERNEL_ARCH_SH4_DIR)/arch_faults.o \ $(KERNEL_ARCH_SH4_DIR)/arch_int.o \ $(KERNEL_ARCH_SH4_DIR)/arch_smp.o \ + $(KERNEL_ARCH_SH4_DIR)/arch_time.o \ $(KERNEL_ARCH_SH4_DIR)/arch_timer.o \ $(KERNEL_ARCH_SH4_DIR)/arch_thread.o \ $(KERNEL_ARCH_SH4_DIR)/arch_vm.o \ diff --git a/make.syscfg b/make.syscfg index 12b1876..5066512 100644 --- a/make.syscfg +++ b/make.syscfg @@ -167,7 +167,7 @@ ifeq ($(ARCH),arm) endif ifeq ($(ARCH),sh4) - GLOBAL_CFLAGS = -ml -m4-single-only -mhitachi -O2 -g + GLOBAL_CFLAGS = -ml -m4-single-only -mhitachi -O2 -g -D__SH4__ KERNEL_CFLAGS = -fno-pic USER_CFLAGS = -fpic GLOBAL_LDFLAGS = -EL -- 2.11.4.GIT