Changeset 232 for soft/giet_vm
- Timestamp:
- Mar 5, 2013, 4:00:09 PM (12 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/Makefile
r218 r232 1 1 export # export all variable to sub-Makefile 2 CC =mipsel-unknown-elf-gcc3 AS =mipsel-unknown-elf-as4 LD =mipsel-unknown-elf-ld5 DU =mipsel-unknown-elf-objdump2 CC = mipsel-unknown-elf-gcc 3 AS = mipsel-unknown-elf-as 4 LD = mipsel-unknown-elf-ld 5 DU = mipsel-unknown-elf-objdump 6 6 7 7 MAP_XML = mappings/4c_1p_four.xml 8 8 9 9 SYS_OBJS = build/sys/vm_handler.o \ 10 10 build/sys/sys_handler.o \ 11 11 build/sys/giet.o \ 12 12 build/sys/switch.o \ 13 13 build/sys/common.o \ 14 14 build/sys/ctx_handler.o \ … … 38 38 build/libs/utils.o 39 39 40 CFLAGS =-Wall -ffreestanding -mno-gpopt -mips32 -g40 CFLAGS = -Wall -ffreestanding -mno-gpopt -mips32 -g 41 41 42 42 INCLUDE = -Iboot -Isys -Ixml -Ilibs -I. 43 43 44 TRASH= /dev/null||true 44 all: map.bin soft.elf 45 45 46 all: map.bin soft.elf47 48 46 ## merge all *.elf and map.bin to soft.elf 49 47 soft.elf: build/boot/boot.elf \ … … 107 105 108 106 build/hello/main.o: hello/main.c 109 $(CC) $(INCLUDE) $(CFLAGS) 107 $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $< 110 108 111 109 ### pgcd compilation … … 115 113 116 114 build/pgcd/main.o: pgcd/main.c 117 $(CC) $(INCLUDE) $(CFLAGS) 115 $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $< 118 116 119 117 ### libs compilation 120 118 build/libs/utils.o: libs/utils.c giet_config.h 121 $(CC) $(CFLAGS) $(INCLUDE) 119 $(CC) $(CFLAGS) $(INCLUDE) -c -o $@ $< 122 120 123 121 build/libs/stdio.o: libs/stdio.c giet_config.h 124 $(CC) $(CFLAGS) $(INCLUDE) 122 $(CC) $(CFLAGS) $(INCLUDE) -c -o $@ $< 125 123 126 124 build/libs/mwmr_channel.o: libs/mwmr_channel.c 127 $(CC) $(CFLAGS) $(INCLUDE) -c -o $@ $< 125 $(CC) $(CFLAGS) $(INCLUDE) -c -o $@ $< 126 127 build/libs/malloc.o: libs/malloc.c libs/malloc.h libs/malloc_private.h giet_config.h 128 $(CC) $(CFLAGS) $(INCLUDE) -c -o $@ $< 129 128 130 129 131 130 132 ### clean 131 133 clean: 132 rm -f *.o *.elf *.bin *.txt core giet_vsegs.ld hard_config.h *~ 2>$(TRASH)133 $(MAKE) -s clean -C xml 2>$(TRASH)134 $(MAKE) -s clean -C memo 2>$(TRASH)135 rm -r build/boot/* 2>$(TRASH)136 rm -r build/sys/* 2>$(TRASH)137 rm -r build/libs/* 2>$(TRASH)138 rm -r build/pgcd/* 2>$(TRASH)139 rm -r build/hello/* 2>$(TRASH)140 rm -r build/display/* 2>$(TRASH)141 rm -r build/router/* 2>$(TRASH)134 rm -f *.o *.elf *.bin *.txt core giet_vsegs.ld hard_config.h *~ 135 $(MAKE) -s clean -C xml 136 $(MAKE) -s clean -C memo 137 rm -rf build/boot/* 138 rm -rf build/sys/* 139 rm -rf build/libs/* 140 rm -rf build/pgcd/* 141 rm -rf build/hello/* 142 rm -rf build/display/* 143 rm -rf build/router/* -
soft/giet_vm/boot/boot_init.c
r230 r232 1387 1387 //FIXME: the vspace_id should be the same for all ports: put it in the coproc? 1388 1388 unsigned int vspace_id = cp_port[cp_port_id].vspaceid; 1389 unsigned int vobj_id = cp_port[cp_port_id]. vobjlocid + vspace[vspace_id].vobj_offset;1389 unsigned int vobj_id = cp_port[cp_port_id].mwmr_vobjid + vspace[vspace_id].vobj_offset; 1390 1390 1391 1391 mwmr_channel_t * pmwmr = (mwmr_channel_t *) (vobj[vobj_id].paddr); … … 1669 1669 1670 1670 // ctx_sp : Get the vobj containing the stack 1671 unsigned int vobj_id = task[task_id]. vobjlocid + vspace[vspace_id].vobj_offset;1671 unsigned int vobj_id = task[task_id].stack_vobjid + vspace[vspace_id].vobj_offset; 1672 1672 unsigned int ctx_sp = vobj[vobj_id].vaddr + vobj[vobj_id].length; 1673 1673 … … 1706 1706 boot_scheduler_set_context(gpid, ltid, CTX_LTID_ID, ltid); 1707 1707 boot_scheduler_set_context(gpid, ltid, CTX_VSID_ID, vspace_id); 1708 boot_scheduler_set_context(gpid, ltid, CTX_GTID_ID, task_id); 1708 1709 boot_scheduler_set_context(gpid, ltid, CTX_RUN_ID, 1); 1709 1710 -
soft/giet_vm/giet_config.h
r218 r232 29 29 30 30 #define GIET_NB_VSPACE_MAX 64 /* max number of virtual spaces */ 31 #define GIET_TICK_VALUE 0x1000 /* context switch period (number of cycles) */31 #define GIET_TICK_VALUE 0x100000 /* context switch period (number of cycles) */ 32 32 33 33 #endif -
soft/giet_vm/libs/stdio.c
r228 r232 21 21 #define SYSCALL_GCD_WRITE 0x06 22 22 #define SYSCALL_GCD_READ 0x07 23 #define SYSCALL_TASK_ID 0x09 23 #define SYSCALL_HEAP_INFO 0x08 24 #define SYSCALL_PROC_TASK_ID 0x09 25 #define SYSCALL_GLOBAL_TASK_ID 0x0A 24 26 #define SYSCALL_CTX_SWITCH 0x0D 25 27 #define SYSCALL_EXIT 0x0E … … 742 744 743 745 ////////////////////////////////////////////////////////////////////////////////// 744 // giet_get_task_id() 745 // The user task calling this function is descheduled and 746 // the processor is allocated to another task. 747 ////////////////////////////////////////////////////////////////////////////////// 748 unsigned int giet_task_id() { 749 return sys_call(SYSCALL_TASK_ID, 0, 0, 0, 0); 750 } 751 746 // giet_proc_task_id() 747 // This functions returns the local task id, i.e. the processor task id (ranging 748 // from 0 to n-1(p) for each processor if p has n tasks) 749 ////////////////////////////////////////////////////////////////////////////////// 750 unsigned int giet_proc_task_id() { 751 return sys_call(SYSCALL_PROC_TASK_ID, 0, 0, 0, 0); 752 } 753 754 ////////////////////////////////////////////////////////////////////////////////// 755 // giet_heap_info() 756 // This function returns the base address and size of the current task's heap 757 ////////////////////////////////////////////////////////////////////////////////// 758 unsigned int giet_heap_info(unsigned int * vaddr, unsigned int * length) { 759 return sys_call(SYSCALL_HEAP_INFO, (unsigned int) vaddr, (unsigned int) length, 0, 0); 760 } 761 762 763 ////////////////////////////////////////////////////////////////////////////////// 764 // giet_global_task_id() 765 // This functions returns the global task id, which is unique in all the giet 766 ////////////////////////////////////////////////////////////////////////////////// 767 unsigned int giet_global_task_id() { 768 return sys_call(SYSCALL_GLOBAL_TASK_ID, 0, 0, 0, 0); 769 } 752 770 753 771 // Local Variables: -
soft/giet_vm/libs/stdio.h
r228 r232 50 50 unsigned int giet_rand(); 51 51 unsigned int giet_context_switch(); 52 unsigned int giet_task_id(); 52 unsigned int giet_proc_task_id(); 53 unsigned int giet_heap_info(unsigned int * vaddr, unsigned int * size); 54 unsigned int giet_global_task_id(); 55 53 56 unsigned int giet_procnumber(); 54 57 -
soft/giet_vm/mappings/1c_4p_four.xml
r215 r232 147 147 148 148 <vseg name = "seg_data" vbase = "0x00800000" mode = "__WU" clusterid = "0" psegname = "PSEG_RAM" > 149 <vobj name = "data" type = "ELF" length 150 </vseg> 151 <vseg name = "seg_code" vbase = "0x00400000" mode = "CX_U" clusterid = "0" psegname = "PSEG_RAM" > 152 <vobj name = "code" type = "ELF" length 153 </vseg> 154 <vseg name = "seg_ptab" vbase = "0x00300000" mode = "C___" clusterid = "0" psegname = "PSEG_RAM" > 155 <vobj name = "ptab" type = "PTAB" length 149 <vobj name = "data" type = "ELF" length = "0x00010000" binpath = "build/router/router.elf" /> 150 </vseg> 151 <vseg name = "seg_code" vbase = "0x00400000" mode = "CX_U" clusterid = "0" psegname = "PSEG_RAM" > 152 <vobj name = "code" type = "ELF" length = "0x00010000" binpath = "build/router/router.elf" /> 153 </vseg> 154 <vseg name = "seg_ptab" vbase = "0x00300000" mode = "C___" clusterid = "0" psegname = "PSEG_RAM" > 155 <vobj name = "ptab" type = "PTAB" length = "0x00012000" align = "13" /> 156 156 </vseg> 157 157 <vseg name = "seg_stack_p" vbase = "0x00010000" mode = "C_WU" clusterid = "0" psegname = "PSEG_RAM" > 158 <vobj name = "stack_p" type = "BUFFER" length = "0x00010000" /> 159 </vseg> 160 <vseg name = "seg_stack_c" vbase = "0x00020000" mode = "C_WU" clusterid = "0" psegname = "PSEG_RAM" > 161 <vobj name = "stack_c" type = "BUFFER" length = "0x00010000" /> 158 <vobj name = "stack_p" type = "BUFFER" length = "0x00010000" /> 159 <vobj name = "heap_p" type = "BUFFER" length = "0x00010000" /> 160 </vseg> 161 <vseg name = "seg_stack_c" vbase = "0x00030000" mode = "C_WU" clusterid = "0" psegname = "PSEG_RAM" > 162 <vobj name = "stack_c" type = "BUFFER" length = "0x00010000" /> 163 <vobj name = "heap_c" type = "BUFFER" length = "0x00010000" /> 162 164 </vseg> 163 <vseg name = "seg_stack_rA" vbase = "0x00030000" mode = "C_WU" clusterid = "0" psegname = "PSEG_RAM" > 164 <vobj name = "stack_rA" type = "BUFFER" length = "0x00010000" /> 165 </vseg> 166 <vseg name = "seg_stack_rB" vbase = "0x00040000" mode = "C_WU" clusterid = "0" psegname = "PSEG_RAM" > 165 <vseg name = "seg_stack_rA" vbase = "0x00050000" mode = "C_WU" clusterid = "0" psegname = "PSEG_RAM" > 166 <vobj name = "stack_rA" type = "BUFFER" length = "0x00010000" /> 167 <vobj name = "heap_rA" type = "BUFFER" length = "0x00010000" /> 168 </vseg> 169 <vseg name = "seg_stack_rB" vbase = "0x00070000" mode = "C_WU" clusterid = "0" psegname = "PSEG_RAM" > 167 170 <vobj name = "stack_rB" type = "BUFFER" length = "0x00010000" /> 168 </vseg> 169 <vseg name = "seg_mwmrs" vbase = "0x00050000" mode = "__WU" clusterid = "0" psegname = "PSEG_RAM" > 170 <vobj name = "mwmr_in" type = "MWMR" length = "0x00000020" init = "1" /> 171 <vobj name = "mwmr_out" type = "MWMR" length = "0x00000020" init = "1" /> 172 </vseg> 173 174 <task name = "producer" clusterid = "0" proclocid = "0" stackname = "stack_p" startid = "0" usetty = "1" /> 175 <task name = "consumer" clusterid = "0" proclocid = "1" stackname = "stack_c" startid = "1" usetty = "1" /> 176 <task name = "router_A" clusterid = "0" proclocid = "2" stackname = "stack_rA" startid = "2" usetty = "1" /> 177 <task name = "router_B" clusterid = "0" proclocid = "3" stackname = "stack_rB" startid = "2" usetty = "1" /> 171 <vobj name = "heap_rB" type = "BUFFER" length = "0x00010000" /> 172 </vseg> 173 <vseg name = "seg_mwmrs" vbase = "0x00090000" mode = "__WU" clusterid = "0" psegname = "PSEG_RAM" > 174 <vobj name = "mwmr_in" type = "MWMR" length = "0x00000020" init = "1" /> 175 <vobj name = "mwmr_out" type = "MWMR" length = "0x00000020" init = "1" /> 176 </vseg> 177 178 <task name = "producer" clusterid = "0" proclocid = "0" stackname = "stack_p" heapname = "heap_p" startid = "0" usetty = "1" /> 179 <task name = "consumer" clusterid = "0" proclocid = "1" stackname = "stack_c" heapname = "heap_c" startid = "1" usetty = "1" /> 180 <task name = "router_A" clusterid = "0" proclocid = "2" stackname = "stack_rA" heapname = "heap_rA" startid = "2" usetty = "1" /> 181 <task name = "router_B" clusterid = "0" proclocid = "3" stackname = "stack_rB" heapname = "heap_rB" startid = "2" usetty = "1" /> 178 182 179 183 </vspace> -
soft/giet_vm/mappings/4c_1p_display.xml
r218 r232 171 171 <vspaceset> 172 172 <vspace name = "display" startname = "data" > 173 <vseg name = "seg_data" 174 <vobj name = "data" 173 <vseg name = "seg_data" vbase = "0x00800000" mode = "C_WU" clusterid = "3" psegname = "PSEG_RAM" > 174 <vobj name = "data" type = "ELF" length = "0x00010000" binpath = "build/display/display.elf" /> 175 175 </vseg> 176 <vseg name = "seg_ptab" 177 <vobj name = "ptab" 176 <vseg name = "seg_ptab" vbase = "0x00300000" mode = "C___" clusterid = "3" psegname = "PSEG_RAM" > 177 <vobj name = "ptab" type = "PTAB" length = "0x00012000" align = "13" /> 178 178 </vseg> 179 <vseg name = "seg_code" 180 <vobj name = "code" 179 <vseg name = "seg_code" vbase = "0x00400000" mode = "CX_U" clusterid = "3" psegname = "PSEG_RAM" > 180 <vobj name = "code" type = "ELF" length = "0x00010000" binpath = "build/display/display.elf" /> 181 181 </vseg> 182 <vseg name = "seg_stack" vbase = "0x00010000" mode = "C_WU" clusterid = "3" psegname = "PSEG_RAM" > 183 <vobj name = "stack" type = "BUFFER" length = "0x00010000" /> 182 <vseg name = "seg_stack" vbase = "0x00010000" mode = "C_WU" clusterid = "3" psegname = "PSEG_RAM" > 183 <vobj name = "stack" type = "BUFFER" length = "0x00010000" /> 184 <vobj name = "heap" type = "BUFFER" length = "0x00010000" /> 184 185 </vseg> 185 186 186 <task name = "main_display" clusterid = "3" proclocid = "0" stackname = "stack" startid = "0" usetty = "1" usefbdma = "1" />187 <task name = "main_display" clusterid = "3" proclocid = "0" stackname = "stack" heapname = "heap" startid = "0" usetty = "1" usefbdma = "1" /> 187 188 </vspace> 188 189 </vspaceset> -
soft/giet_vm/mappings/4c_1p_four.xml
r218 r232 182 182 <vseg name = "seg_stack_prod" vbase = "0x00010000" mode = "C_WU" clusterid = "0" psegname = "PSEG_RAM" > 183 183 <vobj name = "stack_prod" type = "BUFFER" length = "0x00010000" /> 184 </vseg> 185 <vseg name = "seg_stack_cons" vbase = "0x00020000" mode = "C_WU" clusterid = "1" psegname = "PSEG_RAM" > 184 <vobj name = "heap_prod" type = "BUFFER" length = "0x00010000" /> 185 </vseg> 186 <vseg name = "seg_stack_cons" vbase = "0x00030000" mode = "C_WU" clusterid = "1" psegname = "PSEG_RAM" > 186 187 <vobj name = "stack_cons" type = "BUFFER" length = "0x00010000" /> 187 </vseg> 188 <vseg name = "seg_stack_routA" vbase = "0x00030000" mode = "C_WU" clusterid = "2" psegname = "PSEG_RAM" > 188 <vobj name = "heap_cons" type = "BUFFER" length = "0x00010000" /> 189 </vseg> 190 <vseg name = "seg_stack_routA" vbase = "0x00050000" mode = "C_WU" clusterid = "2" psegname = "PSEG_RAM" > 189 191 <vobj name = "stack_routA" type = "BUFFER" length = "0x00010000" /> 190 </vseg> 191 <vseg name = "seg_stack_routB" vbase = "0x00040000" mode = "C_WU" clusterid = "3" psegname = "PSEG_RAM" > 192 <vobj name = "heap_routA" type = "BUFFER" length = "0x00010000" /> 193 </vseg> 194 <vseg name = "seg_stack_routB" vbase = "0x00070000" mode = "C_WU" clusterid = "3" psegname = "PSEG_RAM" > 192 195 <vobj name = "stack_routB" type = "BUFFER" length = "0x00010000" /> 193 </vseg> 194 <vseg name = "seg_mwmrs" vbase = "0x00050000" mode = "__WU" clusterid = "0" psegname = "PSEG_RAM" > 196 <vobj name = "heap_routB" type = "BUFFER" length = "0x00010000" /> 197 </vseg> 198 <vseg name = "seg_mwmrs" vbase = "0x00090000" mode = "__WU" clusterid = "0" psegname = "PSEG_RAM" > 195 199 <vobj name = "mwmr_in" type = "MWMR" length = "0x00000020" init = "1" /> 196 200 <vobj name = "mwmr_out" type = "MWMR" length = "0x00000020" init = "1" /> 197 201 </vseg> 198 202 199 <task name = "producer" clusterid = "0" proclocid = "0" stackname = "stack_prod" startid = "0" usetty = "1" />200 <task name = "consumer" clusterid = "1" proclocid = "0" stackname = "stack_cons" startid = "1" usetty = "1" />201 <task name = "router_A" clusterid = "2" proclocid = "0" stackname = "stack_routA" startid = "2" usetty = "1" />202 <task name = "router_B" clusterid = "3" proclocid = "0" stackname = "stack_routB" startid = "2" usetty = "1" />203 <task name = "producer" clusterid = "0" proclocid = "0" stackname = "stack_prod" heapname = "heap_prod" startid = "0" usetty = "1" /> 204 <task name = "consumer" clusterid = "1" proclocid = "0" stackname = "stack_cons" heapname = "heap_cons" startid = "1" usetty = "1" /> 205 <task name = "router_A" clusterid = "2" proclocid = "0" stackname = "stack_routA" heapname = "heap_routA" startid = "2" usetty = "1" /> 206 <task name = "router_B" clusterid = "3" proclocid = "0" stackname = "stack_routB" heapname = "heap_routB" startid = "2" usetty = "1" /> 203 207 </vspace> 204 208 … … 215 219 <vseg name = "seg_stack" vbase = "0x00010000" mode = "C_WU" clusterid = "1" psegname = "PSEG_RAM" > 216 220 <vobj name = "stack" type = "BUFFER" length = "0x00010000" /> 217 </vseg> 218 219 <task name = "main_hello" clusterid = "1" proclocid = "0" stackname = "stack" startid = "0" usetty = "1" /> 221 <vobj name = "heap" type = "BUFFER" length = "0x00010000" /> 222 </vseg> 223 224 <task name = "main_hello" clusterid = "1" proclocid = "0" stackname = "stack" heapname = "heap" startid = "0" usetty = "1" /> 220 225 </vspace> 221 226 … … 232 237 <vseg name = "seg_stack" vbase = "0x00010000" mode = "C_WU" clusterid = "2" psegname = "PSEG_RAM" > 233 238 <vobj name = "stack" type = "BUFFER" length = "0x00010000" /> 234 </vseg> 235 236 <task name = "main_pgcd" clusterid = "2" proclocid = "0" stackname = "stack" startid = "0" usetty = "1" /> 239 <vobj name = "heap" type = "BUFFER" length = "0x00010000" /> 240 </vseg> 241 242 <task name = "main_pgcd" clusterid = "2" proclocid = "0" stackname = "stack" heapname = "heap" startid = "0" usetty = "1" /> 237 243 </vspace> 238 244 … … 249 255 <vseg name = "seg_stack" vbase = "0x00010000" mode = "C_WU" clusterid = "3" psegname = "PSEG_RAM" > 250 256 <vobj name = "stack" type = "BUFFER" length = "0x00010000" /> 251 </vseg> 252 253 <task name = "main_display" clusterid = "3" proclocid = "0" stackname = "stack" startid = "0" usetty = "1" usefbdma = "1" /> 257 <vobj name = "heap" type = "BUFFER" length = "0x00010000" /> 258 </vseg> 259 260 <task name = "main_display" clusterid = "3" proclocid = "0" stackname = "stack" heapname = "heap" startid = "0" usetty = "1" usefbdma = "1" /> 254 261 </vspace> 255 262 </vspaceset> -
soft/giet_vm/mappings/exemple.xml
r215 r232 421 421 type = "BUFFER" 422 422 length = "0x00010000" /> 423 <vobj name = "heap_producer" 424 type = "BUFFER" 425 length = "0x00010000" /> 426 423 427 </vseg> 424 428 425 429 <vseg name = "seg_stack_consumer" 426 vbase = "0x000 20000"430 vbase = "0x00030000" 427 431 mode = "C_WU" 428 432 clusterid = "0" … … 431 435 type = "BUFFER" 432 436 length = "0x00010000" /> 437 <vobj name = "heap_consumer" 438 type = "BUFFER" 439 length = "0x00010000" /> 440 433 441 </vseg> 434 442 435 443 <vseg name = "seg_stack_router_A" 436 vbase = "0x000 30000"444 vbase = "0x00050000" 437 445 mode = "C_WU" 438 446 clusterid = "0" … … 441 449 type = "BUFFER" 442 450 length = "0x00010000" /> 451 <vobj name = "heap_router_A" 452 type = "BUFFER" 453 length = "0x00010000" /> 454 443 455 </vseg> 444 456 445 457 <vseg name = "seg_stack_router_B" 446 vbase = "0x000 40000"458 vbase = "0x00070000" 447 459 mode = "C_WU" 448 460 clusterid = "0" … … 451 463 type = "BUFFER" 452 464 length = "0x00010000" /> 465 <vobj name = "heap_router_B" 466 type = "BUFFER" 467 length = "0x00010000" /> 468 453 469 </vseg> 454 470 455 471 <vseg name = "seg_mwmr_channels" 456 vbase = "0x000 50000"472 vbase = "0x00090000" 457 473 mode = "__WU" 458 474 clusterid = "0" … … 472 488 proclocid = "0" 473 489 stackname = "stack_producer" 490 heapname = "heap_producer" 474 491 startid = "0" 475 492 usetty = "1" /> … … 479 496 proclocid = "1" 480 497 stackname = "stack_consumer" 498 heapname = "heap_consumer" 481 499 startid = "1" 482 500 usetty = "1" /> … … 486 504 proclocid = "2" 487 505 stackname = "stack_router_A" 506 heapname = "heap_router_A" 488 507 startid = "2" 489 508 usetty = "1" /> … … 493 512 proclocid = "3" 494 513 stackname = "stack_router_B" 514 heapname = "heap_router_B" 495 515 startid = "2" 496 516 usetty = "1" /> -
soft/giet_vm/sys/common.c
r231 r232 375 375 376 376 //////////////////////////////////////////////////////////////////////////// 377 // _get_ current_task_id()377 // _get_proc_task_id() 378 378 // This function returns the index of the currently running task. 379 379 //////////////////////////////////////////////////////////////////////////// 380 unsigned int _get_ current_task_id() {380 unsigned int _get_proc_task_id() { 381 381 static_scheduler_t * psched = (static_scheduler_t *) _get_sched(); 382 382 return _physical_read_access(&(psched->current)); … … 385 385 386 386 //////////////////////////////////////////////////////////////////////////// 387 // _set_ current_task_id()387 // _set_proc_task_id() 388 388 // This function returns the index of the currently running task. 389 389 //////////////////////////////////////////////////////////////////////////// 390 void _set_ current_task_id(unsigned int value) {390 void _set_proc_task_id(unsigned int value) { 391 391 static_scheduler_t * psched = (static_scheduler_t *) _get_sched(); 392 392 _physical_write_access(&(psched->current), value); 393 } 394 395 396 //////////////////////////////////////////////////////////////////////////// 397 // _get_global_task_id() 398 // This function returns the global index of the running task. 399 //////////////////////////////////////////////////////////////////////////// 400 unsigned int _get_global_task_id() { 401 return _get_context_slot(_get_proc_task_id(), CTX_GTID_ID); 393 402 } 394 403 -
soft/giet_vm/sys/common.h
r231 r232 60 60 unsigned int _get_interrupt_vector_entry(unsigned int index); 61 61 62 unsigned int _get_current_task_id(void); 63 void _set_current_task_id(unsigned int value); 62 unsigned int _get_proc_task_id(void); 63 void _set_proc_task_id(unsigned int value); 64 65 unsigned int _get_global_task_id(void); 66 64 67 65 68 unsigned int _get_tasks_number(void); -
soft/giet_vm/sys/ctx_handler.c
r231 r232 76 76 77 77 // get current task index 78 unsigned int curr_task_id = _get_ current_task_id();78 unsigned int curr_task_id = _get_proc_task_id(); 79 79 80 80 // select the next task using a round-robin policy … … 103 103 unsigned int * next_ctx_paddr = &(psched->context[next_task_id][0]); 104 104 105 _set_ current_task_id(next_task_id);105 _set_proc_task_id(next_task_id); 106 106 //_timer_reset_irq_cpt(cluster_id, local_id); // commented until not properly supported in soclib 107 107 // (the function is not yet present in drivers.c) -
soft/giet_vm/sys/ctx_handler.h
r231 r232 5 5 6 6 ///////////////////////////////////////////////////////////////////////////////// 7 // 7 // Definition of the scheduler structure 8 8 ///////////////////////////////////////////////////////////////////////////////// 9 9 10 typedef struct static_scheduler_s 11 { 12 unsigned int context[15][64]; // at most 15 task contexts 13 unsigned int tasks; // actual number of tasks 14 unsigned int current; // current task index 15 unsigned int interrupt_vector[32]; // interrupt vector 10 typedef struct static_scheduler_s { 11 unsigned int context[15][64]; // at most 15 task contexts 12 unsigned int tasks; // actual number of tasks 13 unsigned int current; // current task index 14 unsigned int interrupt_vector[32]; // interrupt vector 16 15 } static_scheduler_t; 17 16 … … 21 20 ///////////////////////////////////////////////////////////////////////////////// 22 21 23 #define IDLE_TASK_INDEX 22 #define IDLE_TASK_INDEX 14 24 23 25 24 ///////////////////////////////////////////////////////////////////////////////// 26 // 25 // Definition of the task context slots indexes 27 26 ///////////////////////////////////////////////////////////////////////////////// 28 27 29 #define CTX_SP_ID 30 #define CTX_RA_ID 28 #define CTX_SP_ID 29 29 #define CTX_RA_ID 31 31 30 32 #define CTX_EPC_ID 33 #define CTX_CR_ID 34 #define CTX_SR_ID 35 #define CTX_BVAR_ID 31 #define CTX_EPC_ID 32 32 #define CTX_CR_ID 33 33 #define CTX_SR_ID 34 34 #define CTX_BVAR_ID 35 36 35 37 #define CTX_PTPR_ID 36 #define CTX_PTPR_ID 39 38 37 39 #define CTX_TTY_ID 40 // Integer : global TTY terminal index 40 #define CTX_DMA_ID 41 // Integer : global DMA channel index 41 #define CTX_NIC_ID 42 // Integer : global NIC channel index 42 #define CTX_TIMER_ID 43 // Integer : user level timer index / UNUSED 43 #define CTX_PTAB_ID 44 // Pointer : page table virtual base adress 44 #define CTX_LTID_ID 45 // Integer : local task index (in scheduler) / UNUSED 45 #define CTX_VSID_ID 46 // Integer : vspace index 46 #define CTX_RUN_ID 47 // Boolean : task runable 38 #define CTX_TTY_ID 40 // Integer : global TTY terminal index 39 #define CTX_DMA_ID 41 // Integer : global DMA channel index 40 #define CTX_NIC_ID 42 // Integer : global NIC channel index 41 #define CTX_TIMER_ID 43 // Integer : user level timer index / UNUSED 42 #define CTX_PTAB_ID 44 // Pointer : page table virtual base adress 43 #define CTX_LTID_ID 45 // Integer : local task index (in scheduler) / UNUSED 44 #define CTX_VSID_ID 46 // Integer : vspace index 45 #define CTX_RUN_ID 47 // Boolean : task runable 46 #define CTX_GTID_ID 48 // Integer : Global task id 47 47 48 48 ////////////////////////////////////////////////////////////////////////////////// 49 // 49 // Prototype of the context switch function 50 50 ////////////////////////////////////////////////////////////////////////////////// 51 51 -
soft/giet_vm/sys/drivers.c
r228 r232 120 120 #if (NB_TIMERS_MAX > 0) 121 121 in_unckdata volatile unsigned char _user_timer_event[NB_CLUSTERS * NB_TIMERS_MAX] 122 = { [0 ... ((NB_CLUSTERS * NB_TIMERS_MAX) - 1)] = 0 };122 = { [0 ... ((NB_CLUSTERS * NB_TIMERS_MAX) - 1)] = 0 }; 123 123 #endif 124 124 … … 205 205 bloup++; // to avoid a warning 206 206 #else 207 unsigned int * timer_address = (unsigned int *) ((char *) &seg_tim_base +207 unsigned int * timer_address = (unsigned int *) ((char *) &seg_tim_base + 208 208 (cluster_id * CLUSTER_SIZE)); 209 209 … … 213 213 return 0; 214 214 } 215 216 217 //////////////////////////////////////////////// 218 // _timer_reset_irq_cpt() 219 //////////////////////////////////////////////// 220 //unsigned int _timer_reset_irq_cpt(unsigned int cluster_id, unsigned int local_id) { 221 // // parameters checking 222 // if ( cluster_id >= NB_CLUSTERS) return 1; 223 // if ( local_id >= NB_TIMERS_MAX ) return 2; 224 // 225 //#if USE_XICU 226 //#error // not implemented 227 //#else 228 // unsigned int * timer_address = (unsigned int *) ((char *) &seg_tim_base + (cluster_id * CLUSTER_SIZE)); 229 // 230 // timer_address[local_id * TIMER_SPAN + TIMER_RESETIRQ] = 1; 231 //#endif 232 // 233 // return 0; 234 //} 215 235 216 236 … … 264 284 unsigned int _tty_write(const char * buffer, unsigned int length) { 265 285 unsigned int nwritten; 266 unsigned int task_id = _get_ current_task_id();286 unsigned int task_id = _get_proc_task_id(); 267 287 unsigned int tty_id = _get_context_slot(task_id, CTX_TTY_ID); 268 288 … … 300 320 ////////////////////////////////////////////////////////////////////////////// 301 321 unsigned int _tty_read(char * buffer, unsigned int length) { 302 unsigned int task_id = _get_ current_task_id();322 unsigned int task_id = _get_proc_task_id(); 303 323 unsigned int tty_id = _get_context_slot(task_id, CTX_TTY_ID); 304 324 … … 567 587 568 588 // get user space page table virtual address 569 unsigned int task_id = _get_ current_task_id();589 unsigned int task_id = _get_proc_task_id(); 570 590 unsigned int user_pt_vbase = _get_context_slot(task_id, CTX_PTAB_ID); 571 591 … … 877 897 878 898 // get DMA channel and compute DMA vbase address 879 unsigned int task_id = _get_ current_task_id();899 unsigned int task_id = _get_proc_task_id(); 880 900 unsigned int dma_id = _get_context_slot(task_id, CTX_DMA_ID); 881 901 unsigned int cluster_id = dma_id / NB_DMAS_MAX; … … 1012 1032 unsigned int _dma_completed() { 1013 1033 #if NB_DMAS_MAX > 0 1014 unsigned int task_id = _get_ current_task_id();1034 unsigned int task_id = _get_proc_task_id(); 1015 1035 unsigned int dma_id = _get_context_slot(task_id, CTX_DMA_ID); 1016 1036 unsigned int dma_ret; … … 1246 1266 } 1247 1267 1268 /////////////////////////////////////////////////////////////////////////////////// 1269 // _heap_info() 1270 // This function returns the information associated to a heap (size and vaddr) 1271 // It uses the global task id (CTX_GTID_ID, unique for each giet task) and the 1272 // vspace id (CTX_VSID_ID) defined in the context 1273 /////////////////////////////////////////////////////////////////////////////////// 1274 unsigned int _heap_info(unsigned int * vaddr, unsigned int * size) { 1275 mapping_header_t * header = (mapping_header_t *) (&seg_mapping_base); 1276 mapping_task_t * tasks = _get_task_base(header); 1277 mapping_vobj_t * vobjs = _get_vobj_base(header); 1278 mapping_vspace_t * vspaces = _get_vspace_base(header); 1279 unsigned int taskid = _get_context_slot(_get_proc_task_id(), CTX_GTID_ID); 1280 unsigned int vspaceid = _get_context_slot(_get_proc_task_id(), CTX_VSID_ID); 1281 int heap_local_vobjid = tasks[taskid].heap_vobjid; 1282 if (heap_local_vobjid != -1) { 1283 unsigned int vobjheapid = heap_local_vobjid + vspaces[vspaceid].vobj_offset; 1284 *vaddr = vobjs[vobjheapid].vaddr; 1285 *size = vobjs[vobjheapid].length; 1286 return 0; 1287 } 1288 else { 1289 *vaddr = 0; 1290 *size = 0; 1291 return 0; 1292 } 1293 } 1294 1248 1295 // Local Variables: 1249 1296 // tab-width: 4 -
soft/giet_vm/sys/drivers.h
r228 r232 113 113 114 114 115 /////////////////////////////////////////////////////////////////////////////////// 116 // Heap related function(s) 117 /////////////////////////////////////////////////////////////////////////////////// 118 119 unsigned int _heap_info(unsigned int * vaddr, unsigned int * size); 120 121 115 122 #endif 116 123 -
soft/giet_vm/sys/exc_handler.c
r228 r232 70 70 _get_lock(&_tty_put_lock); 71 71 _puts("\n[GIET] Exception for task "); 72 _putd(_get_ current_task_id());72 _putd(_get_proc_task_id()); 73 73 _puts(" on processor "); 74 74 _putd(_procid()); … … 86 86 87 87 // goes to sleeping state 88 unsigned int task_id = _get_ current_task_id();88 unsigned int task_id = _get_proc_task_id(); 89 89 _set_context_slot( task_id, CTX_RUN_ID, 0); 90 90 -
soft/giet_vm/sys/sys_handler.c
r231 r232 30 30 &_gcd_write, /* 0x06 */ 31 31 &_gcd_read, /* 0x07 */ 32 &_ sys_ukn,/* 0x08 */33 &_get_ current_task_id,/* 0x09 */34 &_ sys_ukn, /* 0x0A */32 &_heap_info, /* 0x08 */ 33 &_get_proc_task_id, /* 0x09 */ 34 &_get_global_task_id, /* 0x0A */ 35 35 &_sys_ukn, /* 0x0B */ 36 36 &_sys_ukn, /* 0x0C */ … … 77 77 unsigned int date = _proctime(); 78 78 unsigned int proc_id = _procid(); 79 unsigned int task_id = _get_ current_task_id();79 unsigned int task_id = _get_proc_task_id(); 80 80 81 81 // print death message -
soft/giet_vm/xml/mapping_info.h
r228 r232 178 178 unsigned int clusterid; // physical cluster index 179 179 unsigned int proclocid; // processor local index (inside cluster) 180 unsigned int vobjlocid; // stack vobj index in vspace 180 unsigned int stack_vobjid; // stack vobj index in vspace 181 unsigned int heap_vobjid; // heap vobj index in vspace 181 182 unsigned int startid; // index in start_vector 182 183 unsigned int use_tty; // TTY terminal required (global) … … 229 230 unsigned int direction; // TO_COPROC == 0 / FROM_COPROC == 1 230 231 unsigned int vspaceid; // index of the vspace containing the MWMR channel 231 unsigned int vobjlocid; // local index of the vobj containing the MWMR channel232 unsigned int mwmr_vobjid; // local index of the vobj containing the MWMR channel 232 233 } mapping_cp_port_t; 233 234 -
soft/giet_vm/xml/xml_driver.c
r228 r232 271 271 port_id < coproc[coproc_id].port_offset + coproc[coproc_id].ports; 272 272 port_id++) { 273 unsigned int vobj_id = cp_port[port_id]. vobjlocid + vspace[cp_port[port_id].vspaceid].vobj_offset;273 unsigned int vobj_id = cp_port[port_id].mwmr_vobjid + vspace[cp_port[port_id].vspaceid].vobj_offset; 274 274 fprintf(fpout, " <port direction = \"%s\" ", port_direction[cp_port[port_id].direction]); 275 275 fprintf(fpout, " vspacename = \"%s\" ", vspace[cp_port[port_id].vspaceid].name); … … 353 353 task_id < (vspace[vspace_id].task_offset + vspace[vspace_id].tasks); 354 354 task_id++) { 355 unsigned int vobj_id = task[task_id].vobjlocid + vspace[vspace_id].vobj_offset; 355 unsigned int stack_vobj_id = task[task_id].stack_vobjid + vspace[vspace_id].vobj_offset; 356 unsigned int heap_vobj_id = task[task_id].heap_vobjid + vspace[vspace_id].vobj_offset; 356 357 357 358 fprintf(fpout, " <task name = \"%s\" ", task[task_id].name); 358 359 fprintf(fpout, "clusterid = \"%d\" ", task[task_id].clusterid); 359 360 fprintf(fpout, "proclocid = \"%d\" ", task[task_id].proclocid); 360 fprintf(fpout, "stackname = \"%s\" ", vobj[vobj_id].name); 361 fprintf(fpout, "stackname = \"%s\" ", vobj[stack_vobj_id].name); 362 if (heap_vobj_id != -1) { 363 fprintf(fpout, "heapname = \"%s\" ", vobj[heap_vobj_id].name); 364 } 361 365 fprintf(fpout, "startid = \"%d\" ", task[task_id].startid); 362 366 fprintf(fpout, "usetty = \"%d\" ", task[task_id].use_tty); -
soft/giet_vm/xml/xml_parser.c
r231 r232 109 109 unsigned int cluster_y = 0; 110 110 unsigned int cluster_x = 0; 111 unsigned int nb_proc_max = 0; // max number of processors per cluster 111 unsigned int nb_proc_max = 0; // max number of processors per cluste 112 113 unsigned int nb_tasks_max = 0; // max number of tasks (for all vspaces) 112 114 unsigned int nb_timer_channel_max = 0; // max number of user timer 113 115 unsigned int nb_dma_channel_max = 0; … … 350 352 printf(" stackid = %d\n", index); 351 353 #endif 352 task[task_index]-> vobjlocid = index;354 task[task_index]->stack_vobjid = index; 353 355 } 354 356 else { … … 363 365 exit(1); 364 366 } 367 368 ////////// get heap attribute 369 str = getStringValue(reader, "heapname", &ok); 370 if (ok) { 371 int index = getVobjLocId(vspace_index, str, vobj_loc_index); 372 if (index >= 0) { 373 #if XML_PARSER_DEBUG 374 printf(" heapname = %s\n", str); 375 printf(" heapid = %d\n", index); 376 #endif 377 task[task_index]->heap_vobjid = index; 378 } 379 else { 380 printf("[XML ERROR] illegal or missing <heapname> for task (%d,%d)\n", vspace_index, task_loc_index); 381 exit(1); 382 } 383 } 384 else { 385 task[task_index]->heap_vobjid = -1; 386 } 387 365 388 366 389 ////////// get startid attribute … … 715 738 char * str; 716 739 unsigned int ok; 740 unsigned int nb_task_vspace = 0; 717 741 718 742 vobj_loc_index = 0; … … 782 806 else if (strcmp(tag, "task") == 0) { 783 807 taskNode(reader); 808 nb_task_vspace++; 784 809 } 785 810 else if (strcmp(tag, "#text") == 0) { } … … 818 843 } 819 844 845 nb_tasks_max += nb_task_vspace; 820 846 vspace_index++; 821 847 return; … … 1934 1960 printf(" vobj_index = %d\n", vobj_id); 1935 1961 #endif 1936 cp_port[i]-> vobjlocid = vobj_id;1962 cp_port[i]->mwmr_vobjid = vobj_id; 1937 1963 1938 1964 assert((vobj[ vspace[vspace_id]->vobj_offset + vobj_id]->type == VOBJ_TYPE_MWMR) … … 1990 2016 def_int_write(fdout, "NB_IOCS" , nb_ioc_channel); 1991 2017 def_int_write(fdout, "NB_NICS" , nb_nic_channel); 2018 def_int_write(fdout, "NB_TASKS" , nb_tasks_max); 1992 2019 1993 2020 file_write(fdout, "\n");
Note: See TracChangeset
for help on using the changeset viewer.