This commit is contained in:
dsl 2006-08-19 16:27:57 +00:00
parent c8da0759cd
commit a30325d38e
2 changed files with 50 additions and 75 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.39 2006/06/07 22:37:14 kardel Exp $ */ /* $NetBSD: machdep.c,v 1.40 2006/08/19 16:27:57 dsl Exp $ */
/*- /*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -72,7 +72,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.39 2006/06/07 22:37:14 kardel Exp $"); __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.40 2006/08/19 16:27:57 dsl Exp $");
#include "opt_user_ldt.h" #include "opt_user_ldt.h"
#include "opt_ddb.h" #include "opt_ddb.h"
@ -208,8 +208,8 @@ struct vm_map *phys_map = NULL;
extern paddr_t avail_start, avail_end; extern paddr_t avail_start, avail_end;
void (*delay_func) __P((int)) = i8254_delay; void (*delay_func)(int) = i8254_delay;
void (*initclock_func) __P((void)) = i8254_initclocks; void (*initclock_func)(void) = i8254_initclocks;
#ifdef MTRR #ifdef MTRR
struct mtrr_funcs *mtrr_funcs; struct mtrr_funcs *mtrr_funcs;
@ -223,17 +223,17 @@ int mem_cluster_cnt;
char x86_64_doubleflt_stack[4096]; char x86_64_doubleflt_stack[4096];
int cpu_dump __P((void)); int cpu_dump(void);
int cpu_dumpsize __P((void)); int cpu_dumpsize(void);
u_long cpu_dump_mempagecnt __P((void)); u_long cpu_dump_mempagecnt(void);
void dumpsys __P((void)); void dumpsys(void);
void init_x86_64 __P((paddr_t)); void init_x86_64(paddr_t);
/* /*
* Machine-dependent startup code * Machine-dependent startup code
*/ */
void void
cpu_startup() cpu_startup(void)
{ {
int x; int x;
vaddr_t minaddr, maxaddr; vaddr_t minaddr, maxaddr;
@ -332,8 +332,7 @@ x86_64_proc0_tss_ldt_init(void)
*/ */
void void
x86_64_init_pcb_tss_ldt(ci) x86_64_init_pcb_tss_ldt(struct cpu_info *ci)
struct cpu_info *ci;
{ {
int x; int x;
struct pcb *pcb = ci->ci_idle_pcb; struct pcb *pcb = ci->ci_idle_pcb;
@ -547,9 +546,7 @@ int waittime = -1;
struct pcb dumppcb; struct pcb dumppcb;
void void
cpu_reboot(howto, bootstr) cpu_reboot(int howto, char *bootstr)
int howto;
char *bootstr;
{ {
if (cold) { if (cold) {
@ -623,7 +620,7 @@ long dumplo = 0; /* blocks */
* cpu_dumpsize: calculate size of machine-dependent kernel core dump headers. * cpu_dumpsize: calculate size of machine-dependent kernel core dump headers.
*/ */
int int
cpu_dumpsize() cpu_dumpsize(void)
{ {
int size; int size;
@ -639,7 +636,7 @@ cpu_dumpsize()
* cpu_dump_mempagecnt: calculate the size of RAM (in pages) to be dumped. * cpu_dump_mempagecnt: calculate the size of RAM (in pages) to be dumped.
*/ */
u_long u_long
cpu_dump_mempagecnt() cpu_dump_mempagecnt(void)
{ {
u_long i, n; u_long i, n;
@ -653,9 +650,9 @@ cpu_dump_mempagecnt()
* cpu_dump: dump the machine-dependent kernel core dump headers. * cpu_dump: dump the machine-dependent kernel core dump headers.
*/ */
int int
cpu_dump() cpu_dump(void)
{ {
int (*dump) __P((dev_t, daddr_t, caddr_t, size_t)); int (*dump)(dev_t, daddr_t, caddr_t, size_t);
char buf[dbtob(1)]; char buf[dbtob(1)];
kcore_seg_t *segp; kcore_seg_t *segp;
cpu_kcore_hdr_t *cpuhdrp; cpu_kcore_hdr_t *cpuhdrp;
@ -706,7 +703,7 @@ cpu_dump()
* reduce the chance that swapping trashes it. * reduce the chance that swapping trashes it.
*/ */
void void
cpu_dumpconf() cpu_dumpconf(void)
{ {
const struct bdevsw *bdev; const struct bdevsw *bdev;
int nblks, dumpblks; /* size of dump area */ int nblks, dumpblks; /* size of dump area */
@ -751,8 +748,7 @@ cpu_dumpconf()
static vaddr_t dumpspace; static vaddr_t dumpspace;
vaddr_t vaddr_t
reserve_dumppages(p) reserve_dumppages(vaddr_t p)
vaddr_t p;
{ {
dumpspace = p; dumpspace = p;
@ -760,14 +756,14 @@ reserve_dumppages(p)
} }
void void
dumpsys() dumpsys(void)
{ {
const struct bdevsw *bdev; const struct bdevsw *bdev;
u_long totalbytesleft, bytes, i, n, memseg; u_long totalbytesleft, bytes, i, n, memseg;
u_long maddr; u_long maddr;
int psize; int psize;
daddr_t blkno; daddr_t blkno;
int (*dump) __P((dev_t, daddr_t, caddr_t, size_t)); int (*dump)(dev_t, daddr_t, caddr_t, size_t);
int error; int error;
/* Save registers. */ /* Save registers. */
@ -880,10 +876,7 @@ dumpsys()
* Clear registers on exec * Clear registers on exec
*/ */
void void
setregs(l, pack, stack) setregs(struct lwp *l, struct exec_package *pack, u_long stack)
struct lwp *l;
struct exec_package *pack;
u_long stack;
{ {
struct pcb *pcb = &l->l_addr->u_pcb; struct pcb *pcb = &l->l_addr->u_pcb;
struct trapframe *tf; struct trapframe *tf;
@ -935,10 +928,7 @@ char *gdtstore;
extern struct user *proc0paddr; extern struct user *proc0paddr;
void void
setgate(gd, func, ist, type, dpl, sel) setgate(struct gate_descriptor *gd, void *func, int ist, int type, int dpl, int sel)
struct gate_descriptor *gd;
void *func;
int ist, type, dpl, sel;
{ {
pmap_changeprot_local(idt_vaddr, VM_PROT_READ|VM_PROT_WRITE); pmap_changeprot_local(idt_vaddr, VM_PROT_READ|VM_PROT_WRITE);
@ -958,8 +948,7 @@ setgate(gd, func, ist, type, dpl, sel)
} }
void void
unsetgate(gd) unsetgate( struct gate_descriptor *gd)
struct gate_descriptor *gd;
{ {
pmap_changeprot_local(idt_vaddr, VM_PROT_READ|VM_PROT_WRITE); pmap_changeprot_local(idt_vaddr, VM_PROT_READ|VM_PROT_WRITE);
@ -969,10 +958,7 @@ unsetgate(gd)
} }
void void
setregion(rd, base, limit) setregion(struct region_descriptor *rd, void *base, u_int16_t limit)
struct region_descriptor *rd;
void *base;
u_int16_t limit;
{ {
rd->rd_limit = limit; rd->rd_limit = limit;
rd->rd_base = (u_int64_t)base; rd->rd_base = (u_int64_t)base;
@ -982,11 +968,8 @@ setregion(rd, base, limit)
* Note that the base and limit fields are ignored in long mode. * Note that the base and limit fields are ignored in long mode.
*/ */
void void
set_mem_segment(sd, base, limit, type, dpl, gran, def32, is64) set_mem_segment(struct mem_segment_descriptor *sd, void *base, size_t limit,
struct mem_segment_descriptor *sd; int type, int dpl, int gran, int def32, int is64)
void *base;
size_t limit;
int type, dpl, gran, is64;
{ {
sd->sd_lolimit = (unsigned)limit; sd->sd_lolimit = (unsigned)limit;
sd->sd_lobase = (unsigned long)base; sd->sd_lobase = (unsigned long)base;
@ -1002,11 +985,8 @@ set_mem_segment(sd, base, limit, type, dpl, gran, def32, is64)
} }
void void
set_sys_segment(sd, base, limit, type, dpl, gran) set_sys_segment(struct sys_segment_descriptor *sd, void *base, size_t limit,
struct sys_segment_descriptor *sd; int type, int dpl, int gran)
void *base;
size_t limit;
int type, dpl, gran;
{ {
memset(sd, 0, sizeof *sd); memset(sd, 0, sizeof *sd);
sd->sd_lolimit = (unsigned)limit; sd->sd_lolimit = (unsigned)limit;
@ -1019,7 +999,8 @@ set_sys_segment(sd, base, limit, type, dpl, gran)
sd->sd_hibase = (u_int64_t)base >> 24; sd->sd_hibase = (u_int64_t)base >> 24;
} }
void cpu_init_idt() void
cpu_init_idt(void)
{ {
struct region_descriptor region; struct region_descriptor region;
@ -1029,7 +1010,7 @@ void cpu_init_idt()
#define IDTVEC(name) __CONCAT(X, name) #define IDTVEC(name) __CONCAT(X, name)
typedef void (vector) __P((void)); typedef void (vector)(void);
extern vector IDTVEC(syscall); extern vector IDTVEC(syscall);
extern vector IDTVEC(syscall32); extern vector IDTVEC(syscall32);
#if defined(COMPAT_16) || defined(COMPAT_NETBSD32) #if defined(COMPAT_16) || defined(COMPAT_NETBSD32)
@ -1043,10 +1024,9 @@ extern vector *IDTVEC(exceptions)[];
#define KBTOB(x) ((size_t)(x) * 1024UL) #define KBTOB(x) ((size_t)(x) * 1024UL)
void void
init_x86_64(first_avail) init_x86_64(paddr_t first_avail)
paddr_t first_avail;
{ {
extern void consinit __P((void)); extern void consinit(void);
extern struct extent *iomem_ex; extern struct extent *iomem_ex;
struct region_descriptor region; struct region_descriptor region;
struct mem_segment_descriptor *ldt_segp; struct mem_segment_descriptor *ldt_segp;
@ -1553,7 +1533,7 @@ init_x86_64(first_avail)
} }
void void
cpu_reset() cpu_reset(void)
{ {
disable_intr(); disable_intr();
@ -1755,7 +1735,7 @@ check_mcontext(struct lwp *l, const mcontext_t *mcp, struct trapframe *tf)
} }
void void
cpu_initclocks() cpu_initclocks(void)
{ {
(*initclock_func)(); (*initclock_func)();
} }
@ -1777,9 +1757,7 @@ need_resched(struct cpu_info *ci)
*/ */
int int
idt_vec_alloc(low, high) idt_vec_alloc(int low, int high)
int low;
int high;
{ {
int vec; int vec;
@ -1796,9 +1774,7 @@ idt_vec_alloc(low, high)
} }
void void
idt_vec_set(vec, function) idt_vec_set(int vec, void (*function)(void))
int vec;
void (*function) __P((void));
{ {
/* /*
* Vector should be allocated, so no locking needed. * Vector should be allocated, so no locking needed.
@ -1809,8 +1785,7 @@ idt_vec_set(vec, function)
} }
void void
idt_vec_free(vec) idt_vec_free(int vec)
int vec;
{ {
simple_lock(&idt_lock); simple_lock(&idt_lock);
unsetgate(&idt[vec]); unsetgate(&idt[vec]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: segments.h,v 1.6 2005/12/11 12:16:25 christos Exp $ */ /* $NetBSD: segments.h,v 1.7 2006/08/19 16:27:58 dsl Exp $ */
/*- /*-
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -205,17 +205,17 @@ extern struct gate_descriptor *idt;
extern char *gdtstore; extern char *gdtstore;
extern char *ldtstore; extern char *ldtstore;
void setgate __P((struct gate_descriptor *, void *, int, int, int, int)); void setgate(struct gate_descriptor *, void *, int, int, int, int);
void unsetgate __P((struct gate_descriptor *)); void unsetgate(struct gate_descriptor *);
void setregion __P((struct region_descriptor *, void *, u_int16_t)); void setregion(struct region_descriptor *, void *, u_int16_t);
void set_sys_segment __P((struct sys_segment_descriptor *, void *, size_t, void set_sys_segment(struct sys_segment_descriptor *, void *, size_t,
int, int, int)); int, int, int);
void set_mem_segment __P((struct mem_segment_descriptor *, void *, size_t, void set_mem_segment(struct mem_segment_descriptor *, void *, size_t,
int, int, int, int, int)); int, int, int, int, int);
int idt_vec_alloc __P((int, int)); int idt_vec_alloc(int, int);
void idt_vec_set __P((int, void (*)(void))); void idt_vec_set(int, void (*)(void));
void idt_vec_free __P((int)); void idt_vec_free(int);
void cpu_init_idt __P((void)); void cpu_init_idt(void);
struct lwp; struct lwp;
int memseg_baseaddr(struct lwp *, uint64_t, char *, int, uint64_t *); int memseg_baseaddr(struct lwp *, uint64_t, char *, int, uint64_t *);