xref: /openbmc/qemu/bsd-user/bsd-mem.c (revision 86fbb4436bd09c5006c1f07d4cb007b2e91b595a)
1c9cdf0a5SStacey Son /*
2c9cdf0a5SStacey Son  *  memory management system conversion routines
3c9cdf0a5SStacey Son  *
4c9cdf0a5SStacey Son  *  Copyright (c) 2013 Stacey D. Son
5c9cdf0a5SStacey Son  *
6c9cdf0a5SStacey Son  *  This program is free software; you can redistribute it and/or modify
7c9cdf0a5SStacey Son  *  it under the terms of the GNU General Public License as published by
8c9cdf0a5SStacey Son  *  the Free Software Foundation; either version 2 of the License, or
9c9cdf0a5SStacey Son  *  (at your option) any later version.
10c9cdf0a5SStacey Son  *
11c9cdf0a5SStacey Son  *  This program is distributed in the hope that it will be useful,
12c9cdf0a5SStacey Son  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13c9cdf0a5SStacey Son  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14c9cdf0a5SStacey Son  *  GNU General Public License for more details.
15c9cdf0a5SStacey Son  *
16c9cdf0a5SStacey Son  *  You should have received a copy of the GNU General Public License
17c9cdf0a5SStacey Son  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
18c9cdf0a5SStacey Son  */
19c9cdf0a5SStacey Son #include "qemu/osdep.h"
20c9cdf0a5SStacey Son #include "qemu.h"
21c9cdf0a5SStacey Son #include "qemu-bsd.h"
22c9cdf0a5SStacey Son 
23c9cdf0a5SStacey Son struct bsd_shm_regions bsd_shm_regions[N_BSD_SHM_REGIONS];
24c9cdf0a5SStacey Son 
25c9cdf0a5SStacey Son abi_ulong target_brk;
26c9cdf0a5SStacey Son abi_ulong initial_target_brk;
27c9cdf0a5SStacey Son 
28c9cdf0a5SStacey Son void target_set_brk(abi_ulong new_brk)
29c9cdf0a5SStacey Son {
30c9cdf0a5SStacey Son     target_brk = TARGET_PAGE_ALIGN(new_brk);
31c9cdf0a5SStacey Son     initial_target_brk = target_brk;
32c9cdf0a5SStacey Son }
33*86fbb443SStacey Son 
34*86fbb443SStacey Son void target_to_host_ipc_perm__locked(struct ipc_perm *host_ip,
35*86fbb443SStacey Son                                      struct target_ipc_perm *target_ip)
36*86fbb443SStacey Son {
37*86fbb443SStacey Son     __get_user(host_ip->cuid, &target_ip->cuid);
38*86fbb443SStacey Son     __get_user(host_ip->cgid, &target_ip->cgid);
39*86fbb443SStacey Son     __get_user(host_ip->uid,  &target_ip->uid);
40*86fbb443SStacey Son     __get_user(host_ip->gid,  &target_ip->gid);
41*86fbb443SStacey Son     __get_user(host_ip->mode, &target_ip->mode);
42*86fbb443SStacey Son     __get_user(host_ip->seq,  &target_ip->seq);
43*86fbb443SStacey Son     __get_user(host_ip->key,  &target_ip->key);
44*86fbb443SStacey Son }
45*86fbb443SStacey Son 
46*86fbb443SStacey Son void host_to_target_ipc_perm__locked(struct target_ipc_perm *target_ip,
47*86fbb443SStacey Son                                      struct ipc_perm *host_ip)
48*86fbb443SStacey Son {
49*86fbb443SStacey Son     __put_user(host_ip->cuid, &target_ip->cuid);
50*86fbb443SStacey Son     __put_user(host_ip->cgid, &target_ip->cgid);
51*86fbb443SStacey Son     __put_user(host_ip->uid,  &target_ip->uid);
52*86fbb443SStacey Son     __put_user(host_ip->gid,  &target_ip->gid);
53*86fbb443SStacey Son     __put_user(host_ip->mode, &target_ip->mode);
54*86fbb443SStacey Son     __put_user(host_ip->seq,  &target_ip->seq);
55*86fbb443SStacey Son     __put_user(host_ip->key,  &target_ip->key);
56*86fbb443SStacey Son }
57*86fbb443SStacey Son 
58