Jeff Dike | 4ff83ce | 2007-05-06 14:51:08 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
| 3 | * Licensed under the GPL |
| 4 | */ |
| 5 | |
| 6 | #ifndef __START_H__ |
| 7 | #define __START_H__ |
| 8 | |
Jeff Dike | 54ae36f | 2007-10-16 01:27:33 -0700 | [diff] [blame] | 9 | #include "uml-config.h" |
| 10 | #include "kern_constants.h" |
| 11 | |
| 12 | /* |
Jeff Dike | 4bdf8bc | 2008-02-04 22:30:44 -0800 | [diff] [blame] | 13 | * Stolen from linux/const.h, which can't be directly included since |
| 14 | * this is used in userspace code, which has no access to the kernel |
| 15 | * headers. Changed to be suitable for adding casts to the start, |
| 16 | * rather than "UL" to the end. |
Jeff Dike | 54ae36f | 2007-10-16 01:27:33 -0700 | [diff] [blame] | 17 | */ |
Jeff Dike | 54ae36f | 2007-10-16 01:27:33 -0700 | [diff] [blame] | 18 | |
Jeff Dike | 4bdf8bc | 2008-02-04 22:30:44 -0800 | [diff] [blame] | 19 | /* Some constant macros are used in both assembler and |
| 20 | * C code. Therefore we cannot annotate them always with |
| 21 | * 'UL' and other type specifiers unilaterally. We |
| 22 | * use the following macros to deal with this. |
Jeff Dike | 54ae36f | 2007-10-16 01:27:33 -0700 | [diff] [blame] | 23 | */ |
Jeff Dike | 4bdf8bc | 2008-02-04 22:30:44 -0800 | [diff] [blame] | 24 | |
| 25 | #ifdef __ASSEMBLY__ |
| 26 | #define _AC(X, Y) (Y) |
| 27 | #else |
| 28 | #define __AC(X, Y) (X (Y)) |
| 29 | #define _AC(X, Y) __AC(X, Y) |
| 30 | #endif |
| 31 | |
Jeff Dike | 42a2b54 | 2008-02-04 22:31:00 -0800 | [diff] [blame^] | 32 | /* |
| 33 | * The "- 1"'s are to avoid gcc complaining about integer overflows |
| 34 | * and unrepresentable decimal constants. With 3-level page tables, |
| 35 | * TASK_SIZE is 0x80000000, which gets turned into its signed decimal |
| 36 | * equivalent in asm-offsets.s. gcc then complains about that being |
| 37 | * unsigned only in C90. To avoid that, UM_TASK_SIZE is defined as |
| 38 | * TASK_SIZE - 1. To compensate, we need to add the 1 back here. |
| 39 | * However, adding it back to UM_TASK_SIZE produces more gcc |
| 40 | * complaints. So, I adjust the thing being subtracted from |
| 41 | * UM_TASK_SIZE instead. Bah. |
| 42 | */ |
Jeff Dike | 4bdf8bc | 2008-02-04 22:30:44 -0800 | [diff] [blame] | 43 | #define STUB_CODE _AC((unsigned long), \ |
Jeff Dike | 42a2b54 | 2008-02-04 22:31:00 -0800 | [diff] [blame^] | 44 | UM_TASK_SIZE - (2 * UM_KERN_PAGE_SIZE - 1)) |
| 45 | #define STUB_DATA _AC((unsigned long), UM_TASK_SIZE - (UM_KERN_PAGE_SIZE - 1)) |
Jeff Dike | 4bdf8bc | 2008-02-04 22:30:44 -0800 | [diff] [blame] | 46 | #define STUB_START _AC(, STUB_CODE) |
| 47 | |
Jeff Dike | 54ae36f | 2007-10-16 01:27:33 -0700 | [diff] [blame] | 48 | #ifndef __ASSEMBLY__ |
| 49 | |
Jeff Dike | 4ff83ce | 2007-05-06 14:51:08 -0700 | [diff] [blame] | 50 | #include "sysdep/ptrace.h" |
| 51 | |
| 52 | struct cpu_task { |
| 53 | int pid; |
| 54 | void *task; |
| 55 | }; |
| 56 | |
| 57 | extern struct cpu_task cpu_tasks[]; |
| 58 | |
| 59 | extern unsigned long low_physmem; |
| 60 | extern unsigned long high_physmem; |
| 61 | extern unsigned long uml_physmem; |
| 62 | extern unsigned long uml_reserved; |
| 63 | extern unsigned long end_vm; |
| 64 | extern unsigned long start_vm; |
| 65 | extern unsigned long long highmem; |
| 66 | |
| 67 | extern unsigned long _stext, _etext, _sdata, _edata, __bss_start, _end; |
| 68 | extern unsigned long _unprotected_end; |
| 69 | extern unsigned long brk_start; |
| 70 | |
| 71 | extern int linux_main(int argc, char **argv); |
Jeff Dike | 4ff83ce | 2007-05-06 14:51:08 -0700 | [diff] [blame] | 72 | |
Jeff Dike | 77bf440 | 2007-10-16 01:26:58 -0700 | [diff] [blame] | 73 | extern void (*sig_info[])(int, struct uml_pt_regs *); |
Jeff Dike | 4ff83ce | 2007-05-06 14:51:08 -0700 | [diff] [blame] | 74 | |
| 75 | #endif |
Jeff Dike | 54ae36f | 2007-10-16 01:27:33 -0700 | [diff] [blame] | 76 | |
| 77 | #endif |