Rev 3169 | Rev 3210 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3169 | Rev 3170 | ||
|---|---|---|---|
| Line 51... | Line 51... | ||
| 51 | #include <unistd.h> |
51 | #include <unistd.h> |
| 52 | #include <fcntl.h> |
52 | #include <fcntl.h> |
| 53 | #include <loader/pcb.h> |
53 | #include <loader/pcb.h> |
| 54 | 54 | ||
| 55 | #include "elf.h" |
55 | #include "elf.h" |
| 56 | #include "arch/pcb.h" |
- | |
| 57 | #include "elf_load.h" |
56 | #include "elf_load.h" |
| 58 | #include "arch.h" |
57 | #include "arch.h" |
| 59 | 58 | ||
| 60 | static char *error_codes[] = { |
59 | static char *error_codes[] = { |
| 61 | "no error", |
60 | "no error", |
| Line 116... | Line 115... | ||
| 116 | * Transfers control to the entry point of an ELF executable loaded |
115 | * Transfers control to the entry point of an ELF executable loaded |
| 117 | * earlier with elf_load_file(). This function does not return. |
116 | * earlier with elf_load_file(). This function does not return. |
| 118 | * |
117 | * |
| 119 | * @param info Info structure filled earlier by elf_load_file() |
118 | * @param info Info structure filled earlier by elf_load_file() |
| 120 | */ |
119 | */ |
| 121 | void elf_run(elf_info_t *info, void *pcb) |
120 | void elf_run(elf_info_t *info, pcb_t *pcb) |
| 122 | { |
121 | { |
| 123 | program_run(info->entry, pcb); |
122 | program_run(info->entry, pcb); |
| 124 | 123 | ||
| 125 | /* not reached */ |
124 | /* not reached */ |
| 126 | } |
125 | } |
| 127 | 126 | ||
| 128 | /** Create the program control block (PCB). |
127 | /** Create the program control block (PCB). |
| 129 | * |
128 | * |
| 130 | * Create and install the program control block, initialising it |
129 | * Fills the program control block @a pcb with information from |
| 131 | * with program information from @a info. |
130 | * @a info. |
| 132 | * |
131 | * |
| 133 | * @param info Program info structure |
132 | * @param info Program info structure |
| 134 | * @return EOK on success or negative error code |
133 | * @return EOK on success or negative error code |
| 135 | */ |
134 | */ |
| 136 | int elf_create_pcb(elf_info_t *info) |
135 | void elf_create_pcb(elf_info_t *info, pcb_t *pcb) |
| 137 | { |
136 | { |
| 138 | pcb_t *pcb; |
- | |
| 139 | void *a; |
- | |
| 140 | - | ||
| 141 | pcb = __pcb_get(); |
- | |
| 142 | - | ||
| 143 | a = as_area_create(pcb, sizeof(pcb_t), AS_AREA_READ | AS_AREA_WRITE); |
- | |
| 144 | if (a == (void *)(-1)) { |
- | |
| 145 | printf("elf_create_pcb: memory mapping failed\n"); |
- | |
| 146 | return EE_MEMORY; |
- | |
| 147 | } |
- | |
| 148 | - | ||
| 149 | pcb->entry = info->entry; |
137 | pcb->entry = info->entry; |
| 150 | pcb->dynamic = info->dynamic; |
138 | pcb->dynamic = info->dynamic; |
| 151 | - | ||
| 152 | return 0; |
- | |
| 153 | } |
139 | } |
| 154 | 140 | ||
| 155 | 141 | ||
| 156 | /** Load an ELF binary. |
142 | /** Load an ELF binary. |
| 157 | * |
143 | * |