diff options
author | dfr <dfr@FreeBSD.org> | 2000-10-04 17:53:03 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 2000-10-04 17:53:03 +0000 |
commit | 5135c38a27d3cf791a98f149db31afd9e1a5294a (patch) | |
tree | 3a6ede195decd815dd3beddc3900c7b50bab5f32 /sys/ia64/include | |
parent | a8379965c23bf71569dbac1e3f5c49bc1a1eea6d (diff) | |
download | FreeBSD-src-5135c38a27d3cf791a98f149db31afd9e1a5294a.zip FreeBSD-src-5135c38a27d3cf791a98f149db31afd9e1a5294a.tar.gz |
Next round of fixes to the ia64 code. This includes simulated clock and
disk drivers along with a load of fixes to context switching, fork
handling and a load of other stuff I can't remember now. This takes us as
far as start_init() before it dies. I guess now I will have to finish off
the VM system and syscall handling :-).
Diffstat (limited to 'sys/ia64/include')
-rw-r--r-- | sys/ia64/include/asm.h | 75 | ||||
-rw-r--r-- | sys/ia64/include/ia64_cpu.h | 160 | ||||
-rw-r--r-- | sys/ia64/include/mutex.h | 25 | ||||
-rw-r--r-- | sys/ia64/include/pal.h | 4 | ||||
-rw-r--r-- | sys/ia64/include/pcb.h | 1 | ||||
-rw-r--r-- | sys/ia64/include/proc.h | 1 | ||||
-rw-r--r-- | sys/ia64/include/profile.h | 68 | ||||
-rw-r--r-- | sys/ia64/include/reg.h | 6 | ||||
-rw-r--r-- | sys/ia64/include/signal.h | 10 | ||||
-rw-r--r-- | sys/ia64/include/vmparam.h | 10 |
10 files changed, 213 insertions, 147 deletions
diff --git a/sys/ia64/include/asm.h b/sys/ia64/include/asm.h index 3e7f2f9..a0742f3 100644 --- a/sys/ia64/include/asm.h +++ b/sys/ia64/include/asm.h @@ -67,90 +67,48 @@ #endif /* - * LEAF + * ENTRY * Declare a global leaf function. * A leaf function does not call other functions. */ -#define LEAF(_name_, _n_args_) \ +#define ENTRY(_name_, _n_args_) \ .global _name_; \ + .align 16; \ .proc _name_; \ _name_:; \ .regstk _n_args_, 0, 0, 0 \ MCOUNT -#define LEAF_NOPROFILE(_name_, _n_args_) \ +#define ENTRY_NOPROFILE(_name_, _n_args_) \ .global _name_; \ + .align 16; \ .proc _name_; \ _name_:; \ .regstk _n_args_, 0, 0, 0 /* - * STATIC_LEAF + * STATIC_ENTRY * Declare a local leaf function. */ -#define STATIC_LEAF(_name_, _n_args_) \ +#define STATIC_ENTRY(_name_, _n_args_) \ + .align 16; \ .proc _name_; \ _name_:; \ .regstk _n_args_, 0, 0, 0 \ MCOUNT /* - * XLEAF + * XENTRY * Global alias for a leaf function, or alternate entry point */ -#define XLEAF(_name_) \ +#define XENTRY(_name_) \ .globl _name_; \ _name_: /* - * STATIC_XLEAF + * STATIC_XENTRY * Local alias for a leaf function, or alternate entry point */ -#define STATIC_XLEAF(_name_) \ -_name_: - -/* - * NESTED - * Declare a (global) nested function - * A nested function calls other functions and needs - * to use alloc to save registers. - */ -#define NESTED(_name_,_n_args_) \ - .globl _name_; \ - .proc _name_; \ -_name_:; \ - .regstk _n_args_, 0, 0, 0 \ - MCOUNT - -#define NESTED_NOPROFILE(_name_,_n_args_) \ - .globl _name_; \ - .proc _name_; \ -_name_:; \ - .regstk _n_args_, 0, 0, 0 - -/* - * STATIC_NESTED - * Declare a local nested function. - */ -#define STATIC_NESTED(_name_,_n_args_) \ - .proc _name_; \ -_name_:; \ - .regstk _n_args_, 0, 0, 0 \ - MCOUNT - -/* - * XNESTED - * Same as XLEAF, for a nested function. - */ -#define XNESTED(_name_) \ - .globl _name_; \ -_name_: - - -/* - * STATIC_XNESTED - * Same as STATIC_XLEAF, for a nested function. - */ -#define STATIC_XNESTED(_name_) \ +#define STATIC_XENTRY(_name_) \ _name_: @@ -201,10 +159,11 @@ _name_ = _value_ * Allocate space for a message (a read-only ascii string) */ #define ASCIZ .asciz -#define MSG(msg,reg,label) \ - lda reg, label; \ - .data; \ -label: ASCIZ msg; \ +#define MSG(msg,reg,label) \ + addl reg,@ltoff(label),gp;; \ + ld8 reg=[reg];; \ + .data; \ +label: ASCIZ msg; \ .text; /* diff --git a/sys/ia64/include/ia64_cpu.h b/sys/ia64/include/ia64_cpu.h index 4de9938..1639e88 100644 --- a/sys/ia64/include/ia64_cpu.h +++ b/sys/ia64/include/ia64_cpu.h @@ -183,6 +183,166 @@ ia64_tpa(u_int64_t va) } /* + * Read the value of ar.k0. + */ +static __inline u_int64_t +ia64_get_k0(void) +{ + u_int64_t result; + __asm __volatile("mov %0=ar.k0" : "=r" (result)); + return result; +} + +/* + * Read the value of ar.k1. + */ +static __inline u_int64_t +ia64_get_k1(void) +{ + u_int64_t result; + __asm __volatile("mov %0=ar.k1" : "=r" (result)); + return result; +} + +/* + * Read the value of ar.k2. + */ +static __inline u_int64_t +ia64_get_k2(void) +{ + u_int64_t result; + __asm __volatile("mov %0=ar.k2" : "=r" (result)); + return result; +} + +/* + * Read the value of ar.k3. + */ +static __inline u_int64_t +ia64_get_k3(void) +{ + u_int64_t result; + __asm __volatile("mov %0=ar.k3" : "=r" (result)); + return result; +} + +/* + * Read the value of ar.k4. + */ +static __inline u_int64_t +ia64_get_k4(void) +{ + u_int64_t result; + __asm __volatile("mov %0=ar.k4" : "=r" (result)); + return result; +} + +/* + * Read the value of ar.k5. + */ +static __inline u_int64_t +ia64_get_k5(void) +{ + u_int64_t result; + __asm __volatile("mov %0=ar.k5" : "=r" (result)); + return result; +} + +/* + * Read the value of ar.k6. + */ +static __inline u_int64_t +ia64_get_k6(void) +{ + u_int64_t result; + __asm __volatile("mov %0=ar.k6" : "=r" (result)); + return result; +} + +/* + * Read the value of ar.k7. + */ +static __inline u_int64_t +ia64_get_k7(void) +{ + u_int64_t result; + __asm __volatile("mov %0=ar.k7" : "=r" (result)); + return result; +} + +/* + * Write the value of ar.k0. + */ +static __inline void +ia64_set_k0(u_int64_t v) +{ + __asm __volatile("mov ar.k0=%0" :: "r" (v)); +} + +/* + * Write the value of ar.k1. + */ +static __inline void +ia64_set_k1(u_int64_t v) +{ + __asm __volatile("mov ar.k1=%0" :: "r" (v)); +} + +/* + * Write the value of ar.k2. + */ +static __inline void +ia64_set_k2(u_int64_t v) +{ + __asm __volatile("mov ar.k2=%0" :: "r" (v)); +} + +/* + * Write the value of ar.k3. + */ +static __inline void +ia64_set_k3(u_int64_t v) +{ + __asm __volatile("mov ar.k3=%0" :: "r" (v)); +} + +/* + * Write the value of ar.k4. + */ +static __inline void +ia64_set_k4(u_int64_t v) +{ + __asm __volatile("mov ar.k4=%0" :: "r" (v)); +} + +/* + * Write the value of ar.k5. + */ +static __inline void +ia64_set_k5(u_int64_t v) +{ + __asm __volatile("mov ar.k5=%0" :: "r" (v)); +} + +/* + * Write the value of ar.k6. + */ +static __inline void +ia64_set_k6(u_int64_t v) +{ + __asm __volatile("mov ar.k6=%0" :: "r" (v)); +} + +/* + * Write the value of ar.k7. + */ +static __inline void +ia64_set_k7(u_int64_t v) +{ + __asm __volatile("mov ar.k7=%0" :: "r" (v)); +} + +/* * Read the value of ar.itc. */ static __inline u_int64_t diff --git a/sys/ia64/include/mutex.h b/sys/ia64/include/mutex.h index b858079..ea81a8b 100644 --- a/sys/ia64/include/mutex.h +++ b/sys/ia64/include/mutex.h @@ -536,7 +536,9 @@ _mtx_exit(struct mtx *mtxp, int type, const char *file, int line) #define MTX_ENTER(lck, rPSR, rOLD, rNEW, rLCK) \ mov rPSR=psr ; \ mov rNEW=globalp ; \ - mov rLCK=lck+MTX_LOCK ;; \ + addl rLCK=@ltoff(lck),gp ;; \ + ld8 rLCK=[rLCK] ;; \ + add rLCK=MTX_LOCK,rLCK ;; \ rsm psr.i ; \ mov ar.ccv=MTX_UNOWNED ; \ add rNEW=PC_CURPROC,rNEW ;; \ @@ -544,18 +546,19 @@ _mtx_exit(struct mtx *mtxp, int type, const char *file, int line) 1: cmpxchg8.acq rOLD=[rLCK],rNEW,ar.ccv ;; \ cmp.eq p1,p0=MTX_UNOWNED,rOLD ;; \ (p1) br.cond.spnt.few 1b ;; \ - mov rLCK=lck+MTX_SAVEPSR ;; \ + addl rLCK=@ltoff(lck),gp ;; \ + ld8 rLCK=[rLCK] ;; \ + add rLCK=MTX_SAVEPSR,rLCK ;; \ st4 [rLCK]=rPSR -#define MTX_EXIT(lck, rTMP, rLCK) \ - mov rTMP=MTX_UNOWNED ; \ - addl rLCK=@ltoff(lck),gp;; \ - add rLCK=MTX_LOCK,rLCK;; \ - st8.rel [rLCK]=rTMP ;; \ - addl rLCK=@ltoff(lck),gp;; \ - add rLCK=MTX_SAVEPSR,rLCK;; \ - ld4 rTMP=[rLCK] ;; \ - mov psr.l=rTMP ;; \ +#define MTX_EXIT(lck, rTMP, rLCK) \ + mov rTMP=MTX_UNOWNED ; \ + addl rLCK=@ltoff(lck),gp;; \ + ld8 rLCK=[rLCK];; \ + add rLCK=MTX_LOCK,rLCK;; \ + st8.rel [rLCK]=rTMP,MTX_SAVEPSR-MTX_LOCK ;; \ + ld4 rTMP=[rLCK] ;; \ + mov psr.l=rTMP ;; \ srlz.d #endif /* !LOCORE */ diff --git a/sys/ia64/include/pal.h b/sys/ia64/include/pal.h index 39c12a4..f492608 100644 --- a/sys/ia64/include/pal.h +++ b/sys/ia64/include/pal.h @@ -88,8 +88,8 @@ struct ia64_pal_result { }; extern struct ia64_pal_result - ia64_call_pal_static(u_int64_t proc, u_int64_t arg1, - u_int64_t arg2, u_int64_t arg3); + ia64_call_pal(u_int64_t proc, u_int64_t arg1, + u_int64_t arg2, u_int64_t arg3); #endif /* _MACHINE_PAL_H_ */ diff --git a/sys/ia64/include/pcb.h b/sys/ia64/include/pcb.h index d8679ca..49a5c54 100644 --- a/sys/ia64/include/pcb.h +++ b/sys/ia64/include/pcb.h @@ -58,6 +58,7 @@ struct pcb { u_int64_t pcb_unat; /* ar.unat for r4..r7 */ u_int64_t pcb_rnat; u_int64_t pcb_pr; /* predicates */ + u_int64_t pcb_schednest; /* sched_lock state */ u_int64_t pcb_onfault; /* for copy faults */ u_int64_t pcb_accessaddr; /* for [fs]uswintr */ diff --git a/sys/ia64/include/proc.h b/sys/ia64/include/proc.h index 226aa94..4aa8566 100644 --- a/sys/ia64/include/proc.h +++ b/sys/ia64/include/proc.h @@ -37,6 +37,7 @@ struct mdproc { u_long md_flags; + vm_offset_t md_bspstore; /* initial ar.bspstore */ struct trapframe *md_tf; /* trap/syscall registers */ }; diff --git a/sys/ia64/include/profile.h b/sys/ia64/include/profile.h index 57fbb69..70a9cf7 100644 --- a/sys/ia64/include/profile.h +++ b/sys/ia64/include/profile.h @@ -136,74 +136,8 @@ LX99: SETGP(pv) #define MCOUNT __asm (" \ .globl _mcount; \ - .ent _mcount 0; \ + .proc _mcount; \ _mcount:; \ - .frame $30,0,$26; \ - .set noat; \ - .set noreorder; \ - \ - lda $30, -192($30); \ - \ - stq $28, 0($30); \ - stq $0, 8($30); \ - stq $1, 16($30); \ - stq $2, 24($30); \ - stq $3, 32($30); \ - stq $4, 40($30); \ - stq $5, 48($30); \ - stq $6, 56($30); \ - stq $7, 64($30); \ - stq $8, 72($30); \ - stq $15, 80($30); \ - stq $16, 88($30); \ - stq $17, 96($30); \ - stq $18, 104($30); \ - stq $19, 112($30); \ - stq $20, 120($30); \ - stq $21, 128($30); \ - stq $22, 136($30); \ - stq $23, 144($30); \ - stq $24, 152($30); \ - stq $25, 160($30); \ - stq $26, 168($30); \ - stq $27, 176($30); \ - stq $29, 184($30); \ - \ - br $27, LX98; \ -LX98: ldgp $29,0($27); \ - mov $26, $16; \ - mov $28, $17; \ - jsr $26,mcount; \ - ldgp $29,0($26); \ - \ - ldq $0, 8($30); \ - ldq $1, 16($30); \ - ldq $2, 24($30); \ - ldq $3, 32($30); \ - ldq $4, 40($30); \ - ldq $5, 48($30); \ - ldq $6, 56($30); \ - ldq $7, 64($30); \ - ldq $8, 72($30); \ - ldq $15, 80($30); \ - ldq $16, 88($30); \ - ldq $17, 96($30); \ - ldq $18, 104($30); \ - ldq $19, 112($30); \ - ldq $20, 120($30); \ - ldq $21, 128($30); \ - ldq $22, 136($30); \ - ldq $23, 144($30); \ - ldq $24, 152($30); \ - ldq $25, 160($30); \ - ldq $26, 168($30); \ - ldq $27, 176($30); \ - ldq $29, 184($30); \ - \ - ldq $28, 0($30); \ - \ - lda $30, 192($30); \ - ret $31, ($28), 1; \ \ .end _mcount"); diff --git a/sys/ia64/include/reg.h b/sys/ia64/include/reg.h index 7378e37..302cd6a 100644 --- a/sys/ia64/include/reg.h +++ b/sys/ia64/include/reg.h @@ -29,10 +29,16 @@ #ifndef _MACHINE_REG_H_ #define _MACHINE_REG_H_ +#ifndef _IA64_FPREG_DEFINED + struct ia64_fpreg { u_int64_t fpr_bits[2]; } __attribute__ ((aligned (16))); +#define _IA64_FPREG_DEFINED + +#endif + struct reg { u_int64_t r_regs[128]; }; diff --git a/sys/ia64/include/signal.h b/sys/ia64/include/signal.h index 5474941..006a99b 100644 --- a/sys/ia64/include/signal.h +++ b/sys/ia64/include/signal.h @@ -35,6 +35,16 @@ typedef long sig_atomic_t; #ifndef _ANSI_SOURCE +#ifndef _IA64_FPREG_DEFINED + +struct ia64_fpreg { + unsigned long fpr_bits[2]; +} __attribute__ ((aligned (16))); + +#define _IA64_FPREG_DEFINED + +#endif + /* * Information pushed on stack when a signal is delivered. * This is used by the kernel to restore state following diff --git a/sys/ia64/include/vmparam.h b/sys/ia64/include/vmparam.h index 2cdc959..1c9c245 100644 --- a/sys/ia64/include/vmparam.h +++ b/sys/ia64/include/vmparam.h @@ -54,15 +54,7 @@ * kernel stack. */ #define USRTEXT CLBYTES -/* #define USRSTACK VM_MAXUSER_ADDRESS */ - -/* - * This stack location is suitable for OSF1 emulation. Some OSF - * programs are built as 32bit and assume that the stack is reachable - * with a 32bit value. OSF1 manages to have a variable location for - * the user stack which we should probably also support. - */ -#define USRSTACK (0x12000000LL - (UPAGES*PAGE_SIZE)) +#define USRSTACK VM_MAXUSER_ADDRESS /* * Virtual memory related constants, all in bytes |