Changeset 437ee6a4 in mainline


Ignore:
Timestamp:
2005-10-30T13:49:39Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
df91be5
Parents:
2cd0485d
Message:

sparc64 work.
Add context_save(), context_set() and context_restore().
Remove putchar() definition from ofw.c.
Add sparc64 putchar().
Add ppc32 putchar() (i.e. the original ofw.c putchar()).
Make arg.h use the builtin va_* constructs.

Files:
7 added
14 edited

Legend:

Unmodified
Added
Removed
  • arch/mips32/include/arg.h

    r2cd0485d r437ee6a4  
    3030#define __mips32_ARG_H__
    3131
    32 //#include <stackarg.h>
    33 
    3432#include <arch/types.h>
    3533
     
    4038
    4139#define va_start(ap, lst)               \
    42         (ap).pos = sizeof(lst);                         \
     40        (ap).pos = sizeof(lst);         \
    4341        (ap).last = (__u8 *) &(lst)
    4442
    4543/**
    46 * va_arg macro for MIPS32 - problem is that 64 bit values must be aligned on an 8-byte boundary (32bit values not)
    47 * To satisfy this, paddings must be sometimes inserted.
    48 */
     44 * va_arg macro for MIPS32 - problem is that 64 bit values must be aligned on an 8-byte boundary (32bit values not)
     45 * To satisfy this, paddings must be sometimes inserted.
     46 */
    4947#define va_arg(ap, type)                \
    5048        (*((type *)((ap).last + ((ap).pos  += sizeof(type) + ((sizeof(type)==8)&&(((ap).pos)&(4))?4:0)) - sizeof(type))))
  • arch/ppc32/Makefile.inc

    r2cd0485d r437ee6a4  
    1919
    2020arch_sources= \
     21        src/arch/console.c \
    2122        src/arch/context.S \
    2223        src/arch/debug/panic.s \
  • arch/sparc64/Makefile.inc

    r2cd0485d r437ee6a4  
    1515
    1616DEFS=-DARCH=$(ARCH)
    17 CFLAGS=$(DEFS) -nostdlib -fno-builtin -O2
     17CFLAGS=$(DEFS) -nostdlib -fno-builtin -mcpu=ultrasparc -m64 -O2
    1818LFLAGS=-M -no-check-sections -N
    1919
    2020arch_sources= \
     21        src/arch/asm.S \
     22        src/arch/console.c \
     23        src/arch/context.S \
    2124        src/arch/dummy.s \
     25        src/arch/sparc64.c \
    2226        src/arch/start.S \
    23         src/arch/sparc64.c
     27        src/arch/mm/frame.c \
     28        src/arch/mm/page.c
     29       
    2430
  • arch/sparc64/_link.ld

    r2cd0485d r437ee6a4  
    3131                LONG(kdata_end - kdata_start);
    3232                hardcoded_load_address = .;
    33                 LONG(0x4000);
     33                QUAD(0x4000);
    3434                *(.bss);                /* uninitialized static variables */   
    3535                *(COMMON);              /* global variables */
  • arch/sparc64/include/arg.h

    r2cd0485d r437ee6a4  
    3030#define __sparc64_ARG_H__
    3131
    32 #include <stackarg.h>
     32#include <stdarg.h>
    3333
    3434#endif
  • arch/sparc64/include/asm.h

    r2cd0485d r437ee6a4  
    7979static inline __address get_stack_base(void)
    8080{
     81        __address v;
     82       
     83        __asm__ volatile ("and %%o6, %1, %0\n" : "=r" (v) : "r" (~(STACK_SIZE-1)));
     84       
     85        return v;
    8186}
    8287
  • arch/sparc64/include/context.h

    r2cd0485d r437ee6a4  
    3030#define __sparc64_CONTEXT_H__
    3131
    32 #include <arch/types.h>
    33 #include <typedefs.h>
    34 #include <align.h>
     32#ifndef __sparc64_TYPES_H__
     33# include <arch/types.h>
     34#endif
    3535
     36#ifndef __ALIGN_H__
     37# include <align.h>
     38#endif
     39
     40#define STACK_ALIGNMENT                 8
    3641#define STACK_ITEM_SIZE                 8
    3742
     
    4146#define SP_DELTA        (0+STACK_ITEM_SIZE)
    4247
     48#ifdef context_set
     49#undef context_set
     50#endif
     51
     52#define context_set(c, _pc, stack, size)                                                                \
     53        (c)->pc = ((__address) _pc) - 8;                                                                \
     54        (c)->sp = ((__address) stack) + (ALIGN((size), STACK_ALIGNMENT) + 1) - SP_DELTA;                       
     55
    4356/*
    4457 * Only save registers that must be preserved across
     
    4659 */
    4760struct context {
    48 
    49         __address bsp;
    50         __address sp;
    51         __address pc;
     61        __u64 l0;
     62        __u64 l1;
     63        __u64 l2;
     64        __u64 l3;
     65        __u64 l4;
     66        __u64 l5;
     67        __u64 l6;
     68        __u64 l7;
     69        __u64 i1;
     70        __u64 i2;
     71        __u64 i3;
     72        __u64 i4;
     73        __u64 i5;
     74        __address sp;           /* %i6 */
     75        __address pc;           /* %i7 */
    5276        ipl_t ipl;
    53 } __attribute__ ((packed));
     77};
    5478
    5579#endif
  • arch/sparc64/include/types.h

    r2cd0485d r437ee6a4  
    3636typedef unsigned char __u8;
    3737typedef unsigned short __u16;
    38 typedef unsigned long __u32;
    39 typedef long long __u64;
     38typedef unsigned int __u32;
     39typedef unsigned long __u64;
    4040
    4141typedef __u64 __address;
  • arch/sparc64/src/dummy.s

    r2cd0485d r437ee6a4  
    3131.global asm_delay_loop
    3232.global before_thread_runs_arch
    33 .global context_restore_arch
    34 .global context_save_arch
    3533.global cpu_arch_init
    3634.global cpu_halt
     
    4745.global fpu_enable
    4846.global fpu_init
    49 .global frame_arch_init
    50 .global memcpy
    51 .global memsetb
    52 .global page_arch_init
    5347.global panic_printf
    5448.global userspace
     
    5852asm_delay_loop:
    5953before_thread_runs_arch:
    60 context_restore_arch:
    61 context_save_arch:
    6254cpu_arch_init:
    6355cpu_halt:
     
    7466fpu_enable:
    7567fpu_init:
    76 frame_arch_init:
    77 memcpy:
    78 memsetb:
    79 page_arch_init:
    8068panic_printf:
    8169userspace:
  • arch/sparc64/src/start.S

    r2cd0485d r437ee6a4  
    2727#
    2828
     29.register %g2, #scratch
     30.register %g3, #scratch
     31.register %g6, #scratch
     32.register %g7, #scratch
     33
    2934.section K_TEXT_START, "ax"
    3035
     
    5257        nop
    5358
     59        call main_bsp
     60        nop
     61
     62        /* Not reached. */
     63
    54642:
    5565        b 2b
    5666        nop
    57 
  • build.sparc64

    r2cd0485d r437ee6a4  
    11#! /bin/sh
    22
     3# Generate context_offset.h
     4(cd tools/sparc64/;make gencontext;./gencontext)
     5
    36make all ARCH=sparc64
  • clean.sparc64

    r2cd0485d r437ee6a4  
    22
    33make dist-clean ARCH=sparc64
     4
     5rm tools/sparc64/gencontext
     6rm arch/sparc64/include/context_offset.h
  • genarch/include/firmware/ofw/ofw.h

    r2cd0485d r437ee6a4  
    2727 */
    2828
    29 #ifndef __ppc32_OFW_H__
    30 #define __ppc32_OFW_H__
     29#ifndef __OFW_H__
     30#define __OFW_H__
    3131
    3232#include <arch/types.h>
     
    5959extern int ofw_get_property(const phandle device, const char *name, void *buf, const int buflen);
    6060extern void *ofw_claim(const void *addr, const int size, const int align);
    61 extern void putchar(const char ch);
    6261
    6362#endif
  • genarch/src/firmware/ofw/ofw.c

    r2cd0485d r437ee6a4  
    9999        return (void *) ofw_call("claim", 3, 1, addr, size, align);
    100100}
    101 
    102 void putchar(const char ch)
    103 {
    104         ofw_putchar(ch);
    105 }
Note: See TracChangeset for help on using the changeset viewer.