2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
14 #include "user_util.h"
16 void remap_data(void *segment_start, void *segment_end, int w)
22 if(w) prot = PROT_WRITE;
24 prot |= PROT_READ | PROT_EXEC;
25 size = (unsigned long) segment_end -
26 (unsigned long) segment_start;
27 data = create_mem_file(size);
28 if((addr = mmap(NULL, size, PROT_WRITE | PROT_READ,
29 MAP_SHARED, data, 0)) == MAP_FAILED){
30 perror("mapping new data segment");
33 memcpy(addr, segment_start, size);
34 if(switcheroo(data, prot, addr, segment_start,
36 printf("switcheroo failed\n");
42 * Overrides for Emacs so that we follow Linus's tabbing style.
43 * Emacs will notice this stuff at the end of the file and automatically
44 * adjust the settings for this buffer only. This must remain at the end
46 * ---------------------------------------------------------------------------
48 * c-file-style: "linux"