mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Fix some Sparc64 compile warnings
git-svn-id: svn://coreboot.org/openbios/openbios-devel@190 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -7,18 +7,14 @@
|
|||||||
#include "openbios/elfload.h"
|
#include "openbios/elfload.h"
|
||||||
#include "openbios/nvram.h"
|
#include "openbios/nvram.h"
|
||||||
#include "libc/diskio.h"
|
#include "libc/diskio.h"
|
||||||
|
#include "libc/vsprintf.h"
|
||||||
#include "sys_info.h"
|
#include "sys_info.h"
|
||||||
|
#include "boot.h"
|
||||||
|
|
||||||
int elf_load(struct sys_info *, const char *filename, const char *cmdline);
|
struct sys_info sys_info;
|
||||||
int aout_load(struct sys_info *, const char *filename, const char *cmdline);
|
|
||||||
int linux_load(struct sys_info *, const char *filename, const char *cmdline);
|
|
||||||
|
|
||||||
void boot(void);
|
|
||||||
|
|
||||||
struct sys_info sys_info;
|
|
||||||
uint64_t kernel_image;
|
uint64_t kernel_image;
|
||||||
uint64_t kernel_size;
|
uint64_t kernel_size;
|
||||||
uint64_t cmdline;
|
uint64_t qemu_cmdline;
|
||||||
uint64_t cmdline_size;
|
uint64_t cmdline_size;
|
||||||
char boot_device;
|
char boot_device;
|
||||||
|
|
||||||
@@ -60,11 +56,11 @@ void boot(void)
|
|||||||
*param = '\0';
|
*param = '\0';
|
||||||
param++;
|
param++;
|
||||||
} else if (cmdline_size) {
|
} else if (cmdline_size) {
|
||||||
param = (char *)cmdline;
|
param = (char *)qemu_cmdline;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("[sparc64] Booting file '%s' ", path);
|
printk("[sparc64] Booting file '%s' ", path);
|
||||||
if(param)
|
if (param)
|
||||||
printk("with parameters '%s'\n", param);
|
printk("with parameters '%s'\n", param);
|
||||||
else
|
else
|
||||||
printk("without parameters.\n");
|
printk("without parameters.\n");
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ int forth_load(struct sys_info *info, const char *filename, const char *cmdline)
|
|||||||
int elf_load(struct sys_info *info, const char *filename, const char *cmdline);
|
int elf_load(struct sys_info *info, const char *filename, const char *cmdline);
|
||||||
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
|
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
|
||||||
|
|
||||||
unsigned int start_elf(unsigned long entry_point, unsigned long param);
|
uint64_t start_elf(uint64_t entry_point, uint64_t param);
|
||||||
|
|
||||||
|
void boot(void);
|
||||||
|
|
||||||
extern uint64_t kernel_image;
|
extern uint64_t kernel_image;
|
||||||
extern uint64_t kernel_size;
|
extern uint64_t kernel_size;
|
||||||
extern uint64_t cmdline;
|
extern uint64_t qemu_cmdline;
|
||||||
extern uint64_t cmdline_size;
|
extern uint64_t cmdline_size;
|
||||||
extern char boot_device;
|
extern char boot_device;
|
||||||
extern struct sys_info sys_info;
|
extern struct sys_info sys_info;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<object source="forthload.c"/>
|
<object source="forthload.c"/>
|
||||||
<object source="loadfs.c"/>
|
<object source="loadfs.c"/>
|
||||||
</library>
|
</library>
|
||||||
|
|
||||||
<executable name="target/arch/sparc64/entry.o" target="target">
|
<executable name="target/arch/sparc64/entry.o" target="target">
|
||||||
<rule><![CDATA[ arch/sparc64/entry.S
|
<rule><![CDATA[ arch/sparc64/entry.S
|
||||||
$(CC) $$EXTRACFLAGS $(AS_FLAGS) $(CFLAGS) $(INCLUDES) -c -o $@ $^]]></rule>
|
$(CC) $$EXTRACFLAGS $(AS_FLAGS) $(CFLAGS) $(INCLUDES) -c -o $@ $^]]></rule>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
</executable>
|
</executable>
|
||||||
|
|
||||||
<!-- HACK ALERT -->
|
<!-- HACK ALERT -->
|
||||||
|
|
||||||
<executable name="target/include/static-dict.h" target="target" condition="IMAGE_ELF_EMBEDDED">
|
<executable name="target/include/static-dict.h" target="target" condition="IMAGE_ELF_EMBEDDED">
|
||||||
<rule><![CDATA[
|
<rule><![CDATA[
|
||||||
@echo "static const char forth_dictionary[] = {" > $@
|
@echo "static const char forth_dictionary[] = {" > $@
|
||||||
@@ -57,12 +57,12 @@
|
|||||||
@echo "};" >> $@]]></rule>
|
@echo "};" >> $@]]></rule>
|
||||||
<external-object source="openbios-sparc64.dict"/>
|
<external-object source="openbios-sparc64.dict"/>
|
||||||
</executable>
|
</executable>
|
||||||
|
|
||||||
<executable name="target/arch/sparc64/builtin.o" target="target" condition="IMAGE_ELF_EMBEDDED">
|
<executable name="target/arch/sparc64/builtin.o" target="target" condition="IMAGE_ELF_EMBEDDED">
|
||||||
<rule><![CDATA[ arch/sparc64/builtin.c
|
<rule><![CDATA[ arch/sparc64/builtin.c
|
||||||
$(CC) $$EXTRACFLAGS $(CFLAGS) $(INCLUDES) -c -o $@ $^]]></rule>
|
$(CC) $$EXTRACFLAGS $(CFLAGS) $(INCLUDES) -c -o $@ $^]]></rule>
|
||||||
</executable>
|
</executable>
|
||||||
|
|
||||||
<!-- END OF HACK ALERT -->
|
<!-- END OF HACK ALERT -->
|
||||||
|
|
||||||
<executable name="openbios-builtin.elf" target="target" condition="IMAGE_ELF_EMBEDDED">
|
<executable name="openbios-builtin.elf" target="target" condition="IMAGE_ELF_EMBEDDED">
|
||||||
@@ -83,5 +83,5 @@
|
|||||||
<external-object source="libfs.a"/>
|
<external-object source="libfs.a"/>
|
||||||
<external-object source="libgcc.a"/>
|
<external-object source="libgcc.a"/>
|
||||||
</executable>
|
</executable>
|
||||||
|
|
||||||
</build>
|
</build>
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include "openbios/config.h"
|
#include "openbios/config.h"
|
||||||
#include "openbios/kernel.h"
|
#include "openbios/kernel.h"
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
|
#include "sys_info.h"
|
||||||
|
#include "boot.h"
|
||||||
|
|
||||||
#define MAIN_STACK_SIZE 16384
|
#define MAIN_STACK_SIZE 16384
|
||||||
#define IMAGE_STACK_SIZE 4096
|
#define IMAGE_STACK_SIZE 4096
|
||||||
@@ -16,11 +18,11 @@ static void start_main(void); /* forward decl. */
|
|||||||
void __exit_context(void); /* assembly routine */
|
void __exit_context(void); /* assembly routine */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main context structure
|
* Main context structure
|
||||||
* It is placed at the bottom of our stack, and loaded by assembly routine
|
* It is placed at the bottom of our stack, and loaded by assembly routine
|
||||||
* to start us up.
|
* to start us up.
|
||||||
*/
|
*/
|
||||||
const struct context main_ctx = {
|
struct context main_ctx = {
|
||||||
.regs[REG_SP] = (uint64_t) &_estack - 2047 - 96,
|
.regs[REG_SP] = (uint64_t) &_estack - 2047 - 96,
|
||||||
.pc = (uint64_t) start_main,
|
.pc = (uint64_t) start_main,
|
||||||
.npc = (uint64_t) start_main + 4,
|
.npc = (uint64_t) start_main + 4,
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
#include "sys_info.h"
|
#include "sys_info.h"
|
||||||
#include "ipchecksum.h"
|
#include "ipchecksum.h"
|
||||||
#include "loadfs.h"
|
#include "loadfs.h"
|
||||||
|
#include "boot.h"
|
||||||
#define printf printk
|
#define printf printk
|
||||||
#define debug printk
|
#define debug printk
|
||||||
|
|
||||||
extern unsigned int start_elf(unsigned long entry_point, unsigned long param);
|
|
||||||
#define addr_fixup(addr) ((addr) & 0x00ffffff)
|
#define addr_fixup(addr) ((addr) & 0x00ffffff)
|
||||||
|
|
||||||
static char *image_name, *image_version;
|
static char *image_name, *image_version;
|
||||||
@@ -92,7 +92,7 @@ static unsigned long process_image_notes(Elf_phdr *phdr, int phnum,
|
|||||||
continue;
|
continue;
|
||||||
buf = malloc(phdr[i].p_filesz);
|
buf = malloc(phdr[i].p_filesz);
|
||||||
file_seek(offset + phdr[i].p_offset);
|
file_seek(offset + phdr[i].p_offset);
|
||||||
if (lfile_read(buf, phdr[i].p_filesz) != phdr[i].p_filesz) {
|
if ((uint64_t)lfile_read(buf, phdr[i].p_filesz) != phdr[i].p_filesz) {
|
||||||
printf("Can't read note segment\n");
|
printf("Can't read note segment\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -150,14 +150,14 @@ static int load_segments(Elf_phdr *phdr, int phnum,
|
|||||||
i, addr_fixup(phdr[i].p_paddr), phdr[i].p_filesz, phdr[i].p_memsz);
|
i, addr_fixup(phdr[i].p_paddr), phdr[i].p_filesz, phdr[i].p_memsz);
|
||||||
file_seek(offset + phdr[i].p_offset);
|
file_seek(offset + phdr[i].p_offset);
|
||||||
debug("loading... ");
|
debug("loading... ");
|
||||||
if (lfile_read(phys_to_virt(addr_fixup(phdr[i].p_paddr)), phdr[i].p_filesz)
|
if ((uint64_t)lfile_read(phys_to_virt(addr_fixup(phdr[i].p_paddr)), phdr[i].p_filesz)
|
||||||
!= phdr[i].p_filesz) {
|
!= phdr[i].p_filesz) {
|
||||||
printf("Can't read program segment %d\n", i);
|
printf("Can't read program segment %d\n", i);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
bytes += phdr[i].p_filesz;
|
bytes += phdr[i].p_filesz;
|
||||||
debug("clearing... ");
|
debug("clearing... ");
|
||||||
memset(phys_to_virt(addr_fixup(phdr[i].p_paddr) + phdr[i].p_filesz), 0,
|
memset(phys_to_virt(addr_fixup(phdr[i].p_paddr) + phdr[i].p_filesz), 0,
|
||||||
phdr[i].p_memsz - phdr[i].p_filesz);
|
phdr[i].p_memsz - phdr[i].p_filesz);
|
||||||
if (phdr[i].p_offset <= checksum_offset
|
if (phdr[i].p_offset <= checksum_offset
|
||||||
&& phdr[i].p_offset + phdr[i].p_filesz >= checksum_offset+2) {
|
&& phdr[i].p_offset + phdr[i].p_filesz >= checksum_offset+2) {
|
||||||
@@ -320,7 +320,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
for (offset = 0; offset < 16 * 512; offset += 512) {
|
for (offset = 0; offset < 16 * 512; offset += 512) {
|
||||||
if (lfile_read(&ehdr, sizeof ehdr) != sizeof ehdr) {
|
if ((size_t)lfile_read(&ehdr, sizeof ehdr) != sizeof ehdr) {
|
||||||
debug("Can't read ELF header\n");
|
debug("Can't read ELF header\n");
|
||||||
retval = LOADER_NOT_SUPPORT;
|
retval = LOADER_NOT_SUPPORT;
|
||||||
goto out;
|
goto out;
|
||||||
@@ -351,7 +351,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline)
|
|||||||
phdr_size = ehdr.e_phnum * sizeof *phdr;
|
phdr_size = ehdr.e_phnum * sizeof *phdr;
|
||||||
phdr = malloc(phdr_size);
|
phdr = malloc(phdr_size);
|
||||||
file_seek(offset + ehdr.e_phoff);
|
file_seek(offset + ehdr.e_phoff);
|
||||||
if (lfile_read(phdr, phdr_size) != phdr_size) {
|
if ((unsigned long)lfile_read(phdr, phdr_size) != phdr_size) {
|
||||||
printf("Can't read program header\n");
|
printf("Can't read program header\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -368,7 +368,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline)
|
|||||||
|
|
||||||
if (!load_segments(phdr, ehdr.e_phnum, checksum_offset, offset))
|
if (!load_segments(phdr, ehdr.e_phnum, checksum_offset, offset))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (checksum_offset) {
|
if (checksum_offset) {
|
||||||
if (!verify_image(&ehdr, phdr, ehdr.e_phnum, checksum))
|
if (!verify_image(&ehdr, phdr, ehdr.e_phnum, checksum))
|
||||||
goto out;
|
goto out;
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ entry:
|
|||||||
lduba [%g1] ASI_PHYS_BYPASS_EC_E, %g3
|
lduba [%g1] ASI_PHYS_BYPASS_EC_E, %g3
|
||||||
or %g3, %g4, %g1
|
or %g3, %g4, %g1
|
||||||
! %g1 contains end of memory
|
! %g1 contains end of memory
|
||||||
|
|
||||||
|
|
||||||
setx _end, %g7, %g3
|
setx _end, %g7, %g3
|
||||||
set 0xffff, %g2
|
set 0xffff, %g2
|
||||||
add %g3, %g2, %g3
|
add %g3, %g2, %g3
|
||||||
@@ -280,7 +280,7 @@ lowmem:
|
|||||||
|
|
||||||
setx qemu_mem_size, %g7, %g1
|
setx qemu_mem_size, %g7, %g1
|
||||||
stx %g3, [%g1]
|
stx %g3, [%g1]
|
||||||
|
|
||||||
setx _data, %g7, %g1 ! Store va->pa conversion factor
|
setx _data, %g7, %g1 ! Store va->pa conversion factor
|
||||||
sub %g1, %l0, %g2
|
sub %g1, %l0, %g2
|
||||||
setx va_shift, %g7, %g1
|
setx va_shift, %g7, %g1
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ int forth_load(struct sys_info *info, const char *filename, const char *cmdline)
|
|||||||
}
|
}
|
||||||
|
|
||||||
forthsize = file_size();
|
forthsize = file_size();
|
||||||
|
|
||||||
forthtext = malloc(forthsize+1);
|
forthtext = malloc(forthsize+1);
|
||||||
file_seek(0);
|
file_seek(0);
|
||||||
|
|
||||||
printk("Loading forth source ...");
|
printk("Loading forth source ...");
|
||||||
if ((unsigned long)lfile_read(forthtext, forthsize) != forthsize) {
|
if ((unsigned long)lfile_read(forthtext, forthsize) != forthsize) {
|
||||||
printk("Can't read forth text\n");
|
printk("Can't read forth text\n");
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
:noname
|
:noname
|
||||||
." Type 'help' for detailed information" cr
|
." Type 'help' for detailed information" cr
|
||||||
\ ." boot secondary slave cdrom: " cr
|
\ ." boot secondary slave cdrom: " cr
|
||||||
\ ." 0 > boot hd:2,\boot\vmlinuz root=/dev/hda2" cr
|
\ ." 0 > boot hd:2,\boot\vmlinuz root=/dev/hda2" cr
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
: preopen ( chosen-str node-path )
|
: preopen ( chosen-str node-path )
|
||||||
2dup make-openable
|
2dup make-openable
|
||||||
|
|
||||||
" /chosen" find-device
|
" /chosen" find-device
|
||||||
open-dev ?dup if
|
open-dev ?dup if
|
||||||
encode-int 2swap property
|
encode-int 2swap property
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
2drop
|
2drop
|
||||||
then
|
then
|
||||||
;
|
;
|
||||||
|
|
||||||
:noname
|
:noname
|
||||||
set-defaults
|
set-defaults
|
||||||
; SYSTEM-initializer
|
; SYSTEM-initializer
|
||||||
@@ -45,11 +45,11 @@
|
|||||||
" /builtin/console" " output-device" $setenv
|
" /builtin/console" " output-device" $setenv
|
||||||
then
|
then
|
||||||
; SYSTEM-initializer
|
; SYSTEM-initializer
|
||||||
|
|
||||||
:noname
|
:noname
|
||||||
" keyboard" input
|
" keyboard" input
|
||||||
; CONSOLE-IN-initializer
|
; CONSOLE-IN-initializer
|
||||||
|
|
||||||
device-end
|
device-end
|
||||||
|
|
||||||
: rmap@ ( virt -- rmentry )
|
: rmap@ ( virt -- rmentry )
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ SECTIONS
|
|||||||
{
|
{
|
||||||
. = BASE_ADDR;
|
. = BASE_ADDR;
|
||||||
|
|
||||||
/* Start of the program.
|
/* Start of the program.
|
||||||
* Now the version string is in the note, we must include it
|
* Now the version string is in the note, we must include it
|
||||||
* in the program. Otherwise we lose the string after relocation. */
|
* in the program. Otherwise we lose the string after relocation. */
|
||||||
_start = .;
|
_start = .;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "openbios/kernel.h"
|
#include "openbios/kernel.h"
|
||||||
|
|
||||||
/* Format a string and print it on the screen, just like the libc
|
/* Format a string and print it on the screen, just like the libc
|
||||||
* function printf.
|
* function printf.
|
||||||
*/
|
*/
|
||||||
int printk( const char *fmt, ... )
|
int printk( const char *fmt, ... )
|
||||||
{
|
{
|
||||||
@@ -50,7 +50,7 @@ void *malloc(int size)
|
|||||||
if(memsize>=size) {
|
if(memsize>=size) {
|
||||||
memsize-=size;
|
memsize-=size;
|
||||||
ret=memptr;
|
ret=memptr;
|
||||||
memptr+=size;
|
memptr = (void *)((unsigned long)memptr + size);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,3 @@ void free(void *ptr)
|
|||||||
{
|
{
|
||||||
/* Nothing yet */
|
/* Nothing yet */
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long map_page(unsigned long va, unsigned long epa, int type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "sys_info.h"
|
#include "sys_info.h"
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
#include "loadfs.h"
|
#include "loadfs.h"
|
||||||
|
#include "boot.h"
|
||||||
|
|
||||||
#define printf printk
|
#define printf printk
|
||||||
#define debug printk
|
#define debug printk
|
||||||
@@ -355,7 +356,7 @@ static char *parse_command_line(const char *orig_cmdline, char *kern_cmdline)
|
|||||||
printf("Garbage after mem=<size>, ignored\n");
|
printf("Garbage after mem=<size>, ignored\n");
|
||||||
forced_memsize = 0;
|
forced_memsize = 0;
|
||||||
}
|
}
|
||||||
debug("mem=%Lu\n", forced_memsize);
|
debug("mem=%llu\n", (unsigned long long)forced_memsize);
|
||||||
}
|
}
|
||||||
/* mem= is for both loader and kernel */
|
/* mem= is for both loader and kernel */
|
||||||
to_kern = 1;
|
to_kern = 1;
|
||||||
@@ -424,7 +425,7 @@ static int load_linux_kernel(struct linux_header *hdr, uint32_t kern_addr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf("Loading kernel... ");
|
printf("Loading kernel... ");
|
||||||
if (lfile_read(phys_to_virt(kern_addr), kern_size) != kern_size) {
|
if ((uint32_t)lfile_read(phys_to_virt(kern_addr), kern_size) != kern_size) {
|
||||||
printf("Can't read kernel\n");
|
printf("Can't read kernel\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -433,8 +434,8 @@ static int load_linux_kernel(struct linux_header *hdr, uint32_t kern_addr)
|
|||||||
return kern_size;
|
return kern_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int load_initrd(struct linux_header *hdr, struct sys_info *info,
|
static int load_initrd(struct linux_header *hdr, uint32_t kern_end,
|
||||||
uint32_t kern_end, struct linux_params *params, const char *initrd_file)
|
struct linux_params *params, const char *initrd_file)
|
||||||
{
|
{
|
||||||
uint32_t max;
|
uint32_t max;
|
||||||
uint32_t start, end, size;
|
uint32_t start, end, size;
|
||||||
@@ -462,7 +463,7 @@ static int load_initrd(struct linux_header *hdr, struct sys_info *info,
|
|||||||
max = hdr->initrd_addr_max;
|
max = hdr->initrd_addr_max;
|
||||||
else
|
else
|
||||||
max = 0x38000000; /* Hardcoded value for older kernels */
|
max = 0x38000000; /* Hardcoded value for older kernels */
|
||||||
|
|
||||||
/* FILO itself is at the top of RAM. (relocated)
|
/* FILO itself is at the top of RAM. (relocated)
|
||||||
* So, try putting initrd just below us. */
|
* So, try putting initrd just below us. */
|
||||||
end = virt_to_phys(_start);
|
end = virt_to_phys(_start);
|
||||||
@@ -497,7 +498,7 @@ static int load_initrd(struct linux_header *hdr, struct sys_info *info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("Loading initrd... ");
|
printf("Loading initrd... ");
|
||||||
if (lfile_read(phys_to_virt(start), size) != size) {
|
if ((uint32_t)lfile_read(phys_to_virt(start), size) != size) {
|
||||||
printf("Can't read initrd\n");
|
printf("Can't read initrd\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -518,9 +519,9 @@ static void hardware_setup(void)
|
|||||||
outb(0, 0xf0);
|
outb(0, 0xf0);
|
||||||
outb(0, 0xf1);
|
outb(0, 0xf1);
|
||||||
|
|
||||||
/* we're getting screwed again and again by this problem of the 8259.
|
/* we're getting screwed again and again by this problem of the 8259.
|
||||||
* so we're going to leave this lying around for inclusion into
|
* so we're going to leave this lying around for inclusion into
|
||||||
* crt0.S on an as-needed basis.
|
* crt0.S on an as-needed basis.
|
||||||
*
|
*
|
||||||
* well, that went ok, I hope. Now we have to reprogram the interrupts :-(
|
* well, that went ok, I hope. Now we have to reprogram the interrupts :-(
|
||||||
* we put them right after the intel-reserved hardware interrupts, at
|
* we put them right after the intel-reserved hardware interrupts, at
|
||||||
@@ -548,7 +549,7 @@ static void hardware_setup(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Start Linux */
|
/* Start Linux */
|
||||||
static int start_linux(uint32_t kern_addr, struct linux_params *params)
|
static int start_linux(uint32_t kern_addr)
|
||||||
{
|
{
|
||||||
struct context *ctx;
|
struct context *ctx;
|
||||||
//extern int cursor_x, cursor_y;
|
//extern int cursor_x, cursor_y;
|
||||||
@@ -568,12 +569,12 @@ static int start_linux(uint32_t kern_addr, struct linux_params *params)
|
|||||||
params->orig_x = cursor_x;
|
params->orig_x = cursor_x;
|
||||||
params->orig_y = cursor_y;
|
params->orig_y = cursor_y;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Go... */
|
/* Go... */
|
||||||
ctx = switch_to(ctx);
|
ctx = switch_to(ctx);
|
||||||
|
|
||||||
/* It's impossible but... */
|
/* It's impossible but... */
|
||||||
printf("Returned with o0=%#x\n", ctx->regs[REG_O0]);
|
printf("Returned with o0=%#lx\n", ctx->regs[REG_O0]);
|
||||||
|
|
||||||
return ctx->regs[REG_O0];
|
return ctx->regs[REG_O0];
|
||||||
}
|
}
|
||||||
@@ -608,7 +609,7 @@ int linux_load(struct sys_info *info, const char *file, const char *cmdline)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (initrd_file) {
|
if (initrd_file) {
|
||||||
if (load_initrd(&hdr, info, kern_addr+kern_size, params, initrd_file)
|
if (load_initrd(&hdr, kern_addr+kern_size, params, initrd_file)
|
||||||
!= 0) {
|
!= 0) {
|
||||||
free(initrd_file);
|
free(initrd_file);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -618,6 +619,6 @@ int linux_load(struct sys_info *info, const char *file, const char *cmdline)
|
|||||||
|
|
||||||
hardware_setup();
|
hardware_setup();
|
||||||
|
|
||||||
start_linux(kern_addr, params);
|
start_linux(kern_addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ int file_open(const char *filename)
|
|||||||
|
|
||||||
void file_close(void)
|
void file_close(void)
|
||||||
{
|
{
|
||||||
if(load_fd==-1)
|
if(load_fd==-1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
close_io(load_fd);
|
close_io(load_fd);
|
||||||
|
|||||||
@@ -2,6 +2,4 @@ int file_open(const char *filename);
|
|||||||
int lfile_read(void *buf, unsigned long len);
|
int lfile_read(void *buf, unsigned long len);
|
||||||
int file_seek(unsigned long offset);
|
int file_seek(unsigned long offset);
|
||||||
unsigned long file_size(void);
|
unsigned long file_size(void);
|
||||||
|
void file_close(void);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Support for Multiboot */
|
/* Support for Multiboot */
|
||||||
|
|
||||||
#include "openbios/config.h"
|
#include "openbios/config.h"
|
||||||
#include "asm/io.h"
|
#include "asm/io.h"
|
||||||
#include "sys_info.h"
|
#include "sys_info.h"
|
||||||
#include "multiboot.h"
|
#include "multiboot.h"
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#ifdef CONFIG_DEBUG_BOOT
|
#ifdef CONFIG_DEBUG_BOOT
|
||||||
#define debug printk
|
#define debug printk
|
||||||
#else
|
#else
|
||||||
#define debug(x...)
|
#define debug(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct mbheader {
|
struct mbheader {
|
||||||
@@ -62,11 +62,11 @@ void collect_multiboot_info(struct sys_info *info)
|
|||||||
printf("Multiboot: no dictionary\n");
|
printf("Multiboot: no dictionary\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mod = (module_t *) mbinfo->mods_addr;
|
mod = (module_t *) mbinfo->mods_addr;
|
||||||
info->dict_start=(unsigned long *)mod->mod_start;
|
info->dict_start=(unsigned long *)mod->mod_start;
|
||||||
info->dict_end=(unsigned long *)mod->mod_end;
|
info->dict_end=(unsigned long *)mod->mod_end;
|
||||||
|
|
||||||
if (mbinfo->flags & MULTIBOOT_MMAP_VALID) {
|
if (mbinfo->flags & MULTIBOOT_MMAP_VALID) {
|
||||||
/* convert mmap records */
|
/* convert mmap records */
|
||||||
mbmem = phys_to_virt(mbinfo->mmap_addr);
|
mbmem = phys_to_virt(mbinfo->mmap_addr);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* multiboot.h
|
/* multiboot.h
|
||||||
* tag: header for multiboot
|
* tag: header for multiboot
|
||||||
*
|
*
|
||||||
* Copyright (C) 2003-2004 Stefan Reinauer
|
* Copyright (C) 2003-2004 Stefan Reinauer
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -13,12 +13,14 @@
|
|||||||
#include "dict.h"
|
#include "dict.h"
|
||||||
#include "openbios/kernel.h"
|
#include "openbios/kernel.h"
|
||||||
#include "openbios/stack.h"
|
#include "openbios/stack.h"
|
||||||
|
#include "openbios/nvram.h"
|
||||||
#include "sys_info.h"
|
#include "sys_info.h"
|
||||||
#include "openbios.h"
|
#include "openbios.h"
|
||||||
|
#include "libc/byteorder.h"
|
||||||
|
#define cpu_to_be16(x) __cpu_to_be16(x)
|
||||||
#include "openbios/firmware_abi.h"
|
#include "openbios/firmware_abi.h"
|
||||||
#include "boot.h"
|
#include "boot.h"
|
||||||
|
#include "../../drivers/timer.h" // XXX
|
||||||
void boot(void);
|
|
||||||
|
|
||||||
static unsigned char intdict[256 * 1024];
|
static unsigned char intdict[256 * 1024];
|
||||||
|
|
||||||
@@ -122,9 +124,9 @@ id_cpu(void)
|
|||||||
void arch_nvram_get(char *data)
|
void arch_nvram_get(char *data)
|
||||||
{
|
{
|
||||||
unsigned short i;
|
unsigned short i;
|
||||||
unsigned char *nvptr = &nv_info;
|
unsigned char *nvptr = (unsigned char *)&nv_info;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
struct cpudef *cpu;
|
const struct cpudef *cpu;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(ohwcfg_v3_t); i++) {
|
for (i = 0; i < sizeof(ohwcfg_v3_t); i++) {
|
||||||
outb(i & 0xff, 0x74);
|
outb(i & 0xff, 0x74);
|
||||||
@@ -146,13 +148,13 @@ void arch_nvram_get(char *data)
|
|||||||
size = nv_info.cmdline_size;
|
size = nv_info.cmdline_size;
|
||||||
if (size > OBIO_CMDLINE_MAX - 1)
|
if (size > OBIO_CMDLINE_MAX - 1)
|
||||||
size = OBIO_CMDLINE_MAX - 1;
|
size = OBIO_CMDLINE_MAX - 1;
|
||||||
memcpy(obio_cmdline, (void *)nv_info.cmdline, size);
|
memcpy(&obio_cmdline, (void *)(long)nv_info.cmdline, size);
|
||||||
obio_cmdline[size] = '\0';
|
obio_cmdline[size] = '\0';
|
||||||
cmdline = obio_cmdline;
|
qemu_cmdline = (uint64_t)obio_cmdline;
|
||||||
cmdline_size = size;
|
cmdline_size = size;
|
||||||
boot_device = nv_info.boot_devices[0];
|
boot_device = nv_info.boot_devices[0];
|
||||||
|
|
||||||
printk("kernel addr %x size %x\n", kernel_image, kernel_size);
|
printk("kernel addr %lx size %lx\n", kernel_image, kernel_size);
|
||||||
if (size)
|
if (size)
|
||||||
printk("kernel cmdline %s\n", obio_cmdline);
|
printk("kernel cmdline %s\n", obio_cmdline);
|
||||||
|
|
||||||
@@ -178,16 +180,16 @@ void arch_nvram_put(char *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int arch_nvram_size()
|
int arch_nvram_size(void)
|
||||||
{
|
{
|
||||||
return NVRAM_OB_SIZE;
|
return NVRAM_OB_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_timers()
|
void setup_timers(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void udelay()
|
void udelay(unsigned int usecs)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +197,7 @@ static void init_memory(void)
|
|||||||
{
|
{
|
||||||
|
|
||||||
/* push start and end of available memory to the stack
|
/* push start and end of available memory to the stack
|
||||||
* so that the forth word QUIT can initialize memory
|
* so that the forth word QUIT can initialize memory
|
||||||
* management. For now we use hardcoded memory between
|
* management. For now we use hardcoded memory between
|
||||||
* 0x10000 and 0x9ffff (576k). If we need more memory
|
* 0x10000 and 0x9ffff (576k). If we need more memory
|
||||||
* than that we have serious bloat.
|
* than that we have serious bloat.
|
||||||
@@ -208,8 +210,6 @@ static void init_memory(void)
|
|||||||
static void
|
static void
|
||||||
arch_init( void )
|
arch_init( void )
|
||||||
{
|
{
|
||||||
void setup_timers(void);
|
|
||||||
|
|
||||||
modules_init();
|
modules_init();
|
||||||
#ifdef CONFIG_DRIVER_PCI
|
#ifdef CONFIG_DRIVER_PCI
|
||||||
ob_pci_init();
|
ob_pci_init();
|
||||||
@@ -249,7 +249,7 @@ int openbios(void)
|
|||||||
|
|
||||||
dict=intdict;
|
dict=intdict;
|
||||||
load_dictionary((char *)sys_info.dict_start,
|
load_dictionary((char *)sys_info.dict_start,
|
||||||
(unsigned long)sys_info.dict_end
|
(unsigned long)sys_info.dict_end
|
||||||
- (unsigned long)sys_info.dict_start);
|
- (unsigned long)sys_info.dict_start);
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_BOOT
|
#ifdef CONFIG_DEBUG_BOOT
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Creation Date: <2004/01/15 16:14:05 samuel>
|
* Creation Date: <2004/01/15 16:14:05 samuel>
|
||||||
* Time-stamp: <2004/01/15 16:14:05 samuel>
|
* Time-stamp: <2004/01/15 16:14:05 samuel>
|
||||||
*
|
*
|
||||||
* <openbios.h>
|
* <openbios.h>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004 Samuel Rydh (samuel@ibrium.se)
|
* Copyright (C) 2004 Samuel Rydh (samuel@ibrium.se)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* version 2
|
* version 2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _H_OPENBIOS
|
#ifndef _H_OPENBIOS
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
* switches the stack, and restores everything from the new stack.
|
* switches the stack, and restores everything from the new stack.
|
||||||
* This function takes no argument. New stack pointer is
|
* This function takes no argument. New stack pointer is
|
||||||
* taken from global variable __context, and old stack pointer
|
* taken from global variable __context, and old stack pointer
|
||||||
* is also saved to __context. This way we can just jump to
|
* is also saved to __context. This way we can just jump to
|
||||||
* this routine to get back to the original context.
|
* this routine to get back to the original context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ __switch_context_nosave:
|
|||||||
ldx [%g1 + 232], %i5
|
ldx [%g1 + 232], %i5
|
||||||
ldx [%g1 + 240], %i6
|
ldx [%g1 + 240], %i6
|
||||||
ldx [%g1 + 248], %i7
|
ldx [%g1 + 248], %i7
|
||||||
|
|
||||||
ldx [%g1 + 256], %g1
|
ldx [%g1 + 256], %g1
|
||||||
/* Finally, load new %pc */
|
/* Finally, load new %pc */
|
||||||
jmp %g1
|
jmp %g1
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#ifdef CONFIG_DEBUG_BOOT
|
#ifdef CONFIG_DEBUG_BOOT
|
||||||
#define debug printk
|
#define debug printk
|
||||||
#else
|
#else
|
||||||
#define debug(x...)
|
#define debug(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint64_t qemu_mem_size;
|
uint64_t qemu_mem_size;
|
||||||
|
|||||||
@@ -175,7 +175,7 @@
|
|||||||
stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]; \
|
stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]; \
|
||||||
ba,pt %xcc, rtrap_clr_l6; \
|
ba,pt %xcc, rtrap_clr_l6; \
|
||||||
stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC];
|
stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC];
|
||||||
|
|
||||||
#ifdef CONFIG_KPROBES
|
#ifdef CONFIG_KPROBES
|
||||||
#define KPROBES_TRAP(lvl) TRAP_IRQ(kprobe_trap, lvl)
|
#define KPROBES_TRAP(lvl) TRAP_IRQ(kprobe_trap, lvl)
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Sparc V9 Trap Table(s) with SpitFire/Cheetah extensions.
|
* Sparc V9 Trap Table(s) with SpitFire/Cheetah extensions.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1996, 2001 David S. Miller (davem@caip.rutgers.edu)
|
* Copyright (C) 1996, 2001 David S. Miller (davem@caip.rutgers.edu)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* version 2 as published by the Free Software Foundation.
|
* version 2 as published by the Free Software Foundation.
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ va2pa(unsigned long va)
|
|||||||
static inline unsigned long
|
static inline unsigned long
|
||||||
pa2va(unsigned long pa)
|
pa2va(unsigned long pa)
|
||||||
{
|
{
|
||||||
if ((pa + va_shift >= (unsigned long)&_data) &&
|
if ((pa + va_shift >= (unsigned long)&_data) &&
|
||||||
(pa + va_shift< (unsigned long)&_end))
|
(pa + va_shift< (unsigned long)&_end))
|
||||||
return pa + va_shift;
|
return pa + va_shift;
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user