4 #include <minix/callnr.h>
6 #include <minix/config.h>
7 #include <minix/const.h>
9 #include <minix/endpoint.h>
10 #include <minix/keymap.h>
11 #include <minix/minlib.h>
12 #include <minix/type.h>
13 #include <minix/ipc.h>
14 #include <minix/sysutil.h>
15 #include <minix/syslib.h>
16 #include <minix/bitmap.h>
29 /*===========================================================================*
31 *===========================================================================*/
32 PUBLIC vir_bytes
arch_map2vir(struct vmproc
*vmp
, vir_bytes addr
)
34 vir_bytes textstart
= CLICK2ABS(vmp
->vm_arch
.vm_seg
[T
].mem_phys
);
35 vir_bytes datastart
= CLICK2ABS(vmp
->vm_arch
.vm_seg
[D
].mem_phys
);
37 /* Could be a text address. */
38 vm_assert(datastart
<= addr
|| textstart
<= addr
);
40 return addr
- datastart
;
43 /*===========================================================================*
45 *===========================================================================*/
46 PUBLIC
char *arch_map2str(struct vmproc
*vmp
, vir_bytes addr
)
48 static char bufstr
[100];
49 vir_bytes textstart
= CLICK2ABS(vmp
->vm_arch
.vm_seg
[T
].mem_phys
);
50 vir_bytes textend
= textstart
+ CLICK2ABS(vmp
->vm_arch
.vm_seg
[T
].mem_len
);
51 vir_bytes datastart
= CLICK2ABS(vmp
->vm_arch
.vm_seg
[D
].mem_phys
);
53 if(addr
< textstart
) {
54 sprintf(bufstr
, "<lin:0x%lx>", addr
);
55 } else if(addr
< datastart
) {
56 sprintf(bufstr
, "0x%lx (codeseg)", addr
- textstart
);
58 sprintf(bufstr
, "0x%lx (dataseg)", addr
- datastart
);
64 /*===========================================================================*
66 *===========================================================================*/
67 PUBLIC vir_bytes
arch_addrok(struct vmproc
*vmp
, vir_bytes addr
)
69 vir_bytes textstart
= CLICK2ABS(vmp
->vm_arch
.vm_seg
[T
].mem_phys
);
70 vir_bytes textend
= CLICK2ABS(vmp
->vm_arch
.vm_seg
[T
].mem_phys
+
71 vmp
->vm_arch
.vm_seg
[T
].mem_phys
);
72 vir_bytes datastart
= CLICK2ABS(vmp
->vm_arch
.vm_seg
[D
].mem_phys
);
74 if(addr
>= textstart
&& addr
< textstart
+textend
)
77 if(addr
>= datastart
&& addr
< VM_DATATOP
)
83 /*===========================================================================*
85 *===========================================================================*/
86 PUBLIC vir_bytes
arch_vir2map(struct vmproc
*vmp
, vir_bytes addr
)
88 vir_bytes bottom
= CLICK2ABS(vmp
->vm_arch
.vm_seg
[D
].mem_phys
);
93 /*===========================================================================*
95 *===========================================================================*/
96 PUBLIC vir_bytes
arch_vir2map_text(struct vmproc
*vmp
, vir_bytes addr
)
98 vir_bytes bottom
= CLICK2ABS(vmp
->vm_arch
.vm_seg
[T
].mem_phys
);
100 return addr
+ bottom
;