aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/os-Linux/util.c')
-rw-r--r--arch/um/os-Linux/util.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index 56b8a50e8bc2..c307a89ed259 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -21,7 +21,6 @@
21#include <sched.h> 21#include <sched.h>
22#include <termios.h> 22#include <termios.h>
23#include <string.h> 23#include <string.h>
24#include "user_util.h"
25#include "kern_util.h" 24#include "kern_util.h"
26#include "user.h" 25#include "user.h"
27#include "mem_user.h" 26#include "mem_user.h"
@@ -30,28 +29,29 @@
30#include "uml-config.h" 29#include "uml-config.h"
31#include "os.h" 30#include "os.h"
32#include "longjmp.h" 31#include "longjmp.h"
32#include "kern_constants.h"
33 33
34void stack_protections(unsigned long address) 34void stack_protections(unsigned long address)
35{ 35{
36 int prot = PROT_READ | PROT_WRITE | PROT_EXEC; 36 int prot = PROT_READ | PROT_WRITE | PROT_EXEC;
37 37
38 if(mprotect((void *) address, page_size(), prot) < 0) 38 if(mprotect((void *) address, UM_KERN_PAGE_SIZE, prot) < 0)
39 panic("protecting stack failed, errno = %d", errno); 39 panic("protecting stack failed, errno = %d", errno);
40} 40}
41 41
42void task_protections(unsigned long address) 42void task_protections(unsigned long address)
43{ 43{
44 unsigned long guard = address + page_size(); 44 unsigned long guard = address + UM_KERN_PAGE_SIZE;
45 unsigned long stack = guard + page_size(); 45 unsigned long stack = guard + UM_KERN_PAGE_SIZE;
46 int prot = 0, pages; 46 int prot = 0, pages;
47 47
48#ifdef notdef 48#ifdef notdef
49 if(mprotect((void *) stack, page_size(), prot) < 0) 49 if(mprotect((void *) stack, UM_KERN_PAGE_SIZE, prot) < 0)
50 panic("protecting guard page failed, errno = %d", errno); 50 panic("protecting guard page failed, errno = %d", errno);
51#endif 51#endif
52 pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER) - 2; 52 pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER) - 2;
53 prot = PROT_READ | PROT_WRITE | PROT_EXEC; 53 prot = PROT_READ | PROT_WRITE | PROT_EXEC;
54 if(mprotect((void *) stack, pages * page_size(), prot) < 0) 54 if(mprotect((void *) stack, pages * UM_KERN_PAGE_SIZE, prot) < 0)
55 panic("protecting stack failed, errno = %d", errno); 55 panic("protecting stack failed, errno = %d", errno);
56} 56}
57 57
@@ -96,15 +96,13 @@ void setup_machinename(char *machine_out)
96 strcpy(machine_out, host.machine); 96 strcpy(machine_out, host.machine);
97} 97}
98 98
99char host_info[(_UTSNAME_LENGTH + 1) * 4 + _UTSNAME_NODENAME_LENGTH + 1]; 99void setup_hostinfo(char *buf, int len)
100
101void setup_hostinfo(void)
102{ 100{
103 struct utsname host; 101 struct utsname host;
104 102
105 uname(&host); 103 uname(&host);
106 sprintf(host_info, "%s %s %s %s %s", host.sysname, host.nodename, 104 snprintf(buf, len, "%s %s %s %s %s", host.sysname, host.nodename,
107 host.release, host.version, host.machine); 105 host.release, host.version, host.machine);
108} 106}
109 107
110int setjmp_wrapper(void (*proc)(void *, void *), ...) 108int setjmp_wrapper(void (*proc)(void *, void *), ...)
@@ -121,3 +119,9 @@ int setjmp_wrapper(void (*proc)(void *, void *), ...)
121 va_end(args); 119 va_end(args);
122 return n; 120 return n;
123} 121}
122
123void os_dump_core(void)
124{
125 signal(SIGSEGV, SIG_DFL);
126 abort();
127}