diff --git a/arch/sparc64/boot.h b/arch/sparc64/boot.h index eb768ff..176a28f 100644 --- a/arch/sparc64/boot.h +++ b/arch/sparc64/boot.h @@ -22,6 +22,7 @@ int linux_load(struct sys_info *info, const char *file, const char *cmdline); int fcode_load(const char *filename); // context.c +extern struct context *__context; uint64_t start_elf(uint64_t entry_point, uint64_t param); // boot.c @@ -33,5 +34,8 @@ extern uint64_t cmdline_size; extern char boot_device; void boot(void); +// sys_info.c +extern unsigned int qemu_mem_size; + // console.c void ob_su_init(uint64_t base, uint64_t offset, int intr); diff --git a/arch/sparc64/openbios.c b/arch/sparc64/openbios.c index 85965f4..92a31cf 100644 --- a/arch/sparc64/openbios.c +++ b/arch/sparc64/openbios.c @@ -44,7 +44,7 @@ static unsigned char intdict[256 * 1024]; #define NVRAM_OB_START (sizeof(ohwcfg_v3_t) + sizeof(struct sparc_arch_cfg)) #define NVRAM_OB_SIZE ((NVRAM_IDPROM - NVRAM_OB_START) & ~15) -ohwcfg_v3_t nv_info; +static ohwcfg_v3_t nv_info; #define OBIO_CMDLINE_MAX 256 static char obio_cmdline[OBIO_CMDLINE_MAX]; @@ -105,7 +105,7 @@ spitfire_translate(unsigned long virt, unsigned long *p_phys, for (i = 0; i < 64; i++) { data = spitfire_get_dtlb_data(i); - if (data & 0x8000000000000000) { // Valid entry? + if (data & 0x8000000000000000ULL) { // Valid entry? switch ((data >> 61) & 3) { default: case 0x0: // 8k @@ -127,7 +127,7 @@ spitfire_translate(unsigned long virt, unsigned long *p_phys, } tag = spitfire_get_dtlb_tag(i); if ((virt & mask) == (tag & mask)) { - phys = data & mask & 0x000001fffffff000; + phys = data & mask & 0x000001fffffff000ULL; phys |= virt & ~mask; *p_phys = phys; *p_data = data & 0xfff; diff --git a/drivers/cuda.c b/drivers/cuda.c index f9834ab..6fbca25 100644 --- a/drivers/cuda.c +++ b/drivers/cuda.c @@ -156,7 +156,6 @@ DECLARE_UNNAMED_NODE(ob_cuda, INSTALL_OPEN, sizeof(int)); static void ob_cuda_initialize (int *idx) { - extern phandle_t pic_handle; phandle_t ph=get_cur_dev(); int props[2]; diff --git a/drivers/cuda.h b/drivers/cuda.h index 1137ffa..b812d17 100644 --- a/drivers/cuda.h +++ b/drivers/cuda.h @@ -14,5 +14,6 @@ enum { CHARDEV_LAST, }; +extern phandle_t pic_handle; cuda_t *cuda_init (const char *path, uint32_t base); diff --git a/drivers/floppy.c b/drivers/floppy.c index 9beead0..81b7a96 100644 --- a/drivers/floppy.c +++ b/drivers/floppy.c @@ -194,11 +194,11 @@ DECLARE_UNNAMED_NODE( ob_floppy, INSTALL_OPEN, 2*sizeof(int) ); /* * FDC state */ -struct drive_state { +static struct drive_state { unsigned track; } drive_state[1]; -struct floppy_fdc_state { +static struct floppy_fdc_state { int in_sync; int spec1; /* spec1 value last used */ int spec2; /* spec2 value last used */ diff --git a/drivers/vga_load_regs.c b/drivers/vga_load_regs.c index 7c2f86b..e3634d3 100644 --- a/drivers/vga_load_regs.c +++ b/drivers/vga_load_regs.c @@ -26,8 +26,6 @@ static int vga_decode_var(const struct screeninfo *var, struct vga_par *par); static int vga_set_regs(const struct vga_par *par); -extern const u8 VgaLookupTable[]; - u8 read_seq_b(u16 addr) { outb(addr,SEQ_I); return inb(SEQ_D); @@ -322,6 +320,77 @@ static int vga_decode_var(const struct screeninfo *var, return 0; } +// +// originally from the stpc web site +// +static const unsigned char VgaLookupTable[3 * 0x3f + 3] = { + // Red Green Blue + 0x000, 0x000, 0x000, // 00h + 0x000, 0x000, 0x02A, // 01h + 0x000, 0x02A, 0x000, // 02h + 0x000, 0x02A, 0x02A, // 03h + 0x02A, 0x000, 0x000, // 04h + 0x02A, 0x000, 0x02A, // 05h + 0x02A, 0x02A, 0x000, // 06h + 0x02A, 0x02A, 0x02A, // 07h + 0x000, 0x000, 0x015, // 08h + 0x000, 0x000, 0x03F, // 09h + 0x000, 0x02A, 0x015, // 0Ah + 0x000, 0x02A, 0x03F, // 0Bh + 0x02A, 0x000, 0x015, // 0Ch + 0x02A, 0x000, 0x03F, // 0Dh + 0x02A, 0x02A, 0x015, // 0Eh + 0x02A, 0x02A, 0x03F, // 0Fh + 0x000, 0x015, 0x000, // 10h + 0x000, 0x015, 0x02A, // 11h + 0x000, 0x03F, 0x000, // 12h + 0x000, 0x03F, 0x02A, // 13h + 0x02A, 0x015, 0x000, // 14h + 0x02A, 0x015, 0x02A, // 15h + 0x02A, 0x03F, 0x000, // 16h + 0x02A, 0x03F, 0x02A, // 17h + 0x000, 0x015, 0x015, // 18h + 0x000, 0x015, 0x03F, // 19h + 0x000, 0x03F, 0x015, // 1Ah + 0x000, 0x03F, 0x03F, // 1Bh + 0x02A, 0x015, 0x015, // 1Ch + 0x02A, 0x015, 0x03F, // 1Dh + 0x02A, 0x03F, 0x015, // 1Eh + 0x02A, 0x03F, 0x03F, // 1Fh + 0x015, 0x000, 0x000, // 20h + 0x015, 0x000, 0x02A, // 21h + 0x015, 0x02A, 0x000, // 22h + 0x015, 0x02A, 0x02A, // 23h + 0x03F, 0x000, 0x000, // 24h + 0x03F, 0x000, 0x02A, // 25h + 0x03F, 0x02A, 0x000, // 26h + 0x03F, 0x02A, 0x02A, // 27h + 0x015, 0x000, 0x015, // 28h + 0x015, 0x000, 0x03F, // 29h + 0x015, 0x02A, 0x015, // 2Ah + 0x015, 0x02A, 0x03F, // 2Bh + 0x03F, 0x000, 0x015, // 2Ch + 0x03F, 0x000, 0x03F, // 2Dh + 0x03F, 0x02A, 0x015, // 2Eh + 0x03F, 0x02A, 0x03F, // 2Fh + 0x015, 0x015, 0x000, // 30h + 0x015, 0x015, 0x02A, // 31h + 0x015, 0x03F, 0x000, // 32h + 0x015, 0x03F, 0x02A, // 33h + 0x03F, 0x015, 0x000, // 34h + 0x03F, 0x015, 0x02A, // 35h + 0x03F, 0x03F, 0x000, // 36h + 0x03F, 0x03F, 0x02A, // 37h + 0x015, 0x015, 0x015, // 38h + 0x015, 0x015, 0x03F, // 39h + 0x015, 0x03F, 0x015, // 3Ah + 0x015, 0x03F, 0x03F, // 3Bh + 0x03F, 0x015, 0x015, // 3Ch + 0x03F, 0x015, 0x03F, // 3Dh + 0x03F, 0x03F, 0x015, // 3Eh + 0x03F, 0x03F, 0x03F, // 3Fh +}; + /* * From the Linux kernel. * orig by Ben Pfaff and Petr Vandrovec. diff --git a/include/openbios/stack.h b/include/openbios/stack.h index 90cfee4..e9733ef 100644 --- a/include/openbios/stack.h +++ b/include/openbios/stack.h @@ -69,7 +69,7 @@ static inline ducell DPOP(void) { return du; #else ducell du; - du = ((ducell) ((ucell) dstack[dstackcnt--]) << bitspercell); + du = ((ducell)(ucell) dstack[dstackcnt--]) << bitspercell; du |= (ucell) dstack[dstackcnt--]; return du; #endif diff --git a/include/sparc32/types.h b/include/sparc32/types.h index bd168a1..9493a5d 100644 --- a/include/sparc32/types.h +++ b/include/sparc32/types.h @@ -32,8 +32,8 @@ typedef long long int64_t; typedef int32_t cell; typedef uint32_t ucell; -typedef int64_t dcell; -typedef uint64_t ducell; +typedef long long dcell; +typedef unsigned long long ducell; #define bitspercell (sizeof(cell)<<3) #define bitsperdcell (sizeof(dcell)<<3) diff --git a/kernel/bootstrap.c b/kernel/bootstrap.c index 5595c6e..0cbb784 100644 --- a/kernel/bootstrap.c +++ b/kernel/bootstrap.c @@ -34,14 +34,14 @@ #define TRAMPOLINE_SIZE (4*sizeof(cell)) /* 4 cells for the trampoline */ /* state variables */ -ucell *latest, *state, *base; -ucell *memory; +static ucell *latest, *state, *base; +static ucell *memory; ucell *trampoline; /* local variables */ static int errors = 0; static int segfault = 0; -int verbose = 0; +static int verbose = 0; static FILE *srcfiles[128]; static unsigned int cursrc = 0; @@ -57,7 +57,7 @@ struct include_path { include *next; }; -include includes = { ".", NULL }; +static include includes = { ".", NULL }; static ucell * relocation_address=NULL; static int relocation_length=0; @@ -1074,7 +1074,7 @@ int main(int argc, char *argv[]) sa.sa_sigaction = segv_handler; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_SIGINFO | SA_NODEFER; - sigaction(SIGSEGV, &sa, 0); + sigaction(SIGSEGV, &sa, NULL); if (verbose) printk("done.\n"); diff --git a/kernel/include/dict.h b/kernel/include/dict.h index 48ace81..9332ffb 100644 --- a/kernel/include/dict.h +++ b/kernel/include/dict.h @@ -44,5 +44,8 @@ extern ucell PC; extern unsigned char *dict; extern cell dicthead; extern ucell *last; +#ifdef FCOMPILER +extern ucell *trampoline; +#endif #endif diff --git a/kernel/internal.c b/kernel/internal.c index 416c4e1..f18ecc8 100644 --- a/kernel/internal.c +++ b/kernel/internal.c @@ -17,9 +17,7 @@ extern void * const words[]; ucell PC; volatile int runforth = 0; -#ifdef FCOMPILER -extern ucell *trampoline; -#else +#ifndef FCOMPILER /* instead of pointing to an explicit 0 variable we * point behind the pointer. */ diff --git a/modules/font_8x16.c b/modules/font_8x16.c index a3c8d03..fe0deed 100644 --- a/modules/font_8x16.c +++ b/modules/font_8x16.c @@ -4621,73 +4621,3 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = { 0x00, /* 00000000 */ }; -// -// originally from the stpc web site -// -const unsigned char VgaLookupTable[3 * 0x3f + 3] = { - // Red Green Blue - 0x000, 0x000, 0x000, // 00h - 0x000, 0x000, 0x02A, // 01h - 0x000, 0x02A, 0x000, // 02h - 0x000, 0x02A, 0x02A, // 03h - 0x02A, 0x000, 0x000, // 04h - 0x02A, 0x000, 0x02A, // 05h - 0x02A, 0x02A, 0x000, // 06h - 0x02A, 0x02A, 0x02A, // 07h - 0x000, 0x000, 0x015, // 08h - 0x000, 0x000, 0x03F, // 09h - 0x000, 0x02A, 0x015, // 0Ah - 0x000, 0x02A, 0x03F, // 0Bh - 0x02A, 0x000, 0x015, // 0Ch - 0x02A, 0x000, 0x03F, // 0Dh - 0x02A, 0x02A, 0x015, // 0Eh - 0x02A, 0x02A, 0x03F, // 0Fh - 0x000, 0x015, 0x000, // 10h - 0x000, 0x015, 0x02A, // 11h - 0x000, 0x03F, 0x000, // 12h - 0x000, 0x03F, 0x02A, // 13h - 0x02A, 0x015, 0x000, // 14h - 0x02A, 0x015, 0x02A, // 15h - 0x02A, 0x03F, 0x000, // 16h - 0x02A, 0x03F, 0x02A, // 17h - 0x000, 0x015, 0x015, // 18h - 0x000, 0x015, 0x03F, // 19h - 0x000, 0x03F, 0x015, // 1Ah - 0x000, 0x03F, 0x03F, // 1Bh - 0x02A, 0x015, 0x015, // 1Ch - 0x02A, 0x015, 0x03F, // 1Dh - 0x02A, 0x03F, 0x015, // 1Eh - 0x02A, 0x03F, 0x03F, // 1Fh - 0x015, 0x000, 0x000, // 20h - 0x015, 0x000, 0x02A, // 21h - 0x015, 0x02A, 0x000, // 22h - 0x015, 0x02A, 0x02A, // 23h - 0x03F, 0x000, 0x000, // 24h - 0x03F, 0x000, 0x02A, // 25h - 0x03F, 0x02A, 0x000, // 26h - 0x03F, 0x02A, 0x02A, // 27h - 0x015, 0x000, 0x015, // 28h - 0x015, 0x000, 0x03F, // 29h - 0x015, 0x02A, 0x015, // 2Ah - 0x015, 0x02A, 0x03F, // 2Bh - 0x03F, 0x000, 0x015, // 2Ch - 0x03F, 0x000, 0x03F, // 2Dh - 0x03F, 0x02A, 0x015, // 2Eh - 0x03F, 0x02A, 0x03F, // 2Fh - 0x015, 0x015, 0x000, // 30h - 0x015, 0x015, 0x02A, // 31h - 0x015, 0x03F, 0x000, // 32h - 0x015, 0x03F, 0x02A, // 33h - 0x03F, 0x015, 0x000, // 34h - 0x03F, 0x015, 0x02A, // 35h - 0x03F, 0x03F, 0x000, // 36h - 0x03F, 0x03F, 0x02A, // 37h - 0x015, 0x015, 0x015, // 38h - 0x015, 0x015, 0x03F, // 39h - 0x015, 0x03F, 0x015, // 3Ah - 0x015, 0x03F, 0x03F, // 3Bh - 0x03F, 0x015, 0x015, // 3Ch - 0x03F, 0x015, 0x03F, // 3Dh - 0x03F, 0x03F, 0x015, // 3Eh - 0x03F, 0x03F, 0x03F, // 3Fh -};