1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-26 11:47:31 +00:00

kvm: fix types for cross-debugging

As with other libkvm interfaces use maximum-sized types to support
cross-debugging (e.g. a 64-bit vmcore on a 32-bit host).  See
https://lists.freebsd.org/pipermail/svn-src-all/2019-February/176051.html
for further discussion.

This is an API-breaking change, but there are few consumers of this
interface today.

Reviewed by:	will
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21945
This commit is contained in:
Ed Maste 2019-11-08 14:51:09 +00:00
parent c1131de6f1
commit 9dc7ed6253
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=354543
3 changed files with 21 additions and 20 deletions

View File

@ -82,18 +82,18 @@ struct kvm_swap {
};
struct kvm_page {
unsigned int version;
u_long paddr;
u_long kmap_vaddr;
u_long dmap_vaddr;
vm_prot_t prot;
u_long offset;
size_t len;
/* end of version 1 */
u_int kp_version;
kpaddr_t kp_paddr;
kvaddr_t kp_kmap_vaddr;
kvaddr_t kp_dmap_vaddr;
vm_prot_t kp_prot;
off_t kp_offset;
size_t kp_len;
/* end of version 2 */
};
#define SWIF_DEV_PREFIX 0x0002
#define LIBKVM_WALK_PAGES_VERSION 1
#define LIBKVM_WALK_PAGES_VERSION 2
__BEGIN_DECLS
int kvm_close(kvm_t *);

View File

@ -755,13 +755,13 @@ _kvm_visit_cb(kvm_t *kd, kvm_walk_pages_cb_t *cb, void *arg, u_long pa,
{
unsigned int pgsz = page_size ? page_size : len;
struct kvm_page p = {
.version = LIBKVM_WALK_PAGES_VERSION,
.paddr = pa,
.kmap_vaddr = kmap_vaddr,
.dmap_vaddr = dmap_vaddr,
.prot = prot,
.offset = _kvm_pt_find(kd, pa, pgsz),
.len = len,
.kp_version = LIBKVM_WALK_PAGES_VERSION,
.kp_paddr = pa,
.kp_kmap_vaddr = kmap_vaddr,
.kp_dmap_vaddr = dmap_vaddr,
.kp_prot = prot,
.kp_offset = _kvm_pt_find(kd, pa, pgsz),
.kp_len = len,
};
return cb(&p, arg);

View File

@ -252,11 +252,12 @@ typedef struct cap_rights cap_rights_t;
#endif
/*
* Types suitable for exporting size and pointers (as virtual addresses)
* from the kernel independent of native word size. These should be
* used in place of size_t and (u)intptr_t in structs which contain such
* types that are shared with userspace.
* Types suitable for exporting physical addresses, virtual addresses
* (pointers), and memory object sizes from the kernel independent of native
* word size. These should be used in place of vm_paddr_t, (u)intptr_t, and
* size_t in structs which contain such types that are shared with userspace.
*/
typedef __uint64_t kpaddr_t;
typedef __uint64_t kvaddr_t;
typedef __uint64_t ksize_t;