Skip to content

Commit 5423e6d

Browse files
pm215vivier
authored andcommitted
linux-user: Split mmap prototypes into user-mmap.h
Split out the mmap prototypes into a new header user-mmap.h which we only include where required. Signed-off-by: Peter Maydell <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Laurent Vivier <[email protected]>
1 parent 3ad0a76 commit 5423e6d

File tree

8 files changed

+40
-14
lines changed

8 files changed

+40
-14
lines changed

linux-user/elfload.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "qemu.h"
99
#include "loader.h"
10+
#include "user-mmap.h"
1011
#include "disas/disas.h"
1112
#include "qemu/bitops.h"
1213
#include "qemu/path.h"

linux-user/flatload.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
#include "qemu.h"
3939
#include "loader.h"
40+
#include "user-mmap.h"
4041
#include "flat.h"
4142
#include "target_flat.h"
4243

linux-user/i386/cpu_loop.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "qemu.h"
2323
#include "cpu_loop-common.h"
2424
#include "signal-common.h"
25+
#include "user-mmap.h"
2526

2627
/***********************************************************/
2728
/* CPUX86 core interface */

linux-user/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include "fd-trans.h"
5252
#include "signal-common.h"
5353
#include "loader.h"
54+
#include "user-mmap.h"
5455

5556
#ifndef AT_FLAGS_PRESERVE_ARGV0
5657
#define AT_FLAGS_PRESERVE_ARGV0_BIT 0

linux-user/mmap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "trace.h"
2121
#include "exec/log.h"
2222
#include "qemu.h"
23+
#include "user-mmap.h"
2324

2425
static pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER;
2526
static __thread int mmap_lock_count;

linux-user/qemu.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -389,20 +389,6 @@ void sparc64_set_context(CPUSPARCState *env);
389389
void sparc64_get_context(CPUSPARCState *env);
390390
#endif
391391

392-
/* mmap.c */
393-
int target_mprotect(abi_ulong start, abi_ulong len, int prot);
394-
abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
395-
int flags, int fd, abi_ulong offset);
396-
int target_munmap(abi_ulong start, abi_ulong len);
397-
abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
398-
abi_ulong new_size, unsigned long flags,
399-
abi_ulong new_addr);
400-
extern unsigned long last_brk;
401-
extern abi_ulong mmap_next_start;
402-
abi_ulong mmap_find_vma(abi_ulong, abi_ulong, abi_ulong);
403-
void mmap_fork_start(void);
404-
void mmap_fork_end(int child);
405-
406392
/* user access */
407393

408394
#define VERIFY_READ PAGE_READ

linux-user/syscall.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
#include "strace.h"
131131
#include "signal-common.h"
132132
#include "loader.h"
133+
#include "user-mmap.h"
133134
#include "qemu/guest-random.h"
134135
#include "qemu/selfmap.h"
135136
#include "user/syscall-trace.h"

linux-user/user-mmap.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* user-mmap.h: prototypes for linux-user guest binary loader
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program; if not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#ifndef LINUX_USER_USER_MMAP_H
19+
#define LINUX_USER_USER_MMAP_H
20+
21+
int target_mprotect(abi_ulong start, abi_ulong len, int prot);
22+
abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
23+
int flags, int fd, abi_ulong offset);
24+
int target_munmap(abi_ulong start, abi_ulong len);
25+
abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
26+
abi_ulong new_size, unsigned long flags,
27+
abi_ulong new_addr);
28+
extern unsigned long last_brk;
29+
extern abi_ulong mmap_next_start;
30+
abi_ulong mmap_find_vma(abi_ulong, abi_ulong, abi_ulong);
31+
void mmap_fork_start(void);
32+
void mmap_fork_end(int child);
33+
34+
#endif /* LINUX_USER_USER_MMAP_H */

0 commit comments

Comments
 (0)