1/* $FreeBSD: head/sys/ia64/include/cpu.h 107206 2002-11-24 20:15:08Z marcel $ */
2/* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */
3
4/*
5 * Copyright (c) 1988 University of Utah.
6 * Copyright (c) 1982, 1990, 1993
7 * The Regents of the University of California. All rights reserved.
8 *
9 * This code is derived from software contributed to Berkeley by
--- 31 unchanged lines hidden (view full) ---
41 * from: Utah $Hdr: cpu.h 1.16 91/03/25$
42 *
43 * @(#)cpu.h 8.4 (Berkeley) 1/5/94
44 */
45
46#ifndef _MACHINE_CPU_H_
47#define _MACHINE_CPU_H_
48
49/*
50 * Exported definitions unique to Alpha cpu support.
51 */
52
53#include <machine/frame.h>
54
55#define cpu_getstack(td) ((td)->td_frame->tf_r[FRAME_SP])
56
57/*
58 * Arguments to hardclock and gatherstats encapsulate the previous
59 * machine state in an opaque clockframe. One the Alpha, we use
60 * what we push on an interrupt (a trapframe).
61 */
62struct clockframe {
63 struct trapframe cf_tf;
64};
65#define TRAPF_USERMODE(framep) \
66 (((framep)->tf_cr_ipsr & IA64_PSR_CPL) == IA64_PSR_CPL_USER)
67#define TRAPF_PC(framep) ((framep)->tf_cr_iip)
68
69#define CLKF_USERMODE(framep) TRAPF_USERMODE(&(framep)->cf_tf)
70#define CLKF_PC(framep) TRAPF_PC(&(framep)->cf_tf)
71
72/*
73 * CTL_MACHDEP definitions.
74 */
75#define CPU_CONSDEV 1 /* dev_t: console terminal device */
76#define CPU_ROOT_DEVICE 2 /* string: root device name */
77#define CPU_UNALIGNED_PRINT 3 /* int: print unaligned accesses */
78#define CPU_UNALIGNED_FIX 4 /* int: fix unaligned accesses */
79#define CPU_UNALIGNED_SIGBUS 5 /* int: SIGBUS unaligned accesses */
--- 22 unchanged lines hidden (view full) ---
102struct thread;
103struct reg;
104struct rpb;
105struct trapframe;
106
107extern struct rpb *hwrpb;
108extern volatile int mc_expected, mc_received;
109
110int badaddr (void *, size_t);
111int badaddr_read(void *, size_t, void *);
112u_int64_t console_restart(u_int64_t, u_int64_t, u_int64_t);
113void do_sir(void);
114void dumpconf(void);
115void exception_restore(void); /* MAGIC */
116void frametoreg(struct trapframe *, struct reg *);
117long fswintrberr(void); /* MAGIC */
118int ia64_pa_access(u_long);
119void ia64_init(u_int64_t, u_int64_t);
120void ia64_fpstate_check(struct thread *p);
121void ia64_fpstate_save(struct thread *p, int write);
122void ia64_fpstate_drop(struct thread *p);
123void ia64_fpstate_switch(struct thread *p);
124void init_prom_interface(struct rpb*);
125void interrupt(u_int64_t, struct trapframe *);
126void machine_check
127 (unsigned long, struct trapframe *, unsigned long, unsigned long);
128u_int64_t hwrpb_checksum(void);
129void hwrpb_restart_setup(void);
130void regdump(struct trapframe *);
131void regtoframe(struct reg *, struct trapframe *);
132void set_iointr(void (*)(void *, unsigned long));
133void fork_trampoline(void); /* MAGIC */
134void syscall(int, u_int64_t *, struct trapframe *);
135void trap(int vector, int imm, struct trapframe *framep);
136void ia64_probe_sapics(void);
137int ia64_count_cpus(void);
138void map_pal_code(void);
139void map_port_space(void);
140void cpu_mp_add(uint, uint, uint);
141
142/*
143 * Return contents of in-cpu fast counter as a sort of "bogo-time"
144 * for non-critical timing.
145 */
146static __inline u_int64_t
147get_cyclecount(void)
148{
149 return (ia64_get_itc());
150}
151
152#endif /* _KERNEL */
153
154#endif /* _MACHINE_CPU_H_ */
2/* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */
3
4/*
5 * Copyright (c) 1988 University of Utah.
6 * Copyright (c) 1982, 1990, 1993
7 * The Regents of the University of California. All rights reserved.
8 *
9 * This code is derived from software contributed to Berkeley by
--- 31 unchanged lines hidden (view full) ---
41 * from: Utah $Hdr: cpu.h 1.16 91/03/25$
42 *
43 * @(#)cpu.h 8.4 (Berkeley) 1/5/94
44 */
45
46#ifndef _MACHINE_CPU_H_
47#define _MACHINE_CPU_H_
48
49/*
50 * Exported definitions unique to Alpha cpu support.
51 */
52
53#include <machine/frame.h>
54
55#define cpu_getstack(td) ((td)->td_frame->tf_r[FRAME_SP])
56
57/*
58 * Arguments to hardclock and gatherstats encapsulate the previous
59 * machine state in an opaque clockframe. One the Alpha, we use
60 * what we push on an interrupt (a trapframe).
61 */
62struct clockframe {
63 struct trapframe cf_tf;
64};
65#define TRAPF_USERMODE(framep) \
66 (((framep)->tf_cr_ipsr & IA64_PSR_CPL) == IA64_PSR_CPL_USER)
67#define TRAPF_PC(framep) ((framep)->tf_cr_iip)
68
69#define CLKF_USERMODE(framep) TRAPF_USERMODE(&(framep)->cf_tf)
70#define CLKF_PC(framep) TRAPF_PC(&(framep)->cf_tf)
71
72/*
73 * CTL_MACHDEP definitions.
74 */
75#define CPU_CONSDEV 1 /* dev_t: console terminal device */
76#define CPU_ROOT_DEVICE 2 /* string: root device name */
77#define CPU_UNALIGNED_PRINT 3 /* int: print unaligned accesses */
78#define CPU_UNALIGNED_FIX 4 /* int: fix unaligned accesses */
79#define CPU_UNALIGNED_SIGBUS 5 /* int: SIGBUS unaligned accesses */
--- 22 unchanged lines hidden (view full) ---
102struct thread;
103struct reg;
104struct rpb;
105struct trapframe;
106
107extern struct rpb *hwrpb;
108extern volatile int mc_expected, mc_received;
109
110int badaddr (void *, size_t);
111int badaddr_read(void *, size_t, void *);
112u_int64_t console_restart(u_int64_t, u_int64_t, u_int64_t);
113void do_sir(void);
114void dumpconf(void);
115void exception_restore(void); /* MAGIC */
116void frametoreg(struct trapframe *, struct reg *);
117long fswintrberr(void); /* MAGIC */
118int ia64_pa_access(u_long);
119void ia64_init(u_int64_t, u_int64_t);
120void ia64_fpstate_check(struct thread *p);
121void ia64_fpstate_save(struct thread *p, int write);
122void ia64_fpstate_drop(struct thread *p);
123void ia64_fpstate_switch(struct thread *p);
124void init_prom_interface(struct rpb*);
125void interrupt(u_int64_t, struct trapframe *);
126void machine_check
127 (unsigned long, struct trapframe *, unsigned long, unsigned long);
128u_int64_t hwrpb_checksum(void);
129void hwrpb_restart_setup(void);
130void regdump(struct trapframe *);
131void regtoframe(struct reg *, struct trapframe *);
132void set_iointr(void (*)(void *, unsigned long));
133void fork_trampoline(void); /* MAGIC */
134void syscall(int, u_int64_t *, struct trapframe *);
135void trap(int vector, int imm, struct trapframe *framep);
136void ia64_probe_sapics(void);
137int ia64_count_cpus(void);
138void map_pal_code(void);
139void map_port_space(void);
140void cpu_mp_add(uint, uint, uint);
141
142/*
143 * Return contents of in-cpu fast counter as a sort of "bogo-time"
144 * for non-critical timing.
145 */
146static __inline u_int64_t
147get_cyclecount(void)
148{
149 return (ia64_get_itc());
150}
151
152#endif /* _KERNEL */
153
154#endif /* _MACHINE_CPU_H_ */