diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h index b314cf7..e984b2c 100644 --- a/arch/um/include/shared/os.h +++ b/arch/um/include/shared/os.h @@ -144,6 +144,7 @@ extern int os_write_file(int fd, const void *buf, int count); extern int os_file_size(const char *file, unsigned long long *size_out); extern int os_file_modtime(const char *file, unsigned long *modtime); extern int os_pipe(int *fd, int stream, int close_on_exec); +extern int os_fsync(int fd); extern int os_set_fd_async(int fd); extern int os_clear_fd_async(int fd); extern int os_set_fd_block(int fd, int blocking); diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index f116db1..ea606ee 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c @@ -87,6 +87,14 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, physmem_fd = create_mem_file(len + highmem); + /* + * Special kludge - This page will be mapped in to userspace processes + * from physmem_fd, so it needs to be written out there. + */ + os_seek_file(physmem_fd, __pa(&__syscall_stub_start)); + os_write_file(physmem_fd, &__syscall_stub_start, PAGE_SIZE); + os_fsync(physmem_fd); + offset = uml_reserved - uml_physmem; err = os_map_memory((void *) uml_reserved, physmem_fd, offset, len - offset, 1, 1, 1); @@ -97,12 +105,6 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, exit(1); } - /* - * Special kludge - This page will be mapped in to userspace processes - * from physmem_fd, so it needs to be written out there. - */ - os_seek_file(physmem_fd, __pa(&__syscall_stub_start)); - os_write_file(physmem_fd, &__syscall_stub_start, PAGE_SIZE); bootmap_size = init_bootmem(pfn, pfn + delta); free_bootmem(__pa(reserve_end) + bootmap_size, diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c index b049a63..d4985be99 100644 --- a/arch/um/os-Linux/file.c +++ b/arch/um/os-Linux/file.c @@ -33,6 +33,10 @@ static void copy_stat(struct uml_stat *dst, const struct stat64 *src) }); } +int os_fsync(int fd) { + fsync(fd); +} + int os_stat_fd(const int fd, struct uml_stat *ubuf) { struct stat64 sbuf;