Fix most warnings from Sparse

git-svn-id: svn://coreboot.org/openbios/openbios-devel@274 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2008-11-30 11:54:01 +00:00
parent c52d26b976
commit bf0c6b1c38
51 changed files with 186 additions and 166 deletions

View File

@@ -58,7 +58,7 @@ static char uart_getchar(int port)
static void uart_putchar(int port, unsigned char c) static void uart_putchar(int port, unsigned char c)
{ {
if (!port) if (!port)
return -1; return;
while (!(inb(LSR(port)) & 0x20)); while (!(inb(LSR(port)) & 0x20));
outb(c, THR(port)); outb(c, THR(port));
} }
@@ -134,6 +134,7 @@ typedef struct osi_fb_info {
#define openbios_GetFBInfo(x) Qemu_GetFBInfo(x) #define openbios_GetFBInfo(x) Qemu_GetFBInfo(x)
#include "../../../modules/font_8x16.c" #include "../../../modules/font_8x16.c"
#undef FONTDATAMAX
#include "../../../modules/video.c" #include "../../../modules/video.c"
#include "../../../modules/console.c" #include "../../../modules/console.c"

View File

@@ -47,7 +47,7 @@ enum {
ARCH_HEATHROW, ARCH_HEATHROW,
}; };
pci_arch_t known_arch[] = { static pci_arch_t known_arch[] = {
[ARCH_PREP] = { "PREP", 0x1057, 0x4801, 0x80800000, 0x800c0000, [ARCH_PREP] = { "PREP", 0x1057, 0x4801, 0x80800000, 0x800c0000,
0x80000000, 0x00100000, 0xf0000000, 0x10000000, 0x80000000, 0x00100000, 0xf0000000, 0x10000000,
0x80000000, 0x00010000, 0x00000000, 0x00400000, 0x80000000, 0x00010000, 0x00000000, 0x00400000,

View File

@@ -20,6 +20,7 @@
#include "openbios/kernel.h" #include "openbios/kernel.h"
#include "openbios/nvram.h" #include "openbios/nvram.h"
#include "openbios/bindings.h" #include "openbios/bindings.h"
#include "openbios/drivers.h"
#include "libc/vsprintf.h" #include "libc/vsprintf.h"
#include "libc/string.h" #include "libc/string.h"
#include "libc/byteorder.h" #include "libc/byteorder.h"
@@ -111,7 +112,7 @@ void macio_nvram_init(char *path, uint32_t addr)
set_property(dnode, "compatible", "nvram,flash", 12); set_property(dnode, "compatible", "nvram,flash", 12);
props[0] = __cpu_to_be32(IO_NVRAM_OFFSET); props[0] = __cpu_to_be32(IO_NVRAM_OFFSET);
props[1] = __cpu_to_be32(IO_NVRAM_SIZE); props[1] = __cpu_to_be32(IO_NVRAM_SIZE);
set_property(dnode, "reg", &props, sizeof(props)); set_property(dnode, "reg", (char *)&props, sizeof(props));
set_property(dnode, "device_type", "nvram", 6); set_property(dnode, "device_type", "nvram", 6);
chosen = find_dev("/chosen"); chosen = find_dev("/chosen");

View File

@@ -21,6 +21,9 @@ extern void vfd_close( void );
extern int console_draw_str( const char *str ); extern int console_draw_str( const char *str );
/* console.c */
int serial_init(void);
#include "kernel.h" #include "kernel.h"
#endif /* _H_QEMU */ #endif /* _H_QEMU */

View File

@@ -16,6 +16,7 @@
#include "openbios/config.h" #include "openbios/config.h"
#include "openbios/bindings.h" #include "openbios/bindings.h"
#include "qemu.h"
void devtree_init( void ) void devtree_init( void )
{ {

View File

@@ -51,8 +51,7 @@ static int check_mem_ranges(struct sys_info *info,
return 0; return 0;
} }
int aout_load(struct sys_info *info, const char *filename, const char *cmdline, int aout_load(struct sys_info *info, const char *filename, const void *romvec)
const void *romvec)
{ {
int retval = -1; int retval = -1;
int image_retval; int image_retval;
@@ -60,7 +59,7 @@ int aout_load(struct sys_info *info, const char *filename, const char *cmdline,
unsigned long start, size; unsigned long start, size;
unsigned int offset; unsigned int offset;
image_name = image_version = 0; image_name = image_version = NULL;
if (!file_open(filename)) if (!file_open(filename))
goto out; goto out;

View File

@@ -6,6 +6,7 @@
#include "openbios/bindings.h" #include "openbios/bindings.h"
#include "openbios/elfload.h" #include "openbios/elfload.h"
#include "openbios/nvram.h" #include "openbios/nvram.h"
#include "openbios/drivers.h"
#include "libc/diskio.h" #include "libc/diskio.h"
#include "libc/vsprintf.h" #include "libc/vsprintf.h"
#include "sys_info.h" #include "sys_info.h"
@@ -103,14 +104,17 @@ void boot(void)
printk("without parameters.\n"); printk("without parameters.\n");
if (elf_load(&sys_info, path, param, romvec) == LOADER_NOT_SUPPORT) if (elf_load(&sys_info, path, param, romvec) == LOADER_NOT_SUPPORT)
if (linux_load(&sys_info, path, param, romvec) == LOADER_NOT_SUPPORT) if (linux_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
if (aout_load(&sys_info, path, param, romvec) == LOADER_NOT_SUPPORT) { if (aout_load(&sys_info, path, romvec) == LOADER_NOT_SUPPORT) {
sprintf(altpath, "%s:d", path); sprintf(altpath, "%s:d", path);
if (elf_load(&sys_info, altpath, param, romvec) == LOADER_NOT_SUPPORT) if (elf_load(&sys_info, altpath, param, romvec)
if (linux_load(&sys_info, altpath, param, romvec) == LOADER_NOT_SUPPORT) == LOADER_NOT_SUPPORT)
if (aout_load(&sys_info, altpath, param, romvec) == LOADER_NOT_SUPPORT) if (linux_load(&sys_info, altpath, param)
== LOADER_NOT_SUPPORT)
if (aout_load(&sys_info, altpath, romvec)
== LOADER_NOT_SUPPORT)
printk("Unsupported image format\n"); printk("Unsupported image format\n");
} }

View File

@@ -6,25 +6,35 @@
* the copyright and warranty status of this work. * the copyright and warranty status of this work.
*/ */
int forth_load(struct sys_info *info, const char *filename, const char *cmdline); // forthload.c
int forth_load(const char *filename);
// elfload.c
int elf_load(struct sys_info *, const char *filename, const char *cmdline, int elf_load(struct sys_info *, const char *filename, const char *cmdline,
const void *romvec); const void *romvec);
int aout_load(struct sys_info *, const char *filename, const char *cmdline,
const void *romvec);
int linux_load(struct sys_info *, const char *filename, const char *cmdline,
const void *romvec);
// aout_load.c
int aout_load(struct sys_info *info, const char *filename, const void *romvec);
// linux_load.c
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
// context.c
extern struct context *__context;
unsigned int start_elf(unsigned long entry_point, unsigned long param); unsigned int start_elf(unsigned long entry_point, unsigned long param);
// romvec.c
void *init_openprom(unsigned long memsize, const char *path); void *init_openprom(unsigned long memsize, const char *path);
// boot.c
extern struct sys_info sys_info;
void boot(void); void boot(void);
extern struct sys_info sys_info; // sys_info.c
extern uint32_t kernel_image;
extern uint32_t kernel_size;
extern uint32_t qemu_cmdline;
extern uint32_t cmdline_size;
extern char boot_device;
extern unsigned int qemu_mem_size; extern unsigned int qemu_mem_size;
// romvec.c
extern struct linux_arguments_v0 obp_arg; extern struct linux_arguments_v0 obp_arg;
// openbios.c
extern int qemu_machine_type; extern int qemu_machine_type;

View File

@@ -22,7 +22,7 @@ void __exit_context(void); /* assembly routine */
* 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.
*/ */
struct context main_ctx = { static struct context main_ctx = {
.regs[REG_SP] = (uint32_t) &_estack - 96, .regs[REG_SP] = (uint32_t) &_estack - 96,
.pc = (uint32_t) start_main, .pc = (uint32_t) start_main,
.npc = (uint32_t) start_main + 4, .npc = (uint32_t) start_main + 4,

View File

@@ -26,7 +26,7 @@ static void *calloc(size_t nmemb, size_t size)
if (alloc_size < nmemb || alloc_size < size) { if (alloc_size < nmemb || alloc_size < size) {
printf("calloc overflow: %u, %u\n", nmemb, size); printf("calloc overflow: %u, %u\n", nmemb, size);
return 0; return NULL;
} }
mem = malloc(alloc_size); mem = malloc(alloc_size);
@@ -314,7 +314,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline,
int image_retval; int image_retval;
unsigned int offset; unsigned int offset;
image_name = image_version = 0; image_name = image_version = NULL;
if (!file_open(filename)) if (!file_open(filename))
goto out; goto out;

View File

@@ -16,7 +16,8 @@
#define debug printk #define debug printk
static char *forthtext=NULL; static char *forthtext=NULL;
int forth_load(struct sys_info *info, const char *filename, const char *cmdline)
int forth_load(const char *filename)
{ {
char magic[2]; char magic[2];
unsigned long forthsize; unsigned long forthsize;

View File

@@ -156,7 +156,7 @@ struct linux_params {
uint8_t reserved17[1792]; /* 0x900 - 0x1000 */ uint8_t reserved17[1792]; /* 0x900 - 0x1000 */
}; };
uint64_t forced_memsize; static uint64_t forced_memsize;
/* Load the first part the file and check if it's Linux */ /* Load the first part the file and check if it's Linux */
static uint32_t load_linux_header(struct linux_header *hdr) static uint32_t load_linux_header(struct linux_header *hdr)
@@ -293,14 +293,14 @@ static char *parse_command_line(const char *orig_cmdline, char *kern_cmdline)
unsigned long len; unsigned long len;
int k_len; int k_len;
int to_kern; int to_kern;
char *initrd = 0; char *initrd = NULL;
int toolong = 0; int toolong = 0;
forced_memsize = 0; forced_memsize = 0;
if (!orig_cmdline) { if (!orig_cmdline) {
*kern_cmdline = 0; *kern_cmdline = '\0';
return 0; return NULL;
} }
k_len = 0; k_len = 0;
@@ -327,7 +327,7 @@ static char *parse_command_line(const char *orig_cmdline, char *kern_cmdline)
val = sep + 1; val = sep + 1;
len = end - val; len = end - val;
} else { } else {
val = 0; val = NULL;
len = 0; len = 0;
} }
@@ -434,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;
@@ -549,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;
@@ -579,13 +579,12 @@ static int start_linux(uint32_t kern_addr, struct linux_params *params)
return ctx->regs[REG_O0]; return ctx->regs[REG_O0];
} }
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)
const void *romvec)
{ {
struct linux_header hdr; struct linux_header hdr;
struct linux_params *params; struct linux_params *params;
uint32_t kern_addr, kern_size; uint32_t kern_addr, kern_size;
char *initrd_file = 0; char *initrd_file = NULL;
if (!file_open(file)) if (!file_open(file))
return -1; return -1;
@@ -610,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;
@@ -620,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;
} }

View File

@@ -257,18 +257,14 @@ static int obp_nbputchar(int ch)
static void obp_reboot(char *str) static void obp_reboot(char *str)
{ {
extern volatile unsigned int *reset_reg;
printk("rebooting (%s)\n", str); printk("rebooting (%s)\n", str);
*reset_reg = 1; *reset_reg = 1;
printk("reboot failed\n"); printk("reboot failed\n");
for (;;) {} for (;;) {}
} }
extern volatile unsigned char *power_reg;
static void obp_abort(void) static void obp_abort(void)
{ {
printk("abort, power off\n"); printk("abort, power off\n");
*power_reg = 1; *power_reg = 1;
printk("power off failed\n"); printk("power off failed\n");

View File

@@ -3,6 +3,7 @@
#include "elf_boot.h" #include "elf_boot.h"
#include "sys_info.h" #include "sys_info.h"
#include "context.h" #include "context.h"
#include "boot.h"
#define printf printk #define printf printk
#ifdef CONFIG_DEBUG_BOOT #ifdef CONFIG_DEBUG_BOOT
@@ -20,7 +21,6 @@ void collect_sys_info(struct sys_info *info)
int i; int i;
unsigned long long total = 0; unsigned long long total = 0;
struct memrange *mmap; struct memrange *mmap;
extern struct elf_image_note elf_image_notes;
/* Pick up paramters given by bootloader to us */ /* Pick up paramters given by bootloader to us */
//info->boot_type = boot_ctx->eax; //info->boot_type = boot_ctx->eax;

View File

@@ -52,7 +52,7 @@ static int check_mem_ranges(struct sys_info *info,
return 0; return 0;
} }
int aout_load(struct sys_info *info, const char *filename, const char *cmdline) int aout_load(struct sys_info *info, const char *filename)
{ {
int retval = -1; int retval = -1;
int image_retval; int image_retval;
@@ -60,7 +60,7 @@ int aout_load(struct sys_info *info, const char *filename, const char *cmdline)
unsigned long start, size; unsigned long start, size;
unsigned int offset; unsigned int offset;
image_name = image_version = 0; image_name = image_version = NULL;
if (!file_open(filename)) if (!file_open(filename))
goto out; goto out;

View File

@@ -85,9 +85,8 @@ void boot(void)
if (elf_load(&sys_info, path, param) == LOADER_NOT_SUPPORT) if (elf_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
if (linux_load(&sys_info, path, param) == LOADER_NOT_SUPPORT) if (linux_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
if (aout_load(&sys_info, path, param) == LOADER_NOT_SUPPORT) if (aout_load(&sys_info, path) == LOADER_NOT_SUPPORT)
if (fcode_load(&sys_info, path, param) if (fcode_load(path) == LOADER_NOT_SUPPORT) {
== LOADER_NOT_SUPPORT) {
sprintf(altpath, "%s:d", path); sprintf(altpath, "%s:d", path);
@@ -95,9 +94,9 @@ void boot(void)
== LOADER_NOT_SUPPORT) == LOADER_NOT_SUPPORT)
if (linux_load(&sys_info, altpath, param) if (linux_load(&sys_info, altpath, param)
== LOADER_NOT_SUPPORT) == LOADER_NOT_SUPPORT)
if (aout_load(&sys_info, altpath, param) if (aout_load(&sys_info, altpath)
== LOADER_NOT_SUPPORT) == LOADER_NOT_SUPPORT)
if (fcode_load(&sys_info, path, param) if (fcode_load(altpath)
== LOADER_NOT_SUPPORT) == LOADER_NOT_SUPPORT)
printk("Unsupported image format\n"); printk("Unsupported image format\n");
} }

View File

@@ -6,21 +6,32 @@
* the copyright and warranty status of this work. * the copyright and warranty status of this work.
*/ */
int forth_load(struct sys_info *info, const char *filename, const char *cmdline); // forthload.c
int elf_load(struct sys_info *info, const char *filename, const char *cmdline); int forth_load(const char *filename);
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
int aout_load(struct sys_info *info, const char *filename, const char *cmdline);
int fcode_load(struct sys_info *info, const char *filename,
const char *cmdline);
// elfload.c
int elf_load(struct sys_info *info, const char *filename, const char *cmdline);
// aout_load.c
int aout_load(struct sys_info *info, const char *filename);
// linux_load.c
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
// fcodeload.c
int fcode_load(const char *filename);
// context.c
uint64_t start_elf(uint64_t entry_point, uint64_t param); uint64_t start_elf(uint64_t entry_point, uint64_t param);
void boot(void); // boot.c
extern struct sys_info sys_info;
extern uint64_t kernel_image; extern uint64_t kernel_image;
extern uint64_t kernel_size; extern uint64_t kernel_size;
extern uint64_t qemu_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; void boot(void);
// console.c
void ob_su_init(uint64_t base, uint64_t offset, int intr); void ob_su_init(uint64_t base, uint64_t offset, int intr);

View File

@@ -22,7 +22,7 @@ void __exit_context(void); /* assembly routine */
* 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.
*/ */
struct context main_ctx = { static 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,

View File

@@ -26,7 +26,7 @@ static void *calloc(size_t nmemb, size_t size)
if (alloc_size < nmemb || alloc_size < size) { if (alloc_size < nmemb || alloc_size < size) {
printf("calloc overflow: %u, %u\n", nmemb, size); printf("calloc overflow: %u, %u\n", nmemb, size);
return 0; return NULL;
} }
mem = malloc(alloc_size); mem = malloc(alloc_size);
@@ -313,7 +313,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline)
int image_retval; int image_retval;
unsigned int offset; unsigned int offset;
image_name = image_version = 0; image_name = image_version = NULL;
if (!file_open(filename)) if (!file_open(filename))
goto out; goto out;

View File

@@ -11,8 +11,7 @@
#define printf printk #define printf printk
#define debug printk #define debug printk
int fcode_load(struct sys_info *info, const char *filename, int fcode_load(const char *filename)
const char *cmdline)
{ {
int retval = -1; int retval = -1;
uint8_t fcode_header[8]; uint8_t fcode_header[8];

View File

@@ -16,7 +16,7 @@
#define debug printk #define debug printk
static char *forthtext=NULL; static char *forthtext=NULL;
int forth_load(struct sys_info *info, const char *filename, const char *cmdline) int forth_load(const char *filename)
{ {
char magic[2]; char magic[2];
unsigned long forthsize; unsigned long forthsize;

View File

@@ -156,7 +156,7 @@ struct linux_params {
uint8_t reserved17[1792]; /* 0x900 - 0x1000 */ uint8_t reserved17[1792]; /* 0x900 - 0x1000 */
}; };
uint64_t forced_memsize; static uint64_t forced_memsize;
/* Load the first part the file and check if it's Linux */ /* Load the first part the file and check if it's Linux */
static uint32_t load_linux_header(struct linux_header *hdr) static uint32_t load_linux_header(struct linux_header *hdr)
@@ -293,14 +293,14 @@ static char *parse_command_line(const char *orig_cmdline, char *kern_cmdline)
unsigned long len; unsigned long len;
int k_len; int k_len;
int to_kern; int to_kern;
char *initrd = 0; char *initrd = NULL;
int toolong = 0; int toolong = 0;
forced_memsize = 0; forced_memsize = 0;
if (!orig_cmdline) { if (!orig_cmdline) {
*kern_cmdline = 0; *kern_cmdline = '\0';
return 0; return NULL;
} }
k_len = 0; k_len = 0;
@@ -327,7 +327,7 @@ static char *parse_command_line(const char *orig_cmdline, char *kern_cmdline)
val = sep + 1; val = sep + 1;
len = end - val; len = end - val;
} else { } else {
val = 0; val = NULL;
len = 0; len = 0;
} }
@@ -584,7 +584,7 @@ int linux_load(struct sys_info *info, const char *file, const char *cmdline)
struct linux_header hdr; struct linux_header hdr;
struct linux_params *params; struct linux_params *params;
uint32_t kern_addr, kern_size; uint32_t kern_addr, kern_size;
char *initrd_file = 0; char *initrd_file = NULL;
if (!file_open(file)) if (!file_open(file))
return -1; return -1;

View File

@@ -21,7 +21,6 @@ void collect_sys_info(struct sys_info *info)
int i; int i;
unsigned long long total = 0; unsigned long long total = 0;
struct memrange *mmap; struct memrange *mmap;
extern struct elf_image_note elf_image_notes;
/* Pick up paramters given by bootloader to us */ /* Pick up paramters given by bootloader to us */
//info->boot_type = boot_ctx->eax; //info->boot_type = boot_ctx->eax;

View File

@@ -39,8 +39,6 @@ do { printk("ADB - %s: " fmt, __func__ , ##args); } while (0)
#define ADB_DPRINTF(fmt, args...) do { } while (0) #define ADB_DPRINTF(fmt, args...) do { } while (0)
#endif #endif
static void adb_read(void);
DECLARE_UNNAMED_NODE( keyboard, INSTALL_OPEN, sizeof(int)); DECLARE_UNNAMED_NODE( keyboard, INSTALL_OPEN, sizeof(int));
static void static void
@@ -447,7 +445,6 @@ struct adb_kbd_t {
int next_key; int next_key;
}; };
static adb_kbd_t *my_adb_kbd = NULL;
static adb_dev_t *my_adb_dev = NULL; static adb_dev_t *my_adb_dev = NULL;
static int adb_kbd_read (void *private) static int adb_kbd_read (void *private)
@@ -504,7 +501,7 @@ void *adb_kbd_new (char *path, void *private)
set_property(ph, "device_type", "keyboard", 9); set_property(ph, "device_type", "keyboard", 9);
props[0] = __cpu_to_be32(dev->addr); props[0] = __cpu_to_be32(dev->addr);
set_property(ph, "reg", &props, sizeof(props)); set_property(ph, "reg", (char *)&props, sizeof(props));
aliases = find_dev("/aliases"); aliases = find_dev("/aliases");
set_property(aliases, "adb-keyboard", buf, strlen(buf) + 1); set_property(aliases, "adb-keyboard", buf, strlen(buf) + 1);
@@ -542,14 +539,12 @@ mouse_close(int *idx)
{ {
} }
static void mouse_read(void);
NODE_METHODS( mouse ) = { NODE_METHODS( mouse ) = {
{ "open", mouse_open }, { "open", mouse_open },
{ "close", mouse_close }, { "close", mouse_close },
}; };
void *adb_mouse_new (char *path, void *private) void adb_mouse_new (char *path, void *private)
{ {
char buf[64]; char buf[64];
int props[1]; int props[1];
@@ -563,7 +558,7 @@ void *adb_mouse_new (char *path, void *private)
set_property(ph, "device_type", "mouse", 6); set_property(ph, "device_type", "mouse", 6);
props[0] = __cpu_to_be32(dev->addr); props[0] = __cpu_to_be32(dev->addr);
set_property(ph, "reg", &props, sizeof(props)); set_property(ph, "reg", (char *)&props, sizeof(props));
set_int_property(ph, "#buttons", 3); set_int_property(ph, "#buttons", 3);
aliases = find_dev("/aliases"); aliases = find_dev("/aliases");

View File

@@ -101,5 +101,6 @@ static inline int adb_reg_set (adb_dev_t *dev, uint8_t reg,
void *adb_kbd_new (char *path, void *private); void *adb_kbd_new (char *path, void *private);
void adb_mouse_new (char *path, void *private);
#endif /* !defined(__OHW_ADB_H__) */ #endif /* !defined(__OHW_ADB_H__) */

View File

@@ -171,7 +171,7 @@ ob_cuda_initialize (int *idx)
props[0] = __cpu_to_be32(IO_CUDA_OFFSET); props[0] = __cpu_to_be32(IO_CUDA_OFFSET);
props[1] = __cpu_to_be32(IO_CUDA_SIZE); props[1] = __cpu_to_be32(IO_CUDA_SIZE);
set_property(ph, "reg", &props, sizeof(props)); set_property(ph, "reg", (char *)&props, sizeof(props));
set_int_property(ph, "interrupt-parent", pic_handle); set_int_property(ph, "interrupt-parent", pic_handle);
// HEATHROW // HEATHROW
set_int_property(ph, "interrupts", 0x12); set_int_property(ph, "interrupts", 0x12);

View File

@@ -62,7 +62,7 @@ typedef struct esp_private {
sd_private_t sd[8]; sd_private_t sd[8];
} esp_private_t; } esp_private_t;
esp_private_t *global_esp; static esp_private_t *global_esp;
/* DECLARE data structures for the nodes. */ /* DECLARE data structures for the nodes. */
DECLARE_UNNAMED_NODE(ob_sd, INSTALL_OPEN, sizeof(sd_private_t *)); DECLARE_UNNAMED_NODE(ob_sd, INSTALL_OPEN, sizeof(sd_private_t *));
@@ -304,7 +304,7 @@ espdma_init(unsigned int slot, uint64_t base, unsigned long offset,
{ {
espdma->regs = (void *)map_io(base + (uint64_t)offset, 0x10); espdma->regs = (void *)map_io(base + (uint64_t)offset, 0x10);
if (espdma->regs == 0) { if (espdma->regs == NULL) {
DPRINTF("espdma_init: cannot map registers\n"); DPRINTF("espdma_init: cannot map registers\n");
return -1; return -1;
} }
@@ -437,7 +437,7 @@ ob_esp_init(unsigned int slot, uint64_t base, unsigned long espoffset,
/* Get the IO region */ /* Get the IO region */
esp->ll = (void *)map_io(base + (uint64_t)espoffset, esp->ll = (void *)map_io(base + (uint64_t)espoffset,
sizeof(struct esp_regs)); sizeof(struct esp_regs));
if (esp->ll == 0) { if (esp->ll == NULL) {
DPRINTF("Can't map ESP registers\n"); DPRINTF("Can't map ESP registers\n");
return -1; return -1;
} }

View File

@@ -41,7 +41,7 @@ struct mem {
}; };
struct mem cmem; /* Current memory, virtual */ struct mem cmem; /* Current memory, virtual */
struct mem cio; /* Current I/O space */ static struct mem cio; /* Current I/O space */
unsigned int va_shift; unsigned int va_shift;
@@ -59,7 +59,7 @@ struct iommu {
struct mem bmap; struct mem bmap;
}; };
struct iommu ciommu; static struct iommu ciommu;
static struct iommu_regs *regs; static struct iommu_regs *regs;
static void iommu_init(struct iommu *t, uint64_t base); static void iommu_init(struct iommu *t, uint64_t base);
@@ -95,7 +95,7 @@ mem_alloc(struct mem *t, int size, int align)
if ((unsigned long)p >= (unsigned long)t->uplim || if ((unsigned long)p >= (unsigned long)t->uplim ||
(unsigned long)p + size > (unsigned long)t->uplim) (unsigned long)p + size > (unsigned long)t->uplim)
return 0; return NULL;
t->curp = p + size; t->curp = p + size;
return p; return p;
@@ -106,7 +106,7 @@ mem_zalloc(struct mem *t, int size, int align)
{ {
char *p; char *p;
if ((p = mem_alloc(t, size, align)) != 0) if ((p = mem_alloc(t, size, align)) != NULL)
memset(p, 0, size); memset(p, 0, size);
return p; return p;
@@ -124,7 +124,7 @@ find_pte(unsigned long va, int alloc)
if (alloc) { if (alloc) {
p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD * sizeof(int), p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD * sizeof(int),
SRMMU_PTRS_PER_PMD * sizeof(int)); SRMMU_PTRS_PER_PMD * sizeof(int));
if (p == 0) if (p == NULL)
return -1; return -1;
pte = SRMMU_ET_PTD | ((va2pa((unsigned long)p)) >> 4); pte = SRMMU_ET_PTD | ((va2pa((unsigned long)p)) >> 4);
l1[(va >> SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD - 1)] = pte; l1[(va >> SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD - 1)] = pte;
@@ -141,7 +141,7 @@ find_pte(unsigned long va, int alloc)
if (alloc) { if (alloc) {
p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PTE * sizeof(void *), p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PTE * sizeof(void *),
SRMMU_PTRS_PER_PTE * sizeof(void *)); SRMMU_PTRS_PER_PTE * sizeof(void *));
if (p == 0) if (p == NULL)
return -2; return -2;
pte = SRMMU_ET_PTD | ((va2pa((unsigned int)p)) >> 4); pte = SRMMU_ET_PTD | ((va2pa((unsigned int)p)) >> 4);
*(uint32_t *)pa2va(pa) = pte; *(uint32_t *)pa2va(pa) = pte;
@@ -199,7 +199,7 @@ map_io(uint64_t pa, int size)
pa &= ~(PAGE_SIZE - 1); pa &= ~(PAGE_SIZE - 1);
va = mem_alloc(&cio, npages * PAGE_SIZE, PAGE_SIZE); va = mem_alloc(&cio, npages * PAGE_SIZE, PAGE_SIZE);
if (va == 0) if (va == NULL)
return va; return va;
mva = (unsigned int) va; mva = (unsigned int) va;
@@ -435,12 +435,12 @@ dvma_alloc(int size, unsigned int *pphys)
npages = (size + (PAGE_SIZE-1)) / PAGE_SIZE; npages = (size + (PAGE_SIZE-1)) / PAGE_SIZE;
va = mem_alloc(&cmem, npages * PAGE_SIZE, PAGE_SIZE); va = mem_alloc(&cmem, npages * PAGE_SIZE, PAGE_SIZE);
if (va == 0) if (va == NULL)
return 0; return NULL;
ba = (unsigned int)mem_alloc(&t->bmap, npages * PAGE_SIZE, PAGE_SIZE); ba = (unsigned int)mem_alloc(&t->bmap, npages * PAGE_SIZE, PAGE_SIZE);
if (ba == 0) if (ba == 0)
return 0; return NULL;
pa = (unsigned int)va2pa((unsigned long)va); pa = (unsigned int)va2pa((unsigned long)va);
@@ -484,7 +484,7 @@ iommu_init(struct iommu *t, uint64_t base)
unsigned int tmp; unsigned int tmp;
regs = map_io(base, IOMMU_REGS); regs = map_io(base, IOMMU_REGS);
if (regs == 0) { if (regs == NULL) {
DPRINTF("Cannot map IOMMU\n"); DPRINTF("Cannot map IOMMU\n");
for (;;) { } for (;;) { }
} }
@@ -505,7 +505,7 @@ iommu_init(struct iommu *t, uint64_t base)
/* Allocate IOMMU page table */ /* Allocate IOMMU page table */
/* Thremendous alignment causes great waste... */ /* Thremendous alignment causes great waste... */
ptsize = (t->vasize/PAGE_SIZE) * sizeof(int); ptsize = (t->vasize/PAGE_SIZE) * sizeof(int);
if ((ptab = mem_zalloc(&cmem, ptsize, ptsize)) == 0) { if ((ptab = mem_zalloc(&cmem, ptsize, ptsize)) == NULL) {
DPRINTF("Cannot allocate IOMMU table [0x%x]\n", ptsize); DPRINTF("Cannot allocate IOMMU table [0x%x]\n", ptsize);
for (;;) { } for (;;) { }
} }

View File

@@ -325,7 +325,7 @@ ob_eccmemctl_init(void)
} }
static unsigned char *nvram; static unsigned char *nvram;
ohwcfg_v3_t nv_info; static ohwcfg_v3_t nv_info;
#define NVRAM_OB_START (sizeof(ohwcfg_v3_t) + sizeof(struct sparc_arch_cfg)) #define NVRAM_OB_START (sizeof(ohwcfg_v3_t) + sizeof(struct sparc_arch_cfg))
#define NVRAM_OB_SIZE ((NVRAM_IDPROM - NVRAM_OB_START) & ~15) #define NVRAM_OB_SIZE ((NVRAM_IDPROM - NVRAM_OB_START) & ~15)
@@ -807,15 +807,6 @@ id_machine(uint16_t machine_id)
static void static void
ob_nvram_init(uint64_t base, uint64_t offset) ob_nvram_init(uint64_t base, uint64_t offset)
{ {
extern uint32_t kernel_image;
extern uint32_t kernel_size;
extern uint32_t qemu_cmdline;
extern uint32_t cmdline_size;
extern char boot_device;
extern char obp_stdin, obp_stdout;
extern const char *obp_stdin_path, *obp_stdout_path;
extern uint16_t graphic_depth;
const char *stdin, *stdout; const char *stdin, *stdout;
unsigned int i; unsigned int i;
char nographic; char nographic;

View File

@@ -79,7 +79,7 @@ void setup_timers(void)
* TODO: pass via lb table * TODO: pass via lb table
*/ */
unsigned long get_timer_freq() unsigned long get_timer_freq(void)
{ {
return 100000000 / 4; return 100000000 / 4;
} }

View File

@@ -14,6 +14,8 @@
#ifndef VGA_H_INCL #ifndef VGA_H_INCL
#define VGA_H_INCL 1 #define VGA_H_INCL 1
#include "video_subr.h"
//#include <cpu/p5/io.h> //#include <cpu/p5/io.h>
#define u8 unsigned char #define u8 unsigned char
@@ -226,9 +228,4 @@ struct screeninfo {
__u32 vmode; /* interlaced etc */ __u32 vmode; /* interlaced etc */
__u32 reserved[6]; /* Reserved for future compatibility */ __u32 reserved[6]; /* Reserved for future compatibility */
}; };
void vga_set_gmode (void);
void vga_set_amode (void);
void vga_font_load(unsigned char *vidmem, const unsigned char *font, int height,
int num_chars);
#endif #endif

View File

@@ -235,10 +235,10 @@ struct FSysBuffer {
#define rdsk(x) ((struct RigidDiskBlock *)(x)->blockbuffer) #define rdsk(x) ((struct RigidDiskBlock *)(x)->blockbuffer)
#define part(x) ((struct PartitionBlock *)(x)->blockbuffer) #define part(x) ((struct PartitionBlock *)(x)->blockbuffer)
struct FSysBuffer *fsysb; static struct FSysBuffer *fsysb;
int blockoffset; /* offset if there is an embedded RDB partition */ static int blockoffset; /* offset if there is an embedded RDB partition */
int rootb; /* block number of root block */ static int rootb; /* block number of root block */
int rdbb; /* block number of rdb block */ static int rdbb; /* block number of rdb block */
static void initCache(void) static void initCache(void)
{ {
@@ -357,7 +357,7 @@ unsigned long togo;
{ {
disk_read_func = disk_read_hook; disk_read_func = disk_read_hook;
cblock = getBlock(block); cblock = getBlock(block);
disk_read_func = 0; disk_read_func = NULL;
block = AROS_BE2LONG(extensionBlock(cblock)->extension); block = AROS_BE2LONG(extensionBlock(cblock)->extension);
togo--; togo--;
} }
@@ -383,7 +383,7 @@ unsigned int readbytes = 0;
len=fsysb->file.filesize-fsysb->file.current.offset; len=fsysb->file.filesize-fsysb->file.current.offset;
disk_read_func = disk_read_hook; disk_read_func = disk_read_hook;
cblock = getBlock(fsysb->file.current.block); cblock = getBlock(fsysb->file.current.block);
disk_read_func = 0; disk_read_func = NULL;
while (len) while (len)
{ {
disk_read_func = disk_read_hook; disk_read_func = disk_read_hook;
@@ -427,7 +427,7 @@ unsigned int readbytes = 0;
fsysb->file.current.byte = 0; fsysb->file.current.byte = 0;
fsysb->file.current.filekey--; fsysb->file.current.filekey--;
} }
disk_read_func = 0; disk_read_func = NULL;
len -= size; len -= size;
readbytes += size; readbytes += size;
} }
@@ -580,10 +580,9 @@ int block;
return 0; return 0;
} }
#ifndef STAGE1_5
static void checkPossibility(char *filename, char *bstr) static void checkPossibility(char *filename, char *bstr)
{ {
#ifndef STAGE1_5
char cstr[32]; char cstr[32];
if (noCaseStrCmp(filename, bstr, 1)<=0) if (noCaseStrCmp(filename, bstr, 1)<=0)
@@ -594,8 +593,10 @@ static void checkPossibility(char *filename, char *bstr)
cstr[bstr[0]]=0; cstr[bstr[0]]=0;
print_a_completion(cstr); print_a_completion(cstr);
} }
#endif
} }
#else
#define checkPossibility(a, b) do { } while(0)
#endif
int affs_dir(char *dirname) int affs_dir(char *dirname)
{ {

View File

@@ -468,7 +468,7 @@ ext2fs_read (char *buf, int len)
devread (map * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE), devread (map * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE),
offset, size, buf); offset, size, buf);
disk_read_func = 0; disk_read_func = NULL;
buf += size; buf += size;
len -= size; len -= size;

View File

@@ -53,8 +53,8 @@ static struct jfs_info jfs;
#define dtroot ((dtroot_t *)(&inode->di_btroot)) #define dtroot ((dtroot_t *)(&inode->di_btroot))
static ldtentry_t de_always[2] = { static ldtentry_t de_always[2] = {
{1, -1, 2, {'.', '.'}}, {1, -1, 2, {'.', '.'}, 0},
{1, -1, 1, {'.'}} {1, -1, 1, {'.'}, 0}
}; };
static int static int

View File

@@ -691,12 +691,12 @@ read_tree_node (unsigned int blockNr, int depth)
blockNr, depth); blockNr, depth);
#endif /* REISERDEBUG */ #endif /* REISERDEBUG */
if (! block_read (blockNr, 0, INFO->blocksize, cache)) if (! block_read (blockNr, 0, INFO->blocksize, cache))
return 0; return NULL;
/* Make sure it has the right node level */ /* Make sure it has the right node level */
if (BLOCKHEAD (cache)->blk_level != depth) if (BLOCKHEAD (cache)->blk_level != depth)
{ {
errnum = ERR_FSYS_CORRUPT; errnum = ERR_FSYS_CORRUPT;
return 0; return NULL;
} }
INFO->blocks[depth] = blockNr; INFO->blocks[depth] = blockNr;

View File

@@ -94,7 +94,7 @@ struct dmadat {
char sbbuf[SBLOCKSIZE]; /* superblock */ char sbbuf[SBLOCKSIZE]; /* superblock */
char secbuf[DEV_BSIZE]; /* for MBR/disklabel */ char secbuf[DEV_BSIZE]; /* for MBR/disklabel */
}; };
struct dmadat *dmadat = (struct dmadat*)FSYS_BUF; static struct dmadat *dmadat = (struct dmadat*)FSYS_BUF;
#define SUPERBLOCK ((struct fs*)dmadat->sbbuf) #define SUPERBLOCK ((struct fs*)dmadat->sbbuf)

View File

@@ -74,7 +74,7 @@ vstafs_readdir (long sector)
if (FILE_INFO->type != 2) if (FILE_INFO->type != 2)
{ {
errnum = ERR_FILE_NOT_FOUND; errnum = ERR_FILE_NOT_FOUND;
return 0; return NULL;
} }
a1 = FILE_INFO->blocks; a1 = FILE_INFO->blocks;
@@ -105,8 +105,8 @@ vstafs_nextdir (void)
} }
else else
{ {
/* errnum =ERR_FILE_NOT_FOUND; */ /* errnum =ERR_FILE_NOT_FOUND; */
return 0; return NULL;
} }
} }

View File

@@ -57,34 +57,34 @@ typedef struct fsys_entry {
static const struct fsys_entry fsys_table[] = { static const struct fsys_entry fsys_table[] = {
# ifdef CONFIG_FSYS_FAT # ifdef CONFIG_FSYS_FAT
{"fat", fat_mount, fat_read, fat_dir, 0, 0}, {"fat", fat_mount, fat_read, fat_dir, NULL, NULL},
# endif # endif
# ifdef CONFIG_FSYS_EXT2FS # ifdef CONFIG_FSYS_EXT2FS
{"ext2fs", ext2fs_mount, ext2fs_read, ext2fs_dir, 0, 0}, {"ext2fs", ext2fs_mount, ext2fs_read, ext2fs_dir, NULL, NULL},
# endif # endif
# ifdef CONFIG_FSYS_MINIX # ifdef CONFIG_FSYS_MINIX
{"minix", minix_mount, minix_read, minix_dir, 0, 0}, {"minix", minix_mount, minix_read, minix_dir, NULL, NULL},
# endif # endif
# ifdef CONFIG_FSYS_REISERFS # ifdef CONFIG_FSYS_REISERFS
{"reiserfs", reiserfs_mount, reiserfs_read, reiserfs_dir, 0, reiserfs_embed}, {"reiserfs", reiserfs_mount, reiserfs_read, reiserfs_dir, NULL, reiserfs_embed},
# endif # endif
# ifdef CONFIG_FSYS_JFS # ifdef CONFIG_FSYS_JFS
{"jfs", jfs_mount, jfs_read, jfs_dir, 0, jfs_embed}, {"jfs", jfs_mount, jfs_read, jfs_dir, NULL, jfs_embed},
# endif # endif
# ifdef CONFIG_FSYS_XFS # ifdef CONFIG_FSYS_XFS
{"xfs", xfs_mount, xfs_read, xfs_dir, 0, 0}, {"xfs", xfs_mount, xfs_read, xfs_dir, NULL, NULL},
# endif # endif
# ifdef CONFIG_FSYS_UFS # ifdef CONFIG_FSYS_UFS
{"ufs", ufs_mount, ufs_read, ufs_dir, 0, ufs_embed}, {"ufs", ufs_mount, ufs_read, ufs_dir, NULL, ufs_embed},
# endif # endif
# ifdef CONFIG_FSYS_ISO9660 # ifdef CONFIG_FSYS_ISO9660
{"iso9660", iso9660_mount, iso9660_read, iso9660_dir, 0, 0}, {"iso9660", iso9660_mount, iso9660_read, iso9660_dir, NULL, NULL},
# endif # endif
# ifdef CONFIG_FSYS_NTFS # ifdef CONFIG_FSYS_NTFS
{"ntfs", ntfs_mount, ntfs_read, ntfs_dir, 0, 0}, {"ntfs", ntfs_mount, ntfs_read, ntfs_dir, NULL, NULL},
# endif # endif
# ifdef CONFIG_FSYS_AFFS # ifdef CONFIG_FSYS_AFFS
{"affs", affs_mount, affs_read, affs_dir, 0, 0}, {"affs", affs_mount, affs_read, affs_dir, NULL, NULL},
# endif # endif
}; };
@@ -157,8 +157,9 @@ static int
grubfs_file_read( file_desc_t *fd, void *buf, size_t count ) grubfs_file_read( file_desc_t *fd, void *buf, size_t count )
{ {
grubfile_t *file = (grubfile_t*)fd; grubfile_t *file = (grubfile_t*)fd;
curfs = (grubfs_t *)file->fs->fs_data; int ret;
int ret;
curfs = (grubfs_t *)file->fs->fs_data;
filepos=file->pos; filepos=file->pos;
filemax=file->len; filemax=file->len;
@@ -186,8 +187,9 @@ static file_desc_t *
open_path( fs_ops_t *fs, const char *path ) open_path( fs_ops_t *fs, const char *path )
{ {
grubfile_t *ret = NULL; grubfile_t *ret = NULL;
char *s = (char *)path;
curfs = (grubfs_t *)fs->fs_data; curfs = (grubfs_t *)fs->fs_data;
char *s=(char *)path;
while(*s) { while(*s) {
if(*s=='\\') *s='/'; if(*s=='\\') *s='/';

View File

@@ -114,12 +114,6 @@ static inline node_buf* node_buf_get(node_cache* cache, int i)
{ {
return (node_buf*) (cache->buffers + (i * cache->nodebufsize)); return (node_buf*) (cache->buffers + (i * cache->nodebufsize));
} }
/* flush the cache NYI */
static void node_cache_flush(node_cache* cache)
{
// NYI
}
/* flush the node at index */ /* flush the node at index */
static void node_cache_flush_node(node_cache* cache, int index) static void node_cache_flush_node(node_cache* cache, int index)
@@ -132,7 +126,6 @@ static void node_cache_close(node_cache* cache)
{ {
if (!cache->entries) // not (fully) intialized ? if (!cache->entries) // not (fully) intialized ?
return; return;
node_cache_flush(cache);
free(cache->entries); free(cache->entries);
} }

View File

@@ -27,7 +27,6 @@
# include "hfs.h" # include "hfs.h"
# include "hfsp.h" # include "hfsp.h"
extern int errno;
/* Last error is eventually found here */ /* Last error is eventually found here */
extern const char *hfsp_error; extern const char *hfsp_error;

View File

@@ -114,8 +114,8 @@ volume_readfork(void *p, hfsp_fork_raw* f)
* *
* ToDo: add more consitency checks. * ToDo: add more consitency checks.
*/ */
static int static int
volume_readbuf(volume * vol, hfsp_vh* vh, char * p) volume_readbuf(hfsp_vh* vh, char * p)
{ {
if( (vh->signature = bswabU16_inc(p)) != HFSP_VOLHEAD_SIG) if( (vh->signature = bswabU16_inc(p)) != HFSP_VOLHEAD_SIG)
HFSP_ERROR(-1, "This is not a HFS+ volume"); HFSP_ERROR(-1, "This is not a HFS+ volume");
@@ -159,7 +159,7 @@ volume_read(volume * vol, hfsp_vh* vh, UInt32 block)
if( volume_readinbuf(vol, buf, block)) if( volume_readinbuf(vol, buf, block))
return -1; return -1;
return volume_readbuf(vol, vh, buf); return volume_readbuf(vh, buf);
} }
/* Find out wether the volume is wrapped and unwrap it eventually */ /* Find out wether the volume is wrapped and unwrap it eventually */
@@ -200,7 +200,7 @@ volume_read_wrapper(volume * vol, hfsp_vh* vh)
} }
else if( signature == HFSP_VOLHEAD_SIG) { /* Native HFS+ volume */ else if( signature == HFSP_VOLHEAD_SIG) { /* Native HFS+ volume */
p = buf; // Restore to begin of block p = buf; // Restore to begin of block
return volume_readbuf(vol, vh, p); return volume_readbuf(vh, p);
} else } else
HFSP_ERROR(-1, "Neither Wrapper nor native HFS+ volume header found"); HFSP_ERROR(-1, "Neither Wrapper nor native HFS+ volume header found");
fail: fail:

View File

@@ -100,5 +100,6 @@ typedef struct Elf_Nhdr
#define EB_IA64_IMAGE_HANDLE 0x00000007 #define EB_IA64_IMAGE_HANDLE 0x00000007
#define EB_I386_MEMMAP 0x00000008 #define EB_I386_MEMMAP 0x00000008
extern const struct elf_image_note elf_image_notes;
#endif /* ELF_BOOT_H */ #endif /* ELF_BOOT_H */

View File

@@ -17,6 +17,8 @@
#ifndef _H_STRING #ifndef _H_STRING
#define _H_STRING #define _H_STRING
#include "openbios/config.h"
#define bzero(s,n) memset( s, 0, n ) #define bzero(s,n) memset( s, 0, n )
#define atol(nptr) strtol(nptr, NULL, 10 ) #define atol(nptr) strtol(nptr, NULL, 10 )
@@ -95,5 +97,6 @@ static inline unsigned char __toupper(unsigned char c) {
#define tolower(c) __tolower(c) #define tolower(c) __tolower(c)
#define toupper(c) __toupper(c) #define toupper(c) __toupper(c)
extern int errno_int;
#endif /* _H_STRING */ #endif /* _H_STRING */

View File

@@ -13,6 +13,7 @@
#ifdef CONFIG_DRIVER_PCI #ifdef CONFIG_DRIVER_PCI
int ob_pci_init(void); int ob_pci_init(void);
void macio_nvram_init(char *path, uint32_t addr);
#endif #endif
#ifdef CONFIG_DRIVER_SBUS #ifdef CONFIG_DRIVER_SBUS
int ob_sbus_init(uint64_t base, int machine_id); int ob_sbus_init(uint64_t base, int machine_id);
@@ -38,6 +39,17 @@ int ob_obio_init(uint64_t slavio_base, unsigned long fd_offset,
int start_cpu(unsigned int pc, unsigned int context_ptr, unsigned int context, int start_cpu(unsigned int pc, unsigned int context_ptr, unsigned int context,
int cpu); int cpu);
extern struct mem cmem; extern struct mem cmem;
extern uint16_t graphic_depth;
extern volatile unsigned char *power_reg;
extern volatile unsigned int *reset_reg;
extern const char *obp_stdin_path, *obp_stdout_path;
extern char obp_stdin, obp_stdout;
extern volatile struct sun4m_timer_regs *counter_regs;
extern uint32_t kernel_image;
extern uint32_t kernel_size;
extern uint32_t qemu_cmdline;
extern uint32_t cmdline_size;
extern char boot_device;
#endif #endif
#ifdef CONFIG_DRIVER_FLOPPY #ifdef CONFIG_DRIVER_FLOPPY
int ob_floppy_init(void); int ob_floppy_init(void);

View File

@@ -18,7 +18,7 @@
#include "cross.h" #include "cross.h"
unsigned char *dict = 0; unsigned char *dict = NULL;
ucell *last; ucell *last;
cell dicthead = 0; cell dicthead = 0;

View File

@@ -24,7 +24,7 @@ extern ucell *trampoline;
* point behind the pointer. * point behind the pointer.
*/ */
static ucell t[] = { DOCOL, 0, (ucell)(t+3), 0 }; static ucell t[] = { DOCOL, 0, (ucell)(t+3), 0 };
ucell *trampoline = t; static ucell *trampoline = t;
#endif #endif
#ifndef CONFIG_DEBUG_INTERPRETER #ifndef CONFIG_DEBUG_INTERPRETER
@@ -287,7 +287,7 @@ static void doplusloop(void)
#ifndef FCOMPILER #ifndef FCOMPILER
static ucell get_myself(void) static ucell get_myself(void)
{ {
static ucell **myself = 0; static ucell **myself = NULL;
if( !myself ) if( !myself )
myself = (ucell**)findword("my-self") + 1; myself = (ucell**)findword("my-self") + 1;
return (*myself && **myself) ? (ucell)**myself : 0; return (*myself && **myself) ? (ucell)**myself : 0;

View File

@@ -17,7 +17,7 @@
#include "openbios/config.h" #include "openbios/config.h"
#include "libc/string.h" #include "libc/string.h"
int errno; int errno_int;
void void
qsort( void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void*) ) qsort( void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void*) )

View File

@@ -50,7 +50,7 @@ int strnicmp(const char *s1, const char *s2, size_t len)
return (int)c1 - (int)c2; return (int)c1 - (int)c2;
} }
char * ___strtok; static char * ___strtok;
/** /**
* strcpy - Copy a %NUL terminated string * strcpy - Copy a %NUL terminated string

View File

@@ -63,7 +63,7 @@ static char * number(char * buf, char * end, long long num, int base, int size,
if (type & LEFT) if (type & LEFT)
type &= ~ZEROPAD; type &= ~ZEROPAD;
if (base < 2 || base > 36) if (base < 2 || base > 36)
return 0; return NULL;
c = (type & ZEROPAD) ? '0' : ' '; c = (type & ZEROPAD) ? '0' : ' ';
sign = 0; sign = 0;
if (type & SIGN) { if (type & SIGN) {

View File

@@ -120,7 +120,7 @@ history_get( cmdline_info_t *ci, int n )
ci->buf[0] = 0; ci->buf[0] = 0;
if( !p ) if( !p )
return 0; return NULL;
for( len=0; len <= ci->ncol && p[len] != '\n' && p[len] ; len++ ) for( len=0; len <= ci->ncol && p[len] != '\n' && p[len] ; len++ )
; ;

View File

@@ -41,11 +41,13 @@ video_get_res( int *w, int *h )
static void static void
startup_splash( void ) startup_splash( void )
{ {
#ifdef CONFIG_MOL
int fd, s, i, y, x, dx, dy; int fd, s, i, y, x, dx, dy;
int width, height; int width, height;
char *pp, *p; char *pp, *p;
char buf[64]; char buf[64];
#endif
/* only draw logo in 24-bit mode (for now) */ /* only draw logo in 24-bit mode (for now) */
if( video.fb.depth < 15 ) if( video.fb.depth < 15 )
return; return;
@@ -247,7 +249,7 @@ static void
video_write(void) video_write(void)
{ {
char *addr; char *addr;
int i, len; int len;
len = GETTOS(); len = GETTOS();
addr = pop_fstr_copy(); addr = pop_fstr_copy();