- Timestamp:
- 2010-11-26T20:08:10Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 45df59a
- Parents:
- fb150d78 (diff), ffdd2b9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- boot/arch
- Files:
-
- 18 added
- 136 deleted
- 6 edited
- 38 moved
-
abs32le/Makefile.inc (added)
-
amd64/Makefile.inc (modified) (1 diff)
-
arm32/Makefile.inc (modified) (1 diff)
-
arm32/_link.ld.in (added)
-
arm32/include/arch.h (added)
-
arm32/include/asm.h (moved) (moved from boot/arch/arm32/loader/asm.h ) (1 diff)
-
arm32/include/main.h (moved) (moved from boot/arch/arm32/loader/print/print.c ) (2 diffs)
-
arm32/include/mm.h (added)
-
arm32/include/types.h (moved) (moved from boot/arch/ppc32/loader/main.h ) (2 diffs)
-
arm32/loader/Makefile.build (deleted)
-
arm32/loader/Makefile.toolchain (deleted)
-
arm32/loader/_link.ld.in (deleted)
-
arm32/loader/main.c (deleted)
-
arm32/loader/mm.c (deleted)
-
arm32/loader/mm.h (deleted)
-
arm32/src/asm.S (moved) (moved from boot/arch/arm32/loader/boot.S ) (2 diffs)
-
arm32/src/main.c (added)
-
arm32/src/mm.c (added)
-
arm32/src/putchar.c (added)
-
ia32/grub (deleted)
-
ia64/Makefile.inc (modified) (1 diff)
-
ia64/_link.ld.in (moved) (moved from boot/arch/ia64/loader/_link.ld.in ) (1 diff)
-
ia64/include/arch.h (moved) (moved from boot/arch/sparc64/loader/stack.h ) (2 diffs)
-
ia64/include/asm.h (moved) (moved from boot/arch/ia64/loader/asm.h ) (1 diff)
-
ia64/include/main.h (moved) (moved from boot/arch/ia64/loader/main.h ) (1 diff)
-
ia64/include/ski.h (added)
-
ia64/include/types.h (moved) (moved from boot/arch/mips32/loader/main.h ) (1 diff)
-
ia64/loader/Makefile (deleted)
-
ia64/loader/Makefile.build (deleted)
-
ia64/loader/Makefile.toolchain (deleted)
-
ia64/loader/gefi/ChangeLog (deleted)
-
ia64/loader/gefi/HelenOS/Makefile (deleted)
-
ia64/loader/gefi/HelenOS/division.c (deleted)
-
ia64/loader/gefi/HelenOS/division.h (deleted)
-
ia64/loader/gefi/HelenOS/hello.c (deleted)
-
ia64/loader/gefi/HelenOS/mkimage.c (deleted)
-
ia64/loader/gefi/Make.defaults (deleted)
-
ia64/loader/gefi/Make.rules (deleted)
-
ia64/loader/gefi/Makefile (deleted)
-
ia64/loader/gefi/README.efilib (deleted)
-
ia64/loader/gefi/README.elilo (deleted)
-
ia64/loader/gefi/README.gnuefi (deleted)
-
ia64/loader/gefi/apps/Makefile (deleted)
-
ia64/loader/gefi/apps/printenv.c (deleted)
-
ia64/loader/gefi/apps/t.c (deleted)
-
ia64/loader/gefi/apps/t2.c (deleted)
-
ia64/loader/gefi/apps/t3.c (deleted)
-
ia64/loader/gefi/apps/t4.c (deleted)
-
ia64/loader/gefi/apps/t5.c (deleted)
-
ia64/loader/gefi/apps/t6.c (deleted)
-
ia64/loader/gefi/apps/t7.c (deleted)
-
ia64/loader/gefi/apps/tpause.c (deleted)
-
ia64/loader/gefi/apps/trivial.S (deleted)
-
ia64/loader/gefi/gnuefi/Makefile (deleted)
-
ia64/loader/gefi/gnuefi/crt0-efi-ia32.S (deleted)
-
ia64/loader/gefi/gnuefi/crt0-efi-ia64.S (deleted)
-
ia64/loader/gefi/gnuefi/elf_ia32_efi.lds (deleted)
-
ia64/loader/gefi/gnuefi/elf_ia64_efi.lds (deleted)
-
ia64/loader/gefi/gnuefi/reloc_ia32.c (deleted)
-
ia64/loader/gefi/gnuefi/reloc_ia64.S (deleted)
-
ia64/loader/gefi/inc/Makefile (deleted)
-
ia64/loader/gefi/inc/efi.h (deleted)
-
ia64/loader/gefi/inc/efi_nii.h (deleted)
-
ia64/loader/gefi/inc/efi_pxe.h (deleted)
-
ia64/loader/gefi/inc/efiapi.h (deleted)
-
ia64/loader/gefi/inc/eficon.h (deleted)
-
ia64/loader/gefi/inc/efidebug.h (deleted)
-
ia64/loader/gefi/inc/efidef.h (deleted)
-
ia64/loader/gefi/inc/efidevp.h (deleted)
-
ia64/loader/gefi/inc/efierr.h (deleted)
-
ia64/loader/gefi/inc/efifs.h (deleted)
-
ia64/loader/gefi/inc/efigpt.h (deleted)
-
ia64/loader/gefi/inc/efilib.h (deleted)
-
ia64/loader/gefi/inc/efilink.h (deleted)
-
ia64/loader/gefi/inc/efinet.h (deleted)
-
ia64/loader/gefi/inc/efipart.h (deleted)
-
ia64/loader/gefi/inc/efiprot.h (deleted)
-
ia64/loader/gefi/inc/efipxebc.h (deleted)
-
ia64/loader/gefi/inc/efirtlib.h (deleted)
-
ia64/loader/gefi/inc/efiser.h (deleted)
-
ia64/loader/gefi/inc/efistdarg.h (deleted)
-
ia64/loader/gefi/inc/efiui.h (deleted)
-
ia64/loader/gefi/inc/ia32/efibind.h (deleted)
-
ia64/loader/gefi/inc/ia32/efilibplat.h (deleted)
-
ia64/loader/gefi/inc/ia32/pe.h (deleted)
-
ia64/loader/gefi/inc/ia64/efibind.h (deleted)
-
ia64/loader/gefi/inc/ia64/efilibplat.h (deleted)
-
ia64/loader/gefi/inc/ia64/pe.h (deleted)
-
ia64/loader/gefi/inc/ia64/salproc.h (deleted)
-
ia64/loader/gefi/inc/inc.mak (deleted)
-
ia64/loader/gefi/inc/libsmbios.h (deleted)
-
ia64/loader/gefi/inc/make.inf (deleted)
-
ia64/loader/gefi/inc/makefile.hdr (deleted)
-
ia64/loader/gefi/inc/pci22.h (deleted)
-
ia64/loader/gefi/inc/protocol/adapterdebug.h (deleted)
-
ia64/loader/gefi/inc/protocol/eficonsplit.h (deleted)
-
ia64/loader/gefi/inc/protocol/efidbg.h (deleted)
-
ia64/loader/gefi/inc/protocol/efivar.h (deleted)
-
ia64/loader/gefi/inc/protocol/ia64/eficontext.h (deleted)
-
ia64/loader/gefi/inc/protocol/intload.h (deleted)
-
ia64/loader/gefi/inc/protocol/legacyboot.h (deleted)
-
ia64/loader/gefi/inc/protocol/make.inf (deleted)
-
ia64/loader/gefi/inc/protocol/makefile.hdr (deleted)
-
ia64/loader/gefi/inc/protocol/piflash64.h (deleted)
-
ia64/loader/gefi/inc/protocol/readme.txt (deleted)
-
ia64/loader/gefi/inc/protocol/vgaclass.h (deleted)
-
ia64/loader/gefi/inc/romload.h (deleted)
-
ia64/loader/gefi/lib/Makefile (deleted)
-
ia64/loader/gefi/lib/boxdraw.c (deleted)
-
ia64/loader/gefi/lib/console.c (deleted)
-
ia64/loader/gefi/lib/crc.c (deleted)
-
ia64/loader/gefi/lib/data.c (deleted)
-
ia64/loader/gefi/lib/debug.c (deleted)
-
ia64/loader/gefi/lib/dpath.c (deleted)
-
ia64/loader/gefi/lib/error.c (deleted)
-
ia64/loader/gefi/lib/event.c (deleted)
-
ia64/loader/gefi/lib/guid.c (deleted)
-
ia64/loader/gefi/lib/hand.c (deleted)
-
ia64/loader/gefi/lib/hw.c (deleted)
-
ia64/loader/gefi/lib/ia32/initplat.c (deleted)
-
ia64/loader/gefi/lib/ia32/math.c (deleted)
-
ia64/loader/gefi/lib/ia64/initplat.c (deleted)
-
ia64/loader/gefi/lib/ia64/math.c (deleted)
-
ia64/loader/gefi/lib/ia64/palproc.S (deleted)
-
ia64/loader/gefi/lib/ia64/palproc.h (deleted)
-
ia64/loader/gefi/lib/ia64/salpal.c (deleted)
-
ia64/loader/gefi/lib/init.c (deleted)
-
ia64/loader/gefi/lib/lib.h (deleted)
-
ia64/loader/gefi/lib/lock.c (deleted)
-
ia64/loader/gefi/lib/misc.c (deleted)
-
ia64/loader/gefi/lib/print.c (deleted)
-
ia64/loader/gefi/lib/runtime/efirtlib.c (deleted)
-
ia64/loader/gefi/lib/runtime/rtdata.c (deleted)
-
ia64/loader/gefi/lib/runtime/rtlock.c (deleted)
-
ia64/loader/gefi/lib/runtime/rtstr.c (deleted)
-
ia64/loader/gefi/lib/runtime/vm.c (deleted)
-
ia64/loader/gefi/lib/smbios.c (deleted)
-
ia64/loader/gefi/lib/sread.c (deleted)
-
ia64/loader/gefi/lib/str.c (deleted)
-
ia64/loader/main.c (deleted)
-
ia64/loader/stack.h (deleted)
-
ia64/src/asm.S (moved) (moved from boot/arch/ia64/loader/asm.S ) (2 diffs)
-
ia64/src/boot.S (moved) (moved from boot/arch/ia64/loader/boot.S ) (2 diffs)
-
ia64/src/main.c (added)
-
ia64/src/putchar.c (added)
-
ia64/src/ski.c (added)
-
mips32/Makefile.inc (modified) (1 diff)
-
mips32/_link.ld.in (added)
-
mips32/include/arch.h (moved) (moved from boot/arch/sparc64/loader/asm.h ) (2 diffs)
-
mips32/include/asm.h (moved) (moved from boot/arch/mips32/loader/asm.h ) (1 diff)
-
mips32/include/main.h (moved) (moved from kernel/arch/ia32/include/debug.h ) (1 diff)
-
mips32/include/regname.h (moved) (moved from boot/arch/mips32/loader/regname.h ) (1 diff)
-
mips32/include/types.h (moved) (moved from boot/arch/arm32/loader/types.h ) (1 diff)
-
mips32/loader/main.c (deleted)
-
mips32/src/Makefile (moved) (moved from boot/arch/mips32/loader/Makefile )
-
mips32/src/Makefile.build (moved) (moved from boot/arch/mips32/loader/Makefile.build )
-
mips32/src/Makefile.common (moved) (moved from boot/arch/mips32/loader/Makefile.common )
-
mips32/src/Makefile.toolchain (moved) (moved from boot/arch/mips32/loader/Makefile.toolchain )
-
mips32/src/asm.S (moved) (moved from boot/arch/mips32/loader/asm.S ) (2 diffs)
-
mips32/src/boot.S (moved) (moved from boot/arch/mips32/loader/boot.S )
-
mips32/src/main.c (added)
-
mips32/src/msim.h (moved) (moved from boot/arch/mips32/loader/msim.h )
-
mips32/src/putchar.c (moved) (moved from kernel/test/sysinfo/sysinfo1.c ) (2 diffs)
-
ppc32/Makefile.inc (modified) (1 diff)
-
ppc32/_link.ld.in (moved) (moved from boot/arch/ppc32/loader/_link.ld.in ) (2 diffs)
-
ppc32/include/arch.h (moved) (moved from boot/arch/ia64/loader/types.h ) (1 diff)
-
ppc32/include/asm.h (moved) (moved from boot/arch/mips32/loader/msim.c ) (1 diff)
-
ppc32/include/main.h (added)
-
ppc32/include/ofw.h (moved) (moved from boot/arch/ppc32/loader/ofwarch.h )
-
ppc32/include/regname.h (moved) (moved from boot/arch/ppc32/loader/regname.h ) (1 diff)
-
ppc32/include/types.h (moved) (moved from boot/arch/ppc32/loader/types.h ) (1 diff)
-
ppc32/loader/Makefile (deleted)
-
ppc32/loader/Makefile.build (deleted)
-
ppc32/loader/Makefile.common (deleted)
-
ppc32/loader/Makefile.toolchain (deleted)
-
ppc32/loader/asm.h (deleted)
-
ppc32/loader/main.c (deleted)
-
ppc32/src/asm.S (moved) (moved from boot/arch/ppc32/loader/asm.S ) (11 diffs)
-
ppc32/src/main.c (added)
-
ppc32/src/ofw.c (moved) (moved from boot/arch/ppc32/loader/ofwarch.c ) (1 diff)
-
sparc64/Makefile.inc (modified) (1 diff)
-
sparc64/_link.ld.in (moved) (moved from boot/arch/mips32/loader/_link.ld.in ) (1 diff)
-
sparc64/include/arch.h (added)
-
sparc64/include/asm.h (moved) (moved from boot/arch/sparc64/loader/register.h ) (2 diffs)
-
sparc64/include/main.h (added)
-
sparc64/include/ofw.h (moved) (moved from boot/arch/sparc64/loader/ofwarch.h ) (1 diff)
-
sparc64/include/types.h (moved) (moved from boot/arch/sparc64/loader/types.h ) (1 diff)
-
sparc64/loader/Makefile (deleted)
-
sparc64/loader/Makefile.build (deleted)
-
sparc64/loader/Makefile.common (deleted)
-
sparc64/loader/Makefile.toolchain (deleted)
-
sparc64/loader/_link.ld.in (deleted)
-
sparc64/loader/boot.S (deleted)
-
sparc64/loader/main.c (deleted)
-
sparc64/silo/silo.conf (deleted)
-
sparc64/src/asm.S (moved) (moved from boot/arch/sparc64/loader/asm.S ) (7 diffs)
-
sparc64/src/main.c (added)
-
sparc64/src/ofw.c (moved) (moved from boot/arch/sparc64/loader/ofwarch.c ) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/amd64/Makefile.inc
rfb150d78 r46c20c8 27 27 # 28 28 29 include Makefile.common 29 PAGE_SIZE = 4096 30 30 31 RD_SRVS += \ 32 $(USPACEDIR)/srv/bd/ata_bd/ata_bd \ 33 $(USPACEDIR)/srv/hw/char/i8042/i8042 \ 34 $(USPACEDIR)/srv/hw/bus/pci/pci \ 35 $(USPACEDIR)/srv/hid/char_mouse/char_ms 31 RD_SRVS_ESSENTIAL += \ 32 $(USPACE_PATH)/srv/hw/char/i8042/i8042 36 33 37 MODULES := $(notdir $(COMPONENTS)) 34 RD_SRVS_NON_ESSENTIAL += \ 35 $(USPACE_PATH)/srv/bd/ata_bd/ata_bd \ 36 $(USPACE_PATH)/srv/hid/char_mouse/char_ms 38 37 39 build: $(BASE)/image.iso 38 RD_DRVS += \ 39 rootia32 \ 40 pciintel \ 41 isa \ 42 ns8250 43 44 RD_DRV_CFG += \ 45 isa/isa.dev 40 46 41 $(BASE)/image.iso: arch/$(BARCH)/grub/stage2_eltorito $(KERNELDIR)/kernel.bin $(INIT_TASKS) $(RD_SRVS) $(RD_APPS) 42 mkdir -p $(TMP)/boot/grub 43 cp arch/$(BARCH)/grub/stage2_eltorito $(TMP)/boot/grub/ 44 45 echo "default 0" > $(TMP)/boot/grub/menu.lst 46 echo "timeout 10" >> $(TMP)/boot/grub/menu.lst 47 echo "" >> $(TMP)/boot/grub/menu.lst 48 echo "title=HelenOS" >> $(TMP)/boot/grub/menu.lst 49 echo " root (cd)" >> $(TMP)/boot/grub/menu.lst 50 for module in $(MODULES) $(INITRD).img ; do \ 51 if [ $$module = kernel.bin ] ; then \ 52 echo " kernel /boot/$$module" >> $(TMP)/boot/grub/menu.lst ; \ 53 else \ 54 echo " module /boot/$$module" >> $(TMP)/boot/grub/menu.lst ; \ 55 fi \ 56 done 57 58 cp $(KERNELDIR)/kernel.bin $(TMP)/boot/ 59 for task in $(INIT_TASKS) ; do \ 60 cp $$task $(TMP)/boot/ ; \ 61 done 62 for file in $(RD_SRVS) ; do \ 63 cp $$file $(USPACEDIR)/dist/srv/ ; \ 64 done 65 for file in $(RD_APPS) ; do \ 66 cp $$file $(USPACEDIR)/dist/app/ ; \ 67 done 68 69 ifeq ($(RDFMT),tmpfs) 70 $(BASE)/tools/mktmpfs.py $(USPACEDIR)/dist/ $(TMP)/boot/$(INITRD).fs 71 endif 72 ifeq ($(RDFMT),fat) 73 $(BASE)/tools/mkfat.py $(USPACEDIR)/dist/ $(TMP)/boot/$(INITRD).fs 74 endif 75 $(BASE)/tools/mkhord.py 4096 $(TMP)/boot/$(INITRD).fs $(TMP)/boot/$(INITRD).img 76 rm $(TMP)/boot/$(INITRD).fs 77 mkisofs -J -r -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o $@ $(TMP)/ 78 79 clean: 80 for file in $(RD_SRVS) ; do \ 81 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ 82 done 83 for file in $(RD_APPS) ; do \ 84 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ 85 done 86 rm -fr $(TMP) 87 rm -f $(BASE)/image.iso 47 BOOT_OUTPUT = $(ROOT_PATH)/image.iso 48 PREBUILD = $(INITRD).img 49 BUILD = Makefile.grub -
boot/arch/arm32/Makefile.inc
rfb150d78 r46c20c8 27 27 # 28 28 29 build: $(BASE)/image.boot 29 ifeq ($(MACHINE), gta02) 30 BOOT_OUTPUT = image.boot 31 POST_OUTPUT = $(ROOT_PATH)/uImage.bin 32 POSTBUILD = Makefile.uboot 33 endif 30 34 31 $(BASE)/image.boot: 32 $(MAKE) -C arch/$(BARCH)/loader PRECHECK=$(PRECHECK)33 cp arch/$(BARCH)/loader/image.boot $@ 35 BFD_NAME = elf32-littlearm 36 BFD_OUTPUT = $(BFD_NAME) 37 BFD_ARCH = arm 34 38 35 clean: 36 $(MAKE) -C arch/$(BARCH)/loader clean 37 rm -f $(BASE)/image.boot 39 BITS = 32 40 ENDIANESS = LE 41 PAGE_SIZE = 4096 42 43 RD_SRVS_ESSENTIAL += \ 44 $(USPACE_PATH)/srv/hid/s3c24xx_ts/s3c24ts \ 45 $(USPACE_PATH)/srv/hw/char/s3c24xx_uart/s3c24ser 46 47 RD_SRVS_NON_ESSENTIAL += \ 48 $(USPACE_PATH)/srv/bd/gxe_bd/gxe_bd 49 50 SOURCES = \ 51 arch/$(BARCH)/src/asm.S \ 52 arch/$(BARCH)/src/main.c \ 53 arch/$(BARCH)/src/mm.c \ 54 arch/$(BARCH)/src/putchar.c \ 55 $(COMPS_C) \ 56 genarch/src/division.c \ 57 generic/src/memstr.c \ 58 generic/src/printf_core.c \ 59 generic/src/vprintf.c \ 60 generic/src/printf.c \ 61 generic/src/str.c \ 62 generic/src/version.c \ 63 generic/src/inflate.c -
boot/arch/arm32/include/asm.h
rfb150d78 r46c20c8 27 27 */ 28 28 29 30 29 /** @addtogroup arm32boot 31 30 * @{ 32 31 */ 33 32 /** @file 34 * @brief Functions implemented in assembly.33 * @brief Functions implemented in assembly. 35 34 */ 36 37 35 38 36 #ifndef BOOT_arm32_ASM_H 39 37 #define BOOT_arm32_ASM_H 40 38 39 #include <arch/arch.h> 40 #include <arch/mm.h> 41 41 42 /** Called when the CPU is switched on. 42 extern pte_level0_section_t boot_pt[PTL0_ENTRIES]; 43 extern void *boot_stack; 44 45 /** Jump to the kernel entry point. 43 46 * 44 * This function is placed to the 0x0 address where ARM CPU starts execution. 45 * Jumps to the #bootstrap only. 46 */ 47 extern void start(void); 48 49 50 /** Jumps to the kernel entry point. 51 * 52 * @param entry Kernel entry point address. 47 * @param entry Kernel entry point. 53 48 * @param bootinfo Structure holding information about loaded tasks. 54 49 * 55 50 */ 56 extern void jump_to_kernel(void *entry, void *bootinfo) __attribute__((noreturn));57 51 extern void jump_to_kernel(void *entry, void *bootinfo) 52 __attribute__((noreturn)); 58 53 59 54 #endif -
boot/arch/arm32/include/main.h
rfb150d78 r46c20c8 1 1 /* 2 2 * Copyright (c) 2007 Michal Kebrt 3 * Copyright (c) 20 09 Vineeth Pillai3 * Copyright (c) 2010 Jiri Svoboda 4 4 * All rights reserved. 5 5 * … … 28 28 */ 29 29 30 31 30 /** @addtogroup arm32boot 32 31 * @{ 33 32 */ 34 33 /** @file 35 * @brief bootloader output logic 36 */ 34 * @brief Boot related declarations. 35 */ 36 37 #ifndef BOOT_arm32_MAIN_H 38 #define BOOT_arm32_MAIN_H 39 40 /** Address where characters to be printed are expected. */ 41 42 /** GTA02 serial console UART register addresses. 43 * 44 * This is UART channel 2 of the S3C24xx CPU 45 */ 46 #define GTA02_SCONS_UTRSTAT 0x50008010 47 #define GTA02_SCONS_UTXH 0x50008020 48 49 /* Bits in UTXH register */ 50 #define S3C24XX_UTXH_TX_EMPTY 0x00000004 37 51 38 52 39 #include <printf.h> 53 /** GXemul testarm serial console output register */ 54 #define TESTARM_SCONS_ADDR 0x10000000 40 55 56 /** IntegratorCP serial console output register */ 57 #define ICP_SCONS_ADDR 0x16000000 41 58 42 /** Address where characters to be printed are expected. */ 43 #ifdef MACHINE_testarm 44 #define PUTC_ADDRESS 0x10000000 59 extern void bootstrap(void); 60 45 61 #endif 46 47 #ifdef MACHINE_integratorcp48 #define PUTC_ADDRESS 0x1600000049 #endif50 51 52 53 /** Prints a character to the console.54 *55 * @param ch Character to be printed.56 */57 static void putc(char ch)58 {59 if (ch == '\n')60 *((volatile char *) PUTC_ADDRESS) = '\r';61 *((volatile char *) PUTC_ADDRESS) = ch;62 }63 64 65 /** Prints a string to the console.66 *67 * @param str String to be printed.68 * @param len Number of characters to be printed.69 */70 void write(const char *str, const int len)71 {72 int i;73 for (i = 0; i < len; ++i) {74 putc(str[i]);75 }76 }77 62 78 63 /** @} 79 64 */ 80 -
boot/arch/arm32/include/types.h
rfb150d78 r46c20c8 1 1 /* 2 * Copyright (c) 200 5Martin Decky2 * Copyright (c) 2006 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 #ifndef BOOT_ppc32_MAIN_H_ 30 #define BOOT_ppc32_MAIN_H_ 29 /** @addtogroup arm32boot 30 * @{ 31 */ 32 /** @file 33 * @brief Definitions of basic types like #uintptr_t. 34 */ 31 35 32 #include <ofw.h> 33 #include <ofw_tree.h> 34 #include <balloc.h> 35 #include <types.h> 36 #ifndef BOOT_arm32_TYPES_H 37 #define BOOT_arm32_TYPES_H 36 38 37 #define TASKMAP_MAX_RECORDS 32 38 39 /** Size of buffer for storing task name in task_t. */ 39 #define TASKMAP_MAX_RECORDS 32 40 40 #define BOOTINFO_TASK_NAME_BUFLEN 32 41 41 42 typedef uint32_t size_t; 43 typedef uint32_t uintptr_t; 44 45 typedef uint32_t pfn_t; 46 42 47 typedef struct { 48 /** Address where the task was placed. */ 43 49 void *addr; 44 uint32_t size; 50 /** Size of the task's binary. */ 51 size_t size; 52 /** Task name. */ 45 53 char name[BOOTINFO_TASK_NAME_BUFLEN]; 46 54 } task_t; 47 55 48 56 typedef struct { 49 uint32_t count;57 size_t cnt; 50 58 task_t tasks[TASKMAP_MAX_RECORDS]; 51 } taskmap_t;52 53 typedef struct {54 memmap_t memmap;55 taskmap_t taskmap;56 ballocs_t ballocs;57 ofw_tree_node_t *ofw_root;58 59 } bootinfo_t; 59 60 60 extern void start(void); 61 extern void bootstrap(void); 61 #endif 62 62 63 #endif 63 /** @} 64 */ -
boot/arch/arm32/src/asm.S
rfb150d78 r46c20c8 27 27 # 28 28 29 30 #include "mm.h" 29 #include <arch/arch.h> 31 30 32 31 .section BOOTSTRAP 33 32 34 33 .global start 34 .global boot_pt 35 .global boot_stack 36 .global halt 35 37 .global jump_to_kernel 36 .global page_table37 .global boot_stack38 38 39 39 start: 40 40 ldr sp, =boot_stack 41 41 b bootstrap 42 43 .section BOOTPT 44 boot_pt: 45 .space PTL0_ENTRIES * PTL0_ENTRY_SIZE 46 47 .section BOOTSTACK 48 .space 4096 49 boot_stack: 50 51 .text 52 53 halt: 54 b halt 42 55 43 56 jump_to_kernel: … … 48 61 # 49 62 bx r0 50 51 #bootloader stack52 .section ST53 .space 409654 boot_stack:55 56 # place page_table to PT section57 .section PT58 59 # make place for PTL0 page table60 page_table:61 .skip PTL0_ENTRIES * PTL0_ENTRY_SIZE -
boot/arch/ia64/Makefile.inc
rfb150d78 r46c20c8 27 27 # 28 28 29 build: $(BASE)/image.boot 29 BFD_NAME = elf64-ia64-little 30 BFD_OUTPUT = $(BFD_NAME) 31 BFD_ARCH = ia64 30 32 31 $(BASE)/image.boot: 32 $(MAKE) -C arch/$(BARCH)/loader PRECHECK=$(PRECHECK) 33 cp arch/$(BARCH)/loader/image.boot $@ 33 BITS = 64 34 ENDIANESS = LE 35 PAGE_SIZE = 16384 36 EXTRA_CFLAGS = -fno-unwind-tables -mfixed-range=f32-f127 -mno-pic 34 37 35 clean: 36 $(MAKE) -C arch/$(BARCH)/loader clean 37 rm -f $(BASE)/image.boot $(BASE)/hello.efi $(BASE)/image.bin 38 RD_SRVS_NON_ESSENTIAL += 39 40 RD_SRVS_ESSENTIAL += \ 41 $(USPACE_PATH)/srv/hw/char/i8042/i8042 42 43 SOURCES = \ 44 arch/$(BARCH)/src/boot.S \ 45 arch/$(BARCH)/src/asm.S \ 46 arch/$(BARCH)/src/main.c \ 47 arch/$(BARCH)/src/putchar.c \ 48 $(COMPS_C) \ 49 genarch/src/division.c \ 50 generic/src/balloc.c \ 51 generic/src/memstr.c \ 52 generic/src/printf_core.c \ 53 generic/src/vprintf.c \ 54 generic/src/printf.c \ 55 generic/src/str.c \ 56 generic/src/version.c \ 57 generic/src/inflate.c 58 59 ifeq ($(MACHINE),ski) 60 SOURCES += \ 61 arch/$(BARCH)/src/ski.c 62 endif -
boot/arch/ia64/_link.ld.in
rfb150d78 r46c20c8 5 5 .boot 0x4400000: AT (0x4400000) { 6 6 *(BOOTSTRAP); 7 [[COMPONENTS]]8 . = ALIGN (16384);9 7 *(.text); 8 *(.sdata); 9 *(.sdata2); 10 *(.sbss); 10 11 *(.rodata); 11 12 *(.rodata.*); 12 13 *(.data); /* initialized data */ 13 14 _got = . ; 14 *(.got .got.*); 15 *(.got .got.*); 15 16 *(.bss); /* uninitialized static variables */ 16 17 *(COMMON); 18 [[COMPONENTS]] 17 19 } 18 20 19 .sboot : {20 *(.sdata);21 *(.sdata2);22 *(.sbss);23 }24 25 21 /DISCARD/ : { 26 22 *(.comment); -
boot/arch/ia64/include/arch.h
rfb150d78 r46c20c8 1 1 /* 2 * Copyright (c) 2006 Martin Decky 2 3 * Copyright (c) 2006 Jakub Jermar 3 4 * All rights reserved. … … 27 28 */ 28 29 29 #ifndef BOOT_ sparc64_STACK_H_30 #define BOOT_ sparc64_STACK_H_30 #ifndef BOOT_ia64_ARCH_H_ 31 #define BOOT_ia64_ARCH_H_ 31 32 33 #define PAGE_WIDTH 14 34 #define PAGE_SIZE (1 << PAGE_WIDTH) 35 36 #define LOADER_ADDRESS 0x4400000 37 #define KERNEL_ADDRESS 0x4800000 38 39 #define STACK_SIZE 8192 32 40 #define STACK_ALIGNMENT 16 33 #define STACK_BIAS 204734 #define STACK_WINDOW_SAVE_AREA_SIZE (16 * 8)35 41 36 42 #endif -
boot/arch/ia64/include/asm.h
rfb150d78 r46c20c8 31 31 #define BOOT_ia64_ASM_H_ 32 32 33 #include "types.h"34 #include "main.h"35 36 #define PAGE_WIDTH 1437 #define PAGE_SIZE (1 << PAGE_WIDTH)38 39 #define BALLOC_MAX_SIZE (128 * 1024)40 41 extern void halt(void);42 33 extern void jump_to_kernel(void *) __attribute__((noreturn)); 43 34 44 45 35 #endif -
boot/arch/ia64/include/main.h
rfb150d78 r46c20c8 30 30 #define BOOT_ia64_MAIN_H_ 31 31 32 #include <types.h>33 #include <../../../../kernel/arch/ia64/include/bootinfo.h>34 35 36 #define CONFIG_INIT_TASKS 3237 38 extern void start(void);39 32 extern void bootstrap(void); 40 33 -
boot/arch/ia64/include/types.h
rfb150d78 r46c20c8 27 27 */ 28 28 29 #ifndef BOOT_ mips32_MAIN_H_30 #define BOOT_ mips32_MAIN_H_29 #ifndef BOOT_ia64_TYPES_H_ 30 #define BOOT_ia64_TYPES_H_ 31 31 32 #define CPUMAP 0x8000100033 #define INITIAL_STACK 0x8000200034 #define M SIM_DORDER_ADDRESS 0xb000000432 #define TASKMAP_MAX_RECORDS 32 33 #define BOOTINFO_TASK_NAME_BUFLEN 32 34 #define MEMMAP_ITEMS 128 35 35 36 #define TASKMAP_MAX_RECORDS 32 37 #define CPUMAP_MAX_RECORDS 32 38 39 #ifndef __ASM__ 40 41 /** Size of buffer for storing task name in task_t. */ 42 #define BOOTINFO_TASK_NAME_BUFLEN 32 43 44 /** Struct holding information about single loaded task. */ 45 typedef struct { 46 /** Address where the task was placed. */ 47 void *addr; 48 /** Size of the task's binary. */ 49 unsigned int size; 50 /** Task name. */ 51 char name[BOOTINFO_TASK_NAME_BUFLEN]; 52 } task_t; 36 typedef uint64_t size_t; 37 typedef uint64_t unative_t; 38 typedef uint64_t uintptr_t; 53 39 54 40 typedef struct { 55 unsigned int cpumap; 56 unsigned int cnt; 57 task_t tasks[TASKMAP_MAX_RECORDS]; 41 void *addr; 42 size_t size; 43 char name[BOOTINFO_TASK_NAME_BUFLEN]; 44 } binit_task_t; 45 46 typedef struct { 47 size_t cnt; 48 binit_task_t tasks[TASKMAP_MAX_RECORDS]; 49 } binit_t; 50 51 typedef struct { 52 unsigned int type; 53 unsigned long base; 54 unsigned long size; 55 } efi_memmap_item_t; 56 57 typedef struct { 58 binit_t taskmap; 59 60 efi_memmap_item_t memmap[MEMMAP_ITEMS]; 61 unsigned int memmap_items; 62 63 unative_t *sapic; 64 unsigned long sys_freq; 65 unsigned long freq_scale; 66 unsigned int wakeup_intno; 67 int hello_configured; 58 68 } bootinfo_t; 59 69 60 extern void start(void);61 extern void bootstrap(void);62 63 70 #endif 64 65 #endif -
boot/arch/ia64/src/asm.S
rfb150d78 r46c20c8 1 1 # 2 2 # Copyright (c) 2006 Martin Decky 3 # Copyright (c) 2006 Jakub Jermar 3 # Copyright (c) 2006 Jakub Jermar 4 4 # All rights reserved. 5 5 # … … 28 28 # 29 29 30 #include < stack.h>30 #include <arch/arch.h> 31 31 32 32 .text 33 33 34 .global halt 35 .global memcpy 34 36 .global jump_to_kernel 35 37 38 halt: 39 br halt 40 36 41 jump_to_kernel: 37 alloc loc0 = ar.pfs, 1, 1, 0, 038 movl r8 = 0x4404000;; 39 mov b1 = r8;;40 mov r1 = in0; #Save bootinfo prt 41 br.call.sptk.many b0 = b1;;42 alloc loc0 = ar.pfs, 1, 1, 0, 0 43 mov r2 = in0 ;; # Pass bootinfo address 44 movl r8 = KERNEL_ADDRESS;; 45 mov b1 = r8 ;; 46 br.call.sptk.many b0 = b1;; -
boot/arch/ia64/src/boot.S
rfb150d78 r46c20c8 28 28 # 29 29 30 #include < stack.h>30 #include <arch/arch.h> 31 31 32 32 .section BOOTSTRAP, "ax" … … 34 34 .global start 35 35 start: 36 movl gp = LOADER_ADDRESS 36 37 37 38 # 39 # Initialize the register stack to some sane value. 40 # 38 41 mov ar.rsc = r0 39 # movl r8 = (VRN_KERNEL << VRN_SHIFT) ;;40 movl r1 = 0x440000041 42 movl r8 = initial_stack ;; 42 43 mov ar.bspstore = r8 43 44 loadrs 44 45 45 # initialize memory stack to some sane value 46 # 47 # Initialize memory stack to some sane value and allocate a scratch area 48 # on it. 49 # 46 50 movl r12 = initial_stack_top ;; 47 48 add r12 = -16, r12 /* allocate a scratch area on the stack */ 51 add r12 = -16, r12 49 52 50 # initialize gp (Global Pointer) register51 # movl r1 = _hardcoded_load_address52 53 ssm (1 << 19) ;; /* Disable f32 - f127 */53 # 54 # Disable Floating-point High register set (f32 - f127) 55 # 56 ssm (1 << 19) ;; 54 57 srlz.i 55 58 srlz.d ;; 56 59 57 movl r18 = bootstrap ;; 58 mov b1 = r18 ;; 59 br.call.sptk.many b0 = b1 60 br.call.sptk.many rp = bootstrap 60 61 61 .align 512 62 ap_start: 62 .bss 63 63 64 65 ap_loop: 66 movl r18=0x4405000;; 67 mov b1 = r18 ;; 68 br.call.sptk.many b0 = b1;; 69 70 .align 1024 71 72 .align 4096 73 .global binfo 74 binfo: 75 76 77 .bss #on this line is ".bss", it cannot be seen in my mcedit :-( 78 79 80 .align 8192 81 64 .align STACK_SIZE 82 65 initial_stack: 83 .space 8192 84 66 .space STACK_SIZE 85 67 initial_stack_top: -
boot/arch/mips32/Makefile.inc
rfb150d78 r46c20c8 27 27 # 28 28 29 build: $(BASE)/image.boot 29 BFD_ARCH = mips 30 BITS = 32 31 PAGE_SIZE = 16384 32 EXTRA_CFLAGS = -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3 30 33 31 $(BASE)/image.boot: 32 $(MAKE) -C arch/$(BARCH)/loader PRECHECK=$(PRECHECK) 33 cp arch/$(BARCH)/loader/image.boot $@ 34 RD_SRVS_ESSENTIAL += 34 35 35 clean: 36 $(MAKE) -C arch/$(BARCH)/loader clean 37 rm -f $(BASE)/image.boot 36 RD_SRVS_NON_ESSENTIAL += \ 37 $(USPACE_PATH)/srv/bd/gxe_bd/gxe_bd 38 39 ifeq ($(MACHINE),lgxemul) 40 BFD_NAME = elf32-tradlittlemips 41 BFD_OUTPUT = ecoff-littlemips 42 ENDIANESS = LE 43 endif 44 ifeq ($(MACHINE),bgxemul) 45 BFD_NAME = elf32-tradbigmips 46 BFD_OUTPUT = ecoff-bigmips 47 ENDIANESS = BE 48 endif 49 ifeq ($(MACHINE),msim) 50 BFD_NAME = elf32-tradlittlemips 51 BFD_OUTPUT = binary 52 ENDIANESS = LE 53 EXTRA_GCC_CFLAGS = -mhard-float 54 endif 55 56 SOURCES = \ 57 arch/$(BARCH)/src/asm.S \ 58 arch/$(BARCH)/src/main.c \ 59 arch/$(BARCH)/src/putchar.c \ 60 $(COMPS_C) \ 61 genarch/src/division.c \ 62 genarch/src/multiplication.c \ 63 generic/src/memstr.c \ 64 generic/src/printf_core.c \ 65 generic/src/vprintf.c \ 66 generic/src/printf.c \ 67 generic/src/str.c \ 68 generic/src/version.c \ 69 generic/src/inflate.c -
boot/arch/mips32/include/arch.h
rfb150d78 r46c20c8 1 1 /* 2 2 * Copyright (c) 2006 Martin Decky 3 * Copyright (c) 2006 Jakub Jermar4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 #ifndef BOOT_sparc64_ASM_H_ 31 #define BOOT_sparc64_ASM_H_ 32 33 #include "types.h" 34 #include "main.h" 29 #ifndef BOOT_mips32_ARCH_H_ 30 #define BOOT_mips32_ARCH_H_ 35 31 36 32 #define PAGE_WIDTH 14 37 33 #define PAGE_SIZE (1 << PAGE_WIDTH) 38 34 39 #define BALLOC_MAX_SIZE (128 * 1024) 35 #define CPUMAP_OFFSET 0x00001000 36 #define STACK_OFFSET 0x00002000 37 #define BOOTINFO_OFFSET 0x00003000 38 #define BOOT_OFFSET 0x00100000 39 #define LOADER_OFFSET 0x1fc00000 40 40 41 extern void halt(void); 42 extern void jump_to_kernel(void *entry, uint64_t cfg, bootinfo_t *bootinfo, 43 unsigned int bootinfo_size, uint8_t subarchitecture) __attribute__((noreturn)); 41 #define MSIM_VIDEORAM_ADDRESS 0xb0000000 42 #define MSIM_DORDER_ADDRESS 0xb0000004 43 44 #ifndef __ASM__ 45 #define PA2KA(addr) (((uintptr_t) (addr)) + 0x80000000) 46 #define KSEG2PA(addr) (((uintptr_t) (addr)) - 0xa0000000) 47 #else 48 #define PA2KA(addr) ((addr) + 0x80000000) 49 #define KSEG2PA(addr) ((addr) - 0xa0000000) 50 #endif 44 51 45 52 #endif -
boot/arch/mips32/include/asm.h
rfb150d78 r46c20c8 30 30 #define BOOT_mips32_ASM_H_ 31 31 32 #define PAGE_SIZE 16384 33 #define PAGE_WIDTH 14 34 35 void jump_to_kernel(void *entry, void *bootinfo) __attribute__((noreturn)); 32 extern void jump_to_kernel(void *, void *) __attribute__((noreturn)); 36 33 37 34 #endif -
boot/arch/mips32/include/main.h
rfb150d78 r46c20c8 27 27 */ 28 28 29 /** @addtogroup amd64debug 30 * @{ 31 */ 32 /** @file 33 */ 29 #ifndef BOOT_mips32_MAIN_H_ 30 #define BOOT_mips32_MAIN_H_ 34 31 35 #ifndef KERN_ia32_DEBUG_H_ 36 #define KERN_ia32_DEBUG_H_ 37 38 #include <arch/asm.h> 39 40 #define HERE get_ip() 32 extern void bootstrap(void); 41 33 42 34 #endif 43 44 /** @}45 */ -
boot/arch/mips32/include/regname.h
rfb150d78 r46c20c8 63 63 #define ra 31 64 64 65 #define rindex 066 #define rrandom 167 #define entrylo0 268 #define entrylo1 369 #define context 470 #define pagemask 571 #define wired 672 #define badvaddr 873 #define count 974 #define entryhi 1075 #define compare 1176 #define status 1277 #define cause 1378 #define epc 1479 #define rconfig 1680 #define lladdr 1781 #define watchlo 1882 #define watchhi 1983 #define xcontext 2084 #define rdebug 2385 #define depc 2486 #define eepc 3065 #define rindex 0 66 #define rrandom 1 67 #define entrylo0 2 68 #define entrylo1 3 69 #define context 4 70 #define pagemask 5 71 #define wired 6 72 #define badvaddr 8 73 #define count 9 74 #define entryhi 10 75 #define compare 11 76 #define status 12 77 #define cause 13 78 #define epc 14 79 #define rconfig 16 80 #define lladdr 17 81 #define watchlo 18 82 #define watchhi 19 83 #define xcontext 20 84 #define rdebug 23 85 #define depc 24 86 #define eepc 30 87 87 88 #endif /* _REGNAME_H_ */88 #endif -
boot/arch/mips32/include/types.h
rfb150d78 r46c20c8 27 27 */ 28 28 29 #ifndef BOOT_mips32_TYPES_H_ 30 #define BOOT_mips32_TYPES_H_ 29 31 30 /** @addtogroup arm32boot 31 * @{ 32 */ 33 /** @file 34 * @brief Definitions of basic types like #uintptr_t. 35 */ 32 #define TASKMAP_MAX_RECORDS 32 33 #define CPUMAP_MAX_RECORDS 32 34 #define BOOTINFO_TASK_NAME_BUFLEN 32 36 35 36 typedef uint32_t size_t; 37 typedef uint32_t uintptr_t; 37 38 38 #ifndef BOOT_arm32_TYPES_H 39 #define BOOT_arm32_TYPES_H 39 typedef struct { 40 /** Address where the task was placed. */ 41 void *addr; 42 /** Size of the task's binary. */ 43 size_t size; 44 /** Task name. */ 45 char name[BOOTINFO_TASK_NAME_BUFLEN]; 46 } task_t; 40 47 41 42 #include <gentypes.h> 43 44 typedef signed char int8_t; 45 46 typedef unsigned char uint8_t; 47 typedef unsigned short uint16_t; 48 typedef unsigned int uint32_t; 49 typedef unsigned long long uint64_t; 50 51 typedef uint32_t uintptr_t; 52 typedef uint32_t unative_t; 53 48 typedef struct { 49 uint32_t cpumap; 50 size_t cnt; 51 task_t tasks[TASKMAP_MAX_RECORDS]; 52 } bootinfo_t; 54 53 55 54 #endif 56 57 58 /** @}59 */ -
boot/arch/mips32/src/asm.S
rfb150d78 r46c20c8 27 27 # 28 28 29 #include "regname.h" 29 #include <arch/arch.h> 30 #include <arch/regname.h> 30 31 31 32 .set noat … … 33 34 .set nomacro 34 35 36 .global start 37 .global halt 38 .global jump_to_kernel 39 40 .section BOOTSTRAP 41 42 start: 43 /* Setup CPU map (on msim this code 44 is executed in parallel on all CPUs, 45 but it not an issue) */ 46 la $a0, PA2KA(CPUMAP_OFFSET) 47 48 sw $zero, 0($a0) 49 sw $zero, 4($a0) 50 sw $zero, 8($a0) 51 sw $zero, 12($a0) 52 53 sw $zero, 16($a0) 54 sw $zero, 20($a0) 55 sw $zero, 24($a0) 56 sw $zero, 28($a0) 57 58 sw $zero, 32($a0) 59 sw $zero, 36($a0) 60 sw $zero, 40($a0) 61 sw $zero, 44($a0) 62 63 sw $zero, 48($a0) 64 sw $zero, 52($a0) 65 sw $zero, 56($a0) 66 sw $zero, 60($a0) 67 68 sw $zero, 64($a0) 69 sw $zero, 68($a0) 70 sw $zero, 72($a0) 71 sw $zero, 76($a0) 72 73 sw $zero, 80($a0) 74 sw $zero, 84($a0) 75 sw $zero, 88($a0) 76 sw $zero, 92($a0) 77 78 sw $zero, 96($a0) 79 sw $zero, 100($a0) 80 sw $zero, 104($a0) 81 sw $zero, 108($a0) 82 83 sw $zero, 112($a0) 84 sw $zero, 116($a0) 85 sw $zero, 120($a0) 86 sw $zero, 124($a0) 87 88 lui $a1, 1 89 90 #ifdef MACHINE_msim 91 92 /* Read dorder value */ 93 la $k0, MSIM_DORDER_ADDRESS 94 lw $k1, ($k0) 95 96 /* If we are not running on BSP 97 then end in an infinite loop */ 98 beq $k1, $zero, bsp 99 nop 100 101 /* Record CPU presence */ 102 sll $a2, $k1, 2 103 addu $a2, $a2, $a0 104 sw $a1, ($a2) 105 106 loop: 107 j loop 108 nop 109 110 #endif 111 112 bsp: 113 /* Record CPU presence */ 114 sw $a1, ($a0) 115 116 /* Setup initial stack */ 117 la $sp, PA2KA(STACK_OFFSET) 118 119 j bootstrap 120 nop 121 35 122 .text 36 123 37 .global halt38 .global memcpy39 .global jump_to_kernel40 41 124 halt: 42 bhalt125 j halt 43 126 nop 44 45 memcpy:46 addiu $v0,$a1,347 li $v1,-4 # 0xfffffffffffffffc48 and $v0,$v0,$v149 beq $a1,$v0,3f50 move $t0,$a051 move $t2,$a0 # save dst52 53 0:54 beq $a2,$zero,2f55 move $a3,$zero56 57 1:58 addu $v0,$a1,$a359 lbu $a0,0($v0)60 addu $v1,$t0,$a361 addiu $a3,$a3,162 bne $a3,$a2,1b63 sb $a0,0($v1)64 65 2:66 jr $ra67 move $v0,$t268 69 3:70 addiu $v0,$a0,371 and $v0,$v0,$v172 bne $a0,$v0,0b73 srl $t1,$a2,274 75 beq $t1,$zero,5f76 move $a3,$zero77 78 move $a3,$zero79 move $a0,$zero80 4:81 addu $v0,$a1,$a082 lw $v1,0($v0)83 addiu $a3,$a3,184 addu $v0,$t0,$a085 sw $v1,0($v0)86 bne $a3,$t1,4b87 addiu $a0,$a0,488 89 5:90 andi $a2,$a2,0x391 beq $a2,$zero,2b92 nop93 94 sll $v0,$a3,295 addu $t1,$v0,$t096 move $a3,$zero97 addu $t0,$v0,$a198 6:99 addu $v0,$t0,$a3100 lbu $a0,0($v0)101 addu $v1,$t1,$a3102 addiu $a3,$a3,1103 bne $a3,$a2,6b104 sb $a0,0($v1)105 106 jr $ra107 move $v0,$t2108 127 109 128 jump_to_kernel: 110 129 # 111 # TODO 130 # TODO: 112 131 # Make sure that the I-cache, D-cache and memory are mutually coherent 113 132 # before passing control to the copied code. -
boot/arch/mips32/src/putchar.c
rfb150d78 r46c20c8 1 1 /* 2 * Copyright (c) 200 5 Jakub Vana2 * Copyright (c) 2006 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 #include <print.h> 30 #include <debug.h> 29 #include <typedefs.h> 30 #include <arch/arch.h> 31 #include <putchar.h> 32 #include <str.h> 31 33 32 #include <test.h> 33 #include <sysinfo/sysinfo.h> 34 35 char *test_sysinfo1(void) 34 void putchar(const wchar_t ch) 36 35 { 37 if (!test_quiet) 38 sysinfo_dump(NULL, 0); 39 return NULL; 36 if (ascii_check(ch)) 37 *((char *) MSIM_VIDEORAM_ADDRESS) = ch; 38 else 39 *((char *) MSIM_VIDEORAM_ADDRESS) = U_SPECIAL; 40 40 } -
boot/arch/ppc32/Makefile.inc
rfb150d78 r46c20c8 27 27 # 28 28 29 include Makefile.common 29 BOOT_OUTPUT = image.boot 30 POST_OUTPUT = $(ROOT_PATH)/image.iso 31 POSTBUILD = Makefile.yaboot 30 32 31 build: $(BASE)/image.iso 33 BFD_NAME = elf32-powerpc 34 BFD_OUTPUT = $(BFD_NAME) 35 BFD_ARCH = powerpc:common 32 36 33 $(BASE)/image.iso: arch/$(BARCH)/loader/image.boot 34 mkdir -p $(TMP)/boot 35 mkdir -p $(TMP)/ppc 36 cp arch/$(BARCH)/loader/image.boot $(TMP)/boot/image.boot 37 cp arch/$(BARCH)/yaboot/ofboot.b $(TMP)/boot/ofboot.b 38 cp arch/$(BARCH)/yaboot/bootinfo.txt $(TMP)/ppc/bootinfo.txt 39 cp arch/$(BARCH)/yaboot/yaboot $(TMP)/boot/yaboot 40 cp arch/$(BARCH)/yaboot/yaboot.conf $(TMP)/boot/yaboot.conf 41 mkisofs -hfs -part -map arch/$(BARCH)/yaboot/maps -no-desktop -hfs-volid "HelenOS" -hfs-bless $(TMP)/boot -r -o $@ $(TMP)/ 37 BITS = 32 38 ENDIANESS = BE 39 PAGE_SIZE = 4096 40 EXTRA_CFLAGS = -mcpu=powerpc -msoft-float -m32 42 41 43 arch/$(BARCH)/loader/image.boot: 44 $( MAKE) -C arch/$(BARCH)/loader PRECHECK=$(PRECHECK)42 RD_SRVS_ESSENTIAL += \ 43 $(USPACE_PATH)/srv/hw/bus/cuda_adb/cuda_adb 45 44 46 clean: generic_clean 47 $(MAKE) -C arch/$(BARCH)/loader clean 48 rm -fr $(TMP) 49 rm -f $(BASE)/image.iso 45 RD_SRVS_NON_ESSENTIAL += \ 46 $(USPACE_PATH)/srv/hid/adb_mouse/adb_ms 47 48 SOURCES = \ 49 arch/$(BARCH)/src/asm.S \ 50 arch/$(BARCH)/src/main.c \ 51 arch/$(BARCH)/src/ofw.c \ 52 $(COMPS_C) \ 53 genarch/src/ofw.c \ 54 genarch/src/ofw_tree.c \ 55 genarch/src/division.c \ 56 genarch/src/multiplication.c \ 57 generic/src/balloc.c \ 58 generic/src/memstr.c \ 59 generic/src/printf_core.c \ 60 generic/src/vprintf.c \ 61 generic/src/printf.c \ 62 generic/src/str.c \ 63 generic/src/version.c \ 64 generic/src/inflate.c -
boot/arch/ppc32/_link.ld.in
rfb150d78 r46c20c8 1 OUTPUT_FORMAT("elf32-powerpc")2 OUTPUT_ARCH(powerpc:common)3 1 ENTRY(start) 4 2 5 3 SECTIONS { 6 .boot 0x01000000: AT (0) { 4 . = 0x01000000; 5 .text : { 7 6 *(BOOTSTRAP); 8 7 *(REALMODE); 9 8 *(.text); 10 9 } 10 .data : { 11 *(.data); /* initialized data */ 11 12 *(.rodata); 12 13 *(.rodata.*); 13 *(.data); /* initialized data */14 14 *(.sdata); 15 *(. sdata2);15 *(.reginfo); 16 16 *(.sbss); 17 *(.scommon); 17 18 *(.bss); /* uninitialized static variables */ 18 19 *(COMMON); /* global variables */ … … 21 22 22 23 /DISCARD/ : { 24 *(.gnu.*); 25 *(.mdebug*); 26 *(.pdr); 23 27 *(.comment); 24 *(.note *);28 *(.note.*); 25 29 } 26 30 } -
boot/arch/ppc32/include/arch.h
rfb150d78 r46c20c8 27 27 */ 28 28 29 #ifndef BOOT_ ia64_TYPES_H_30 #define BOOT_ ia64_TYPES_H_29 #ifndef BOOT_ppc32_ARCH_H_ 30 #define BOOT_ppc32_ARCH_H_ 31 31 32 #include <gentypes.h> 32 #define PAGE_WIDTH 12 33 #define PAGE_SIZE (1 << PAGE_WIDTH) 33 34 34 typedef signed char int8_t; 35 #define BOOT_OFFSET 0x8000 35 36 36 typedef unsigned char uint8_t; 37 typedef unsigned short uint16_t; 38 typedef unsigned int uint32_t; 39 typedef unsigned long uint64_t; 37 #define LOADER_ADDRESS 0x01000000 40 38 41 typedef uint64_t uintptr_t; 42 typedef uint64_t unative_t; 39 #ifndef __ASM__ 40 #define PA2KA(addr) (((uintptr_t) (addr)) + 0x80000000) 41 #else 42 #define PA2KA(addr) ((addr) + 0x80000000) 43 #endif 43 44 44 45 #endif -
boot/arch/ppc32/include/asm.h
rfb150d78 r46c20c8 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 29 #include "msim.h"30 #include <printf.h>31 28 32 #define MSIM_VIDEORAM 0xB0000000 29 #ifndef BOOT_ppc32_ASM_H_ 30 #define BOOT_ppc32_ASM_H_ 33 31 34 void write(const char *str, const int len) 35 { 36 int i; 37 38 for (i = 0; i < len; i++) 39 *((char *) MSIM_VIDEORAM) = str[i]; 40 } 32 #include <typedefs.h> 33 #include <arch/main.h> 34 35 extern void jump_to_kernel(void *, void *, size_t, void *) 36 __attribute__((noreturn)); 37 extern void real_mode(); 38 39 #endif -
boot/arch/ppc32/include/regname.h
rfb150d78 r46c20c8 27 27 */ 28 28 29 #ifndef __ppc32_REGNAME_H__30 #define __ppc32_REGNAME_H__29 #ifndef BOOT_ppc32_REGNAME_H_ 30 #define BOOT_ppc32_REGNAME_H_ 31 31 32 32 /* Condition Register Bit Fields */ -
boot/arch/ppc32/include/types.h
rfb150d78 r46c20c8 30 30 #define BOOT_ppc32_TYPES_H_ 31 31 32 #include <gentypes.h> 32 #define TASKMAP_MAX_RECORDS 32 33 #define BOOTINFO_TASK_NAME_BUFLEN 32 33 34 34 typedef signed char int8_t; 35 36 typedef unsigned char uint8_t; 37 typedef unsigned short uint16_t; 38 typedef unsigned int uint32_t; 39 typedef unsigned long long uint64_t; 40 35 typedef uint32_t size_t; 41 36 typedef uint32_t uintptr_t; 42 37 typedef uint32_t unative_t; 38 typedef int32_t native_t; 39 40 typedef struct { 41 void *addr; 42 size_t size; 43 char name[BOOTINFO_TASK_NAME_BUFLEN]; 44 } task_t; 45 46 typedef struct { 47 size_t cnt; 48 task_t tasks[TASKMAP_MAX_RECORDS]; 49 } taskmap_t; 43 50 44 51 #endif -
boot/arch/ppc32/src/asm.S
rfb150d78 r46c20c8 27 27 # 28 28 29 #include "asm.h" 30 #include "regname.h" 31 #include "ofwarch.h" 29 #include <arch/arch.h> 30 #include <arch/regname.h> 32 31 33 32 .macro SMC_COHERENCY addr … … 59 58 .endm 60 59 60 .global start 61 .global halt 62 .global jump_to_kernel 63 .global real_mode 64 65 .section BOOTSTRAP, "ax" 66 67 start: 68 lis r4, ofw_cif@ha 69 addi r4, r4, ofw_cif@l 70 stw r5, 0(r4) 71 72 bl ofw_init 73 b bootstrap 74 61 75 .text 62 63 .global halt64 .global memcpy65 .global jump_to_kernel66 .global balloc_base67 76 68 77 halt: 69 78 b halt 70 79 71 memcpy:72 srwi. r7, r5, 373 addi r6, r3, -474 addi r4, r4, -475 beq 2f76 77 andi. r0, r6, 378 mtctr r779 bne 5f80 81 1:82 lwz r7, 4(r4)83 lwzu r8, 8(r4)84 stw r7, 4(r6)85 stwu r8, 8(r6)86 bdnz 1b87 88 andi. r5, r5, 789 90 2:91 cmplwi 0, r5, 492 blt 3f93 94 lwzu r0, 4(r4)95 addi r5, r5, -496 stwu r0, 4(r6)97 98 3:99 cmpwi 0, r5, 0100 beqlr101 mtctr r5102 addi r4, r4, 3103 addi r6, r6, 3104 105 4:106 lbzu r0, 1(r4)107 stbu r0, 1(r6)108 bdnz 4b109 blr110 111 5:112 subfic r0, r0, 4113 mtctr r0114 115 6:116 lbz r7, 4(r4)117 addi r4, r4, 1118 stb r7, 4(r6)119 addi r6, r6, 1120 bdnz 6b121 subf r5, r0, r5122 rlwinm. r7, r5, 32-3, 3, 31123 beq 2b124 mtctr r7125 b 1b126 127 80 jump_to_kernel: 128 81 129 # r3 = bootinfo (pa)130 # r 4 = bootinfo_size131 # r 5 = trans (pa)132 # r 6 = bytes to copy133 # r 7 = real_mode (pa)82 # arguments: 83 # r3 = bootinfo (physical address) 84 # r4 = translate table (physical address) 85 # r5 = pages to translate 86 # r6 = real mode meeting point (physical address) 134 87 135 88 # disable interrupts … … 139 92 mtmsr r31 140 93 141 # set real _mode meeting pointaddress142 143 mtspr srr0, r 7144 145 # jump sto real_mode94 # set real mode meeting point physical address 95 96 mtspr srr0, r6 97 98 # jump to real_mode 146 99 147 100 mfmsr r31 … … 155 108 rfi 156 109 110 .section REALMODE, "ax" 111 157 112 .align PAGE_WIDTH 158 balloc_base:159 .fill BALLOC_MAX_SIZE160 161 .section REALMODE, "ax"162 163 .align PAGE_WIDTH164 .global real_mode165 113 real_mode: 166 114 167 # copy kernel to proper location 168 # 169 # r3 = bootinfo (pa) 170 # r4 = bootinfo_size 171 # r5 = trans (pa) 172 # r6 = bytes to copy 115 # arguments: 116 # r3 = bootinfo (physical address) 117 # r4 = translate table (physical address) 118 # r5 = pages to translate 119 120 # move the images of components to the proper 121 # location using the translate table 173 122 174 123 li r31, PAGE_SIZE >> 2 … … 177 126 page_copy: 178 127 179 cmpwi r 6, 0128 cmpwi r5, 0 180 129 beq copy_end 181 130 182 # copy page183 184 131 mtctr r31 185 lwz r29, 0(r 5)132 lwz r29, 0(r4) 186 133 187 134 copy_loop: … … 194 141 addi r29, r29, 4 195 142 addi r30, r30, 4 196 subi r6, r6, 4197 198 cmpwi r6, 0199 beq copy_end200 143 201 144 bdnz copy_loop 202 203 addi r5, r5, 4 145 146 addi r4, r4, 4 147 subi r5, r5, 1 204 148 b page_copy 205 149 … … 266 210 # on top of memory, size 64 KB 267 211 268 lwz r31, 0(r3) # r31 = memory size212 lwz r31, 4(r3) # r31 = memory size 269 213 270 214 lis r30, 65536@h … … 303 247 # create BAT identity mapping 304 248 305 lwz r31, 0(r3) # r31 = memory size249 lwz r31, 4(r3) # r31 = memory size 306 250 307 251 lis r29, 0x0002 … … 354 298 # 355 299 # pc = PA2KA(BOOT_OFFSET) 356 # r3 = bootinfo (p a)300 # r3 = bootinfo (physical address) 357 301 # sprg0 = BOOT_OFFSET 358 302 # sprg3 = physical memory size 359 # sp = 0 ( pa)303 # sp = 0 (enforces the usage of sprg0 as exception stack) 360 304 361 305 lis r31, PA2KA(BOOT_OFFSET)@ha … … 367 311 mtsprg0 r31 368 312 369 lwz r31, 0(r3) 313 # bootinfo starts with a 64 bit integer containing 314 # the physical memory size, get the lower 4 bytes 315 316 lwz r31, 4(r3) 370 317 mtsprg3 r31 371 318 … … 379 326 isync 380 327 rfi 381 382 .align PAGE_WIDTH383 .global trans384 trans:385 .rept TRANS_SIZE386 .int 0387 .endr -
boot/arch/ppc32/src/ofw.c
rfb150d78 r46c20c8 27 27 */ 28 28 29 #include <ofwarch.h> 30 #include <ofw.h> 31 #include <printf.h> 29 #include <genarch/ofw.h> 30 #include <typedefs.h> 31 #include <putchar.h> 32 #include <str.h> 32 33 33 34 typedef int (*ofw_entry_t)(ofw_args_t *args); 34 35 35 int ofw(ofw_args_t *args)36 ofw_arg_t ofw(ofw_args_t *args) 36 37 { 37 38 return ((ofw_entry_t) ofw_cif)(args); 38 39 } 39 40 40 void write(const char *str, const int len)41 void putchar(const wchar_t ch) 41 42 { 42 int i; 43 if (ch == '\n') 44 ofw_putchar('\r'); 43 45 44 for (i = 0; i < len; i++) { 45 if (str[i] == '\n') 46 ofw_write("\r", 1); 47 ofw_write(&str[i], 1); 48 } 46 if (ascii_check(ch)) 47 ofw_putchar(ch); 48 else 49 ofw_putchar(U_SPECIAL); 49 50 } 50 51 int ofw_translate_failed(ofw_arg_t flag)52 {53 /* PearPC returns buggy flag */54 return 0;55 } -
boot/arch/sparc64/Makefile.inc
rfb150d78 r46c20c8 27 27 # 28 28 29 include Makefile.common 29 BOOT_OUTPUT = image.boot 30 POST_OUTPUT = $(ROOT_PATH)/image.iso 31 POSTBUILD = Makefile.silo 30 32 31 ifeq ($(CONFIG_AOUT_ISOFS_B),y) 32 SILO_PACKAGE = silo.tar.gz 33 else 34 SILO_PACKAGE = silo.patched.tar.gz 35 endif 33 BFD_NAME = elf64-sparc 34 BFD_OUTPUT = $(BFD_NAME) 35 BFD_ARCH = sparc 36 36 37 build: $(BASE)/image.iso 37 BITS = 64 38 ENDIANESS = BE 39 PAGE_SIZE = 16384 40 EXTRA_CFLAGS = -mcpu=ultrasparc -m64 -mno-fpu -mcmodel=medlow 38 41 39 $(BASE)/image.iso: arch/$(BARCH)/loader/image.boot 40 mkdir -p $(TMP)/boot 41 mkdir -p $(TMP)/HelenOS 42 cat arch/$(BARCH)/silo/$(SILO_PACKAGE) | (cd $(TMP)/boot; tar xvfz -) 43 cp arch/$(BARCH)/silo/README arch/$(BARCH)/silo/COPYING $(TMP)/boot 44 ifeq ($(CONFIG_RD_EXTERNAL),y) 45 cp arch/$(BARCH)/silo/silo.conf $(TMP)/boot/silo.conf 46 else 47 cat arch/$(BARCH)/silo/silo.conf | grep -v initrd > $(TMP)/boot/silo.conf 48 endif 49 cp arch/$(BARCH)/loader/image.boot $(TMP)/HelenOS/image.boot 50 gzip -f $(TMP)/HelenOS/image.boot 51 ifeq ($(CONFIG_RD_EXTERNAL),y) 52 cp arch/$(BARCH)/loader/initrd.img $(TMP)/HelenOS/initrd.img 53 endif 54 mkisofs -f -G $(TMP)/boot/isofs.b -B ... -r -o $@ $(TMP)/ 42 RD_SRVS_NON_ESSENTIAL += 55 43 56 arch/$(BARCH)/loader/image.boot: 57 $(MAKE) -C arch/$(BARCH)/loader PRECHECK=$(PRECHECK) 44 RD_SRVS_ESSENTIAL += \ 45 $(USPACE_PATH)/srv/hw/cir/fhc/fhc \ 46 $(USPACE_PATH)/srv/hw/cir/obio/obio 58 47 59 clean: generic_clean 60 $(MAKE) -C arch/$(BARCH)/loader clean 61 rm -fr $(TMP) 62 rm -f $(BASE)/image.iso 48 SOURCES = \ 49 arch/$(BARCH)/src/asm.S \ 50 arch/$(BARCH)/src/main.c \ 51 arch/$(BARCH)/src/ofw.c \ 52 $(COMPS_C) \ 53 genarch/src/ofw.c \ 54 genarch/src/ofw_tree.c \ 55 generic/src/balloc.c \ 56 generic/src/memstr.c \ 57 generic/src/printf_core.c \ 58 generic/src/vprintf.c \ 59 generic/src/printf.c \ 60 generic/src/str.c \ 61 generic/src/version.c \ 62 generic/src/inflate.c -
boot/arch/sparc64/_link.ld.in
rfb150d78 r46c20c8 2 2 3 3 SECTIONS { 4 .boot 0xbfc00000: AT (0) { 4 . = 0x4000; 5 .boot : { 5 6 *(BOOTSTRAP); 6 7 *(.text); 7 8 9 *(.data); /* initialized data */ 8 10 *(.rodata); 9 11 *(.rodata.*); 10 *(.data); /* initialized data */11 12 *(.sdata); 12 *(. sdata2);13 *(.reginfo); 13 14 *(.sbss); 14 *(.scommon);15 15 *(.bss); /* uninitialized static variables */ 16 16 *(COMMON); /* global variables */ 17 *(.reginfo);18 17 [[COMPONENTS]] 19 18 } 19 20 /DISCARD/ : { 21 *(.gnu.*); 22 *(.mdebug*); 23 *(.pdr); 24 *(.comment); 25 *(.note.*); 26 } 20 27 } -
boot/arch/sparc64/include/asm.h
rfb150d78 r46c20c8 1 1 /* 2 * Copyright (c) 2006 Martin Decky 2 3 * Copyright (c) 2006 Jakub Jermar 3 4 * All rights reserved. … … 27 28 */ 28 29 29 #ifndef BOOT_sparc64_ REGISTER_H_30 #define BOOT_sparc64_ REGISTER_H_30 #ifndef BOOT_sparc64_ASM_H_ 31 #define BOOT_sparc64_ASM_H_ 31 32 32 #define PSTATE_IE_BIT 2 33 #define PSTATE_PRIV_BIT 4 34 #define PSTATE_AM_BIT 8 33 #include <typedefs.h> 35 34 36 #define ASI_ICBUS_CONFIG 0x4a 37 #define ICBUS_CONFIG_MID_SHIFT 17 35 extern void jump_to_kernel(uintptr_t physmem_start, bootinfo_t *bootinfo, 36 uint8_t subarch, void *entry) __attribute__((noreturn)); 38 37 39 38 #endif -
boot/arch/sparc64/include/ofw.h
rfb150d78 r46c20c8 27 27 */ 28 28 29 #ifndef BOOT_sparc64_OFW ARCH_H_30 #define BOOT_sparc64_OFW ARCH_H_29 #ifndef BOOT_sparc64_OFW_H_ 30 #define BOOT_sparc64_OFW_H_ 31 31 32 #include "main.h" 33 #include "types.h" 32 #include <typedefs.h> 34 33 35 34 #define OFW_ADDRESS_CELLS 2 36 35 #define OFW_SIZE_CELLS 2 37 36 38 extern int ofw_cpu(uint16_t mid_mask, uintptr_t physmem_start);39 extern int ofw_get_physmem_start(uintptr_t *start);37 extern uintptr_t ofw_get_physmem_start(void); 38 extern void ofw_cpu(uint16_t, uintptr_t); 40 39 41 40 #endif -
boot/arch/sparc64/include/types.h
rfb150d78 r46c20c8 30 30 #define BOOT_sparc64_TYPES_H_ 31 31 32 #include <gentypes.h> 32 #define TASKMAP_MAX_RECORDS 32 33 #define BOOTINFO_TASK_NAME_BUFLEN 32 33 34 34 typedef signed char int8_t; 35 36 typedef unsigned char uint8_t; 37 typedef unsigned short uint16_t; 38 typedef unsigned int uint32_t; 39 typedef unsigned long uint64_t; 40 35 typedef uint64_t size_t; 41 36 typedef uint64_t uintptr_t; 42 37 typedef uint64_t unative_t; 38 typedef int64_t native_t; 39 40 typedef struct { 41 void *addr; 42 size_t size; 43 char name[BOOTINFO_TASK_NAME_BUFLEN]; 44 } task_t; 45 46 typedef struct { 47 size_t cnt; 48 task_t tasks[TASKMAP_MAX_RECORDS]; 49 } taskmap_t; 43 50 44 51 #endif -
boot/arch/sparc64/src/asm.S
rfb150d78 r46c20c8 1 1 # 2 2 # Copyright (c) 2006 Martin Decky 3 # Copyright (c) 2006 Jakub Jermar 3 # Copyright (c) 2006 Jakub Jermar 4 4 # All rights reserved. 5 5 # … … 28 28 # 29 29 30 #include <stack.h> 31 #include <register.h> 30 #include <arch/arch.h> 31 32 #define ICACHE_SIZE 8192 33 #define ICACHE_LINE_SIZE 32 34 #define ICACHE_SET_BIT (1 << 13) 35 #define ASI_ICACHE_TAG 0x67 32 36 33 37 .register %g2, #scratch 34 38 .register %g3, #scratch 39 .register %g6, #scratch 40 .register %g7, #scratch 41 42 .global start 43 .global halt 44 .global jump_to_kernel 45 46 .section BOOTSTRAP, "ax" 47 48 start: 49 ba %xcc, 1f 50 nop 51 52 /* 53 * This header forces SILO to load the image at 0x4000. 54 * More precisely, SILO will think this is an old version of Linux. 55 */ 56 .ascii "HdrS" 57 .word 0 58 .half 0 59 .half 0 60 .half 0 61 .half 0 62 .word 0 63 .word 0 64 65 .align 8 66 1: 67 ! Disable interrupts and disable address masking. 68 69 wrpr %g0, PSTATE_PRIV_BIT, %pstate 70 71 wrpr %g0, NWINDOWS - 2, %cansave ! Set maximum saveable windows 72 wrpr %g0, 0, %canrestore ! Get rid of windows we will never need again 73 wrpr %g0, 0, %otherwin ! Make sure the window state is consistent 74 wrpr %g0, NWINDOWS - 1, %cleanwin ! Prevent needless clean_window traps for kernel 75 76 set initial_stack, %sp 77 add %sp, -STACK_BIAS, %sp 78 79 set ofw_cif, %l0 80 81 ! Initialize OpenFirmware 82 83 call ofw_init 84 stx %o4, [%l0] 85 86 ba %xcc, bootstrap 87 nop 88 89 .align STACK_ALIGNMENT 90 .space STACK_SIZE 91 initial_stack: 92 .space STACK_WINDOW_SAVE_AREA_SIZE 35 93 36 94 .text 37 38 .global halt39 .global memcpy40 .global jump_to_kernel41 95 42 96 halt: … … 44 98 nop 45 99 46 memcpy:47 mov %o0, %o3 ! save dst48 add %o1, 7, %g149 and %g1, -8, %g150 cmp %o1, %g151 be,pn %xcc, 3f52 add %o0, 7, %g153 mov 0, %g354 55 0:56 brz,pn %o2, 2f57 mov 0, %g258 59 1:60 ldub [%g3 + %o1], %g161 add %g2, 1, %g262 cmp %o2, %g263 stb %g1, [%g3 + %o0]64 bne,pt %xcc, 1b65 mov %g2, %g366 67 2:68 jmp %o7 + 8 ! exit point69 mov %o3, %o070 71 3:72 and %g1, -8, %g173 cmp %o0, %g174 bne,pt %xcc, 0b75 mov 0, %g376 srlx %o2, 3, %g477 brz,pn %g4, 5f78 mov 0, %g579 80 4:81 sllx %g3, 3, %g282 add %g5, 1, %g383 ldx [%o1 + %g2], %g184 mov %g3, %g585 cmp %g4, %g386 bne,pt %xcc, 4b87 stx %g1, [%o0 + %g2]88 89 5:90 and %o2, 7, %o291 brz,pn %o2, 2b92 sllx %g4, 3, %g193 mov 0, %g294 add %g1, %o0, %o095 add %g1, %o1, %g496 mov 0, %g397 98 6:99 ldub [%g2 + %g4], %g1100 stb %g1, [%g2 + %o0]101 add %g3, 1, %g2102 cmp %o2, %g2103 bne,pt %xcc, 6b104 mov %g2, %g3105 106 jmp %o7 + 8 ! exit point107 mov %o3, %o0108 109 100 jump_to_kernel: 110 101 /* 111 * We have copied code and now we need to guarantee cache coherence.102 * Guarantee cache coherence: 112 103 * 1. Make sure that the code we have moved has drained to main memory. 113 104 * 2. Invalidate I-cache. … … 118 109 * US3 processors have a write-invalidate cache, so explicitly 119 110 * invalidating it is not required. Whether to invalidate I-cache 120 * or not is decided according to the value of the 5thargument121 * (subarch itecture).111 * or not is decided according to the value of the 3rd argument 112 * (subarch). 122 113 */ 123 cmp % i4,3114 cmp %o2, SUBARCH_US3 124 115 be %xcc, 1f 125 116 nop … … 137 128 flush %i7 138 129 139 mov %o0, %l1 140 mov %o1, %o0 141 mov %o2, %o1 142 mov %o3, %o2 143 jmp %l1 ! jump to kernel 130 ! Jump to kernel 131 jmp %o3 144 132 nop 145 146 #define ICACHE_SIZE 8192147 #define ICACHE_LINE_SIZE 32148 #define ICACHE_SET_BIT (1 << 13)149 #define ASI_ICACHE_TAG 0x67150 133 151 134 # Flush I-cache … … 162 145 membar #Sync 163 146 retl 147 164 148 ! SF Erratum #51 149 165 150 nop 166 151 … … 171 156 ldx [%l0], %l0 172 157 173 rdpr %pstate, %l1174 and %l1, ~PSTATE_AM_BIT, %l2175 wrpr %l2, 0, %pstate158 rdpr %pstate, %l1 159 and %l1, ~PSTATE_AM_BIT, %l2 160 wrpr %l2, 0, %pstate 176 161 177 162 jmpl %l0, %o7 -
boot/arch/sparc64/src/ofw.c
rfb150d78 r46c20c8 33 33 */ 34 34 35 #include <ofwarch.h> 36 #include <ofw.h> 35 #include <arch/arch.h> 36 #include <arch/ofw.h> 37 #include <genarch/ofw.h> 38 #include <typedefs.h> 37 39 #include <printf.h> 38 #include <string.h> 39 #include <register.h> 40 #include "main.h" 41 #include "asm.h" 40 #include <halt.h> 41 #include <putchar.h> 42 #include <str.h> 42 43 43 void write(const char *str, const int len)44 void putchar(const wchar_t ch) 44 45 { 45 int i; 46 if (ch == '\n') 47 ofw_putchar('\r'); 46 48 47 for (i = 0; i < len; i++) { 48 if (str[i] == '\n') 49 ofw_write("\r", 1); 50 ofw_write(&str[i], 1); 51 } 49 if (ascii_check(ch)) 50 ofw_putchar(ch); 51 else 52 ofw_putchar(U_SPECIAL); 52 53 } 53 54 54 int ofw_translate_failed(ofw_arg_t flag) 55 { 56 return flag != -1; 57 } 58 59 /** 60 * Starts all CPUs represented by following siblings of the given node, 61 * except for the current CPU. 55 /** Start all CPUs represented by following siblings of the given node. 56 * 57 * Except for the current CPU. 62 58 * 63 59 * @param child The first child of the OFW tree node whose children … … 71 67 * 72 68 */ 73 static int wake_cpus_in_node(phandle child, uint64_t current_mid,69 static size_t wake_cpus_in_node(phandle child, uint64_t current_mid, 74 70 uintptr_t physmem_start) 75 71 { 76 int cpus;72 size_t cpus; 77 73 78 for (cpus = 0; (child != 0) && (child != -1);74 for (cpus = 0; (child != 0) && (child != (phandle) -1); 79 75 child = ofw_get_peer_node(child), cpus++) { 80 76 char type_name[OFW_TREE_PROPERTY_MAX_VALUELEN]; … … 83 79 OFW_TREE_PROPERTY_MAX_VALUELEN) > 0) { 84 80 type_name[OFW_TREE_PROPERTY_MAX_VALUELEN - 1] = 0; 85 if (strcmp(type_name, "cpu") == 0) { 81 82 if (str_cmp(type_name, "cpu") == 0) { 86 83 uint32_t mid; 87 84 … … 100 97 */ 101 98 (void) ofw_call("SUNW,start-cpu", 3, 1, 102 NULL, child, KERNEL_ VIRTUAL_ADDRESS,99 NULL, child, KERNEL_ADDRESS, 103 100 physmem_start | AP_PROCESSOR); 104 101 } … … 110 107 } 111 108 112 /** 113 * Finds out the current CPU's MID and wakes up all AP processors.109 /** Find out the current CPU's MID and wake up all AP processors. 110 * 114 111 */ 115 intofw_cpu(uint16_t mid_mask, uintptr_t physmem_start)112 void ofw_cpu(uint16_t mid_mask, uintptr_t physmem_start) 116 113 { 117 114 /* Get the current CPU MID */ … … 119 116 120 117 asm volatile ( 121 "ldxa [%1] %2, %0\n" 122 : "=r" (current_mid) 123 : "r" (0), "i" (ASI_ICBUS_CONFIG) 118 "ldxa [%[zero]] %[asi], %[current_mid]\n" 119 : [current_mid] "=r" (current_mid) 120 : [zero] "r" (0), 121 [asi] "i" (ASI_ICBUS_CONFIG) 124 122 ); 125 123 … … 130 128 131 129 phandle cpus_parent = ofw_find_device("/ssm@0,0"); 132 if ((cpus_parent == 0) || (cpus_parent == -1))130 if ((cpus_parent == 0) || (cpus_parent == (phandle) -1)) 133 131 cpus_parent = ofw_find_device("/"); 134 132 135 133 phandle node = ofw_get_child_node(cpus_parent); 136 int cpus = wake_cpus_in_node(node, current_mid, physmem_start); 137 while ((node != 0) && (node != -1)) { 134 size_t cpus = wake_cpus_in_node(node, current_mid, physmem_start); 135 136 while ((node != 0) && (node != (phandle) -1)) { 138 137 char name[OFW_TREE_PROPERTY_MAX_VALUELEN]; 139 138 … … 141 140 OFW_TREE_PROPERTY_MAX_VALUELEN) > 0) { 142 141 name[OFW_TREE_PROPERTY_MAX_VALUELEN - 1] = 0; 143 if (strcmp(name, "cmp") == 0) { 142 143 if (str_cmp(name, "cmp") == 0) { 144 144 phandle subnode = ofw_get_child_node(node); 145 145 cpus += wake_cpus_in_node(subnode, 146 current_mid, physmem_start);146 current_mid, physmem_start); 147 147 } 148 148 } 149 149 150 node = ofw_get_peer_node(node); 150 151 } 151 152 152 return cpus; 153 if (cpus == 0) 154 printf("Warning: Unable to get CPU properties.\n"); 153 155 } 154 156 155 157 /** Get physical memory starting address. 156 158 * 157 * @param start Pointer to variable where the physical memory starting 158 * address will be stored. 159 * 160 * @return Non-zero on succes, zero on failure. 159 * @return Physical memory starting address. 161 160 * 162 161 */ 163 int ofw_get_physmem_start(uintptr_t *start)162 uintptr_t ofw_get_physmem_start(void) 164 163 { 165 164 uint32_t memreg[4]; 166 if (ofw_get_property(ofw_memory, "reg", &memreg, sizeof(memreg)) <= 0) 167 return 0; 165 if ((ofw_ret_t) ofw_get_property(ofw_memory, "reg", &memreg, 166 sizeof(memreg)) <= 0) { 167 printf("Error: Unable to get physical memory starting address, halting.\n"); 168 halt(); 169 } 168 170 169 *start = (((uint64_t) memreg[0]) << 32) | memreg[1]; 170 return 1; 171 return ((((uintptr_t) memreg[0]) << 32) | memreg[1]); 171 172 }
Note:
See TracChangeset
for help on using the changeset viewer.
