summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/mem.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-05-01 01:05:25 +0000
committerpeter <peter@FreeBSD.org>2003-05-01 01:05:25 +0000
commit45949ccde13fb04ed597a5aef80b678ba16bcab7 (patch)
treedd665cefeba0e426ad2b212b76851de96f1ad18b /sys/amd64/amd64/mem.c
parent1fd7bc609e9a5249f7b7b558405e1c39aca79796 (diff)
downloadFreeBSD-src-45949ccde13fb04ed597a5aef80b678ba16bcab7.zip
FreeBSD-src-45949ccde13fb04ed597a5aef80b678ba16bcab7.tar.gz
Commit MD parts of a loosely functional AMD64 port. This is based on
a heavily stripped down FreeBSD/i386 (brutally stripped down actually) to attempt to get a stable base to start from. There is a lot missing still. Worth noting: - The kernel runs at 1GB in order to cheat with the pmap code. pmap uses a variation of the PAE code in order to avoid having to worry about 4 levels of page tables yet. - It boots in 64 bit "long mode" with a tiny trampoline embedded in the i386 loader. This simplifies locore.s greatly. - There are still quite a few fragments of i386-specific code that have not been translated yet, and some that I cheated and wrote dumb C versions of (bcopy etc). - It has both int 0x80 for syscalls (but using registers for argument passing, as is native on the amd64 ABI), and the 'syscall' instruction for syscalls. int 0x80 preserves all registers, 'syscall' does not. - I have tried to minimize looking at the NetBSD code, except in a couple of places (eg: to find which register they use to replace the trashed %rcx register in the syscall instruction). As a result, there is not a lot of similarity. I did look at NetBSD a few times while debugging to get some ideas about what I might have done wrong in my first attempt.
Diffstat (limited to 'sys/amd64/amd64/mem.c')
-rw-r--r--sys/amd64/amd64/mem.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c
index 8ec934f..38a6e13 100644
--- a/sys/amd64/amd64/mem.c
+++ b/sys/amd64/amd64/mem.c
@@ -98,7 +98,7 @@ mmclose(dev_t dev, int flags, int fmt, struct thread *td)
{
switch (minor(dev)) {
case 14:
- td->td_frame->tf_eflags &= ~PSL_IOPL;
+ td->td_frame->tf_rflags &= ~PSL_IOPL;
}
return (0);
}
@@ -124,7 +124,7 @@ mmopen(dev_t dev, int flags, int fmt, struct thread *td)
error = securelevel_gt(td->td_ucred, 0);
if (error != 0)
return (error);
- td->td_frame->tf_eflags |= PSL_IOPL;
+ td->td_frame->tf_rflags |= PSL_IOPL;
break;
}
return (0);
@@ -135,7 +135,7 @@ static int
mmrw(dev_t dev, struct uio *uio, int flags)
{
int o;
- u_int c = 0, v;
+ u_long c = 0, v;
struct iovec *iov;
int error = 0;
vm_offset_t addr, eaddr;
@@ -159,7 +159,7 @@ mmrw(dev_t dev, struct uio *uio, int flags)
v &= ~PAGE_MASK;
pmap_kenter((vm_offset_t)ptvmmap, v);
o = (int)uio->uio_offset & PAGE_MASK;
- c = (u_int)(PAGE_SIZE - ((int)iov->iov_base & PAGE_MASK));
+ c = (u_long)(PAGE_SIZE - ((long)iov->iov_base & PAGE_MASK));
c = min(c, (u_int)(PAGE_SIZE - o));
c = min(c, (u_int)iov->iov_len);
error = uiomove((caddr_t)&ptvmmap[o], (int)c, uio);
@@ -177,17 +177,17 @@ mmrw(dev_t dev, struct uio *uio, int flags)
addr = trunc_page(uio->uio_offset);
eaddr = round_page(uio->uio_offset + c);
- if (addr < (vm_offset_t)VADDR(PTDPTDI, 0))
+ if (addr < (vm_offset_t)VADDR(0, 0, PTDPTDI, 0))
return (EFAULT);
for (; addr < eaddr; addr += PAGE_SIZE)
if (pmap_extract(kernel_pmap, addr) == 0)
return (EFAULT);
- if (!kernacc((caddr_t)(int)uio->uio_offset, c,
+ if (!kernacc((caddr_t)(long)uio->uio_offset, c,
uio->uio_rw == UIO_READ ?
VM_PROT_READ : VM_PROT_WRITE))
return (EFAULT);
- error = uiomove((caddr_t)(int)uio->uio_offset, (int)c, uio);
+ error = uiomove((caddr_t)(long)uio->uio_offset, (int)c, uio);
continue;
default:
@@ -317,15 +317,6 @@ mem_range_attr_set(struct mem_range_desc *mrd, int *arg)
return (mem_range_softc.mr_op->set(&mem_range_softc, mrd, arg));
}
-#ifdef SMP
-void
-mem_range_AP_init(void)
-{
- if (mem_range_softc.mr_op && mem_range_softc.mr_op->initAP)
- (mem_range_softc.mr_op->initAP(&mem_range_softc));
-}
-#endif
-
static int
mem_modevent(module_t mod, int type, void *data)
{
OpenPOWER on IntegriCloud