emin_int11

vol 999999999.99 :P

Jan 9th, 2016
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.82 KB | None | 0 0
  1. during Python opcode execution cycle ;P
  2.  
  3. LOAD_CLOSURE === >
  4.  
  5. g:
  6. 00000000 88 (00 00 = 000000AD STR: 'a' (01 00 00 00 61)) - LOAD_DEREF
  7. 00000003 64 (01 00 = 00000099 INT: 1 (01 00 00 00)) - LOAD_CONST
  8. 00000006 17 - BINARY_ADD
  9. 00000007 53 - RETURN_VALUE
  10.  
  11. f:
  12. 00000000 64 (01 00 = 00000070 INT: 1 (01 00 00 00)) - LOAD_CONST
  13. 00000003 89 (00 00 = 000000FF STR: 'a' (00 00 00 00)) - STORE_DEREF
  14. 00000006 87 (00 00 = 000000FF STR: 'a' (00 00 00 00)) - LOAD_CLOSURE
  15. 00000009 66 (01 00) - BUILD_TUPLE
  16. 0000000C 64 (02 00 = 00000075 CODE(g)) - LOAD_CONST
  17. 0000000F 86 (00 00) - MAKE_CLOSURE
  18. 00000012 7D (00 00 = 000000F0 STR: 'g' (01 00 00 00)) - STORE_FAST
  19. 00000015 7C (00 00 = 000000F0 STR: 'g' (01 00 00 00)) - LOAD_FAST
  20. 00000018 83 (00 00) - CALL_FUNCTION
  21. 0000001B 53 - RETURN_VALUE
  22.  
  23. <module>:
  24. 00000000 64 (00 00 = 00000038 CODE(f)) - LOAD_CONST
  25. 00000003 84 (00 00) - MAKE_FUNCTION
  26. 00000006 5A (00 00 = 0000013C STR: 'f' (02 00 00 00)) - STORE_NAME
  27. 00000009 65 (00 00 = 0000013C STR: 'f' (02 00 00 00)) - LOAD_NAME
  28. 0000000C 83 (00 00) - CALL_FUNCTION
  29. 0000000F 47 - PRINT_ITEM
  30. 00000010 48 - PRINT_NEWLINE
  31. 00000011 64 (01 00 = 00000136 None (4E)) - LOAD_CONST
  32. 00000014 53 - RETURN_VALUE
  33.  
  34.  
  35. ref: http://unpyc.sourceforge.net/Opcodes.html
  36. Tesekkur PYTHON Out order execution paradiqma istifade etmirsen :)
  37.  
  38. ortaya barriers gelir )) Gel ASM (C compatible) uzerinde baxaq
  39.  
  40. Ilk atomic execution tesirine baxiram )
  41.  
  42. CPU 1 ==== CPU 2
  43. STORE ==== > 0xde |||||| STORE === > 0x39
  44. WTF? ((out of ordering prosesi :P)
  45. LOAD ==== > 0x45 |||||| LOAD === > 0x11
  46.  
  47. Intel architecture instruction set loading ve storing emeliyyatlarini 1-opcode cycle ile hell edir foreverr.
  48. Interpreter execution sirasinda L[1-3] cache dump edirem hemcinin TLB (QEMU uzerinde oz yazdigim dump_TLB funskiya ile)
  49.  
  50.  
  51. PAGE_SHIFTING sonrasi, umumilikde 13 instruction (29 cycle) ise dusdu ve TLB memory addressingi buradan edir. PAGE_SIZE(4kb)>>=PAGE_SHIFT
  52. VPN_lere baxiram
  53.  
  54. L2 TLB/cache information: 4K pages & L2 TLB (0x80000006/ebx):
  55.  
  56. ==== > VPN 02
  57. 1 cycle
  58. | opcode | prefix | opcode | lock | opcode |
  59. al buda sene performance :P
  60.  
  61.  
  62. Logical CPU cores (0x80000008/ecx):
  63. number of CPU cores - 1 = 0x0 (0)
  64. ApicIdCoreIdSize = 0x0 (0)
  65.  
  66. APIC IRQ gondererek (on qemu) ordering-e baxiram
  67. extended APIC ID = 1
  68. --- level 1 (core) ---
  69. bits to shift APIC ID to get next = 0x1 (1)
  70. logical processors at this level = 0x2 (2)
  71.  
  72. on abstract machine (VMX dependable) :P
  73.  
  74. CPU 1 ==== CPU 2
  75. LOAD ==== > 0x11 |||||| STORE === > 0x39
  76. WTF? ((movement ilk once load etdi)
  77. LOAD ==== > 0x45 |||||| STORE === > 0xde
  78.  
  79.  
  80. sizin ucun teorik instruction parallelism grafikide cekim gorun performans nece olur :) (RISC based)
  81.  
  82. +----+----+----+-----+----+
  83. | IF | ID | EX | MEM | WB | <-------------- 1ci opcode
  84. +----+----+----+-----+----+----+
  85. | IF | ID | EX | MEM| WB | <----------- 2ci opcode
  86. +----+----+-----+----+----+----+
  87. | IF | ID | EX | MEM| WB | <------ 3cu opcode
  88. +----+-----+----+----+----+
  89. ...... ve s.
  90.  
  91.  
  92. ancaq gcc default olaraq SMP barriers disable edir (reordering depended) :P (buda boyuk proektlerde concurrency ve s. ( such as RCU) qarisiqliq yaradir buda cox vaxt EXCEPTION trigger edir (#GP ve s.)).
  93.  
  94. Hemcinin NUMA based processor mene imkan verirki atomic (core depended) memory management edim.
  95.  
  96. core-lar ayriliqda paralel olaraq bank-lara ve node-lara icazesi var.
  97. Sandybrigde processor ======== binary-ni guest machine uzerinde ise saliram VMX state-de 1 CORE,1 node (BANK) NORMAL(ZOne) zonasini mapped edir.
  98. fucking shiiiiitttt
  99.  
  100. Node 0, zone Normal
  101. pages free 115253
  102. min 9355
  103. low 11693
  104. high 14032
  105. scanned 0
  106. spanned 192495
  107. present 192495
  108. managed 188524
  109. nr_free_pages 115253
  110. nr_alloc_batch 1009
  111. nr_inactive_anon 12802
  112. nr_active_anon 16307
  113. nr_inactive_file 16056
  114. nr_active_file 16960
  115. nr_unevictable 14
  116. nr_mlock 14
  117. nr_shmem 668
  118.  
  119. infinitive loop prosesinde memory statistikasina baxiram )
  120. zone watermarks 1 structure ile 3 memory addr ile zone balance trace edir low state-de (page_free,page_min) reclaim edilir. (kswapd woken up :P) - (zone->free_pages = low :( .... pages_min=reclaim)
  121. Cunki hemcinin ABI mapped (sections,header(program)) edirem :P
  122. buna gorede 2ci prosedura gelirem :) (VDSO mapping blah blah)
  123.  
  124. kernel (load_elf_binary()) funksiyasi ELF parsing edir.
  125.  
  126. 571 static int load_elf_binary(struct linux_binprm *bprm)
  127. 572 {
  128. 573 struct file *interpreter = NULL; /* to shut gcc up */
  129. 574 unsigned long load_addr = 0, load_bias = 0;
  130. 575 int load_addr_set = 0;
  131. 576 char * elf_interpreter = NULL;
  132. 577 unsigned long error;
  133. 578 struct elf_phdr *elf_ppnt, *elf_phdata;
  134. 579 unsigned long elf_bss, elf_brk;
  135. 580 int retval, i;
  136. 581 unsigned int size;
  137. 582 unsigned long elf_entry;
  138. 583 unsigned long interp_load_addr = 0;
  139. 584 unsigned long start_code, end_code, start_data, end_data;
  140. 585 unsigned long reloc_func_desc __maybe_unused = 0;
  141. 586 int executable_stack = EXSTACK_DEFAULT;
  142. 587 struct pt_regs *regs = current_pt_regs();
  143. 588 struct {
  144. 589 struct elfhdr elf_ex;
  145. 590 struct elfhdr interp_elf_ex;
  146. 591 } *loc;
  147. 592
  148. 593 loc = kmalloc(sizeof(*loc), GFP_KERNEL);
  149. 594 if (!loc) {
  150. 595 retval = -ENOMEM;
  151. 596 goto out_ret;
  152. 597 }
  153. 598
  154. 599 /* Get the exec-header */
  155. 600 loc->elf_ex = *((struct elfhdr *)bprm->buf);
  156. 601
  157. 602 retval = -ENOEXEC;
  158. 603 /* First of all, some simple consistency checks */
  159. 604 if (memcmp(loc->elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
  160. 605 goto out;
  161. 606
  162. 607 if (loc->elf_ex.e_type != ET_EXEC && loc->elf_ex.e_type != ET_DYN)
  163. 608 goto out;
  164. 609 if (!elf_check_arch(&loc->elf_ex))
  165. 610 goto out;
  166. 611 if (!bprm->file->f_op->mmap)
  167. 612 goto out;
  168. ........
  169. ^
  170. | (ELF Handling)
  171. |
  172.  
  173. Hemcinin her process space-e dynamic symbol mapping edir
  174. 29: 080495f0 0 OBJECT LOCAL DEFAULT 21 __JCR_LIST__
  175. 30: 08048330 0 FUNC LOCAL DEFAULT 14 deregister_tm_clones
  176. 31: 08048360 0 FUNC LOCAL DEFAULT 14 register_tm_clones
  177. 32: 080483a0 0 FUNC LOCAL DEFAULT 14 __do_global_dtors_aux
  178. 33: 080496fc 1 OBJECT LOCAL DEFAULT 26 completed.6584
  179. 34: 080495ec 0 OBJECT LOCAL DEFAULT 20 __do_global_dtors_aux_fin
  180. 35: 080483c0 0 FUNC LOCAL DEFAULT 14 frame_dummy
  181. 36: 080495e8 0 OBJECT LOCAL DEFAULT 19 __frame_dummy_init_array_
  182. 37: 00000000 0 FILE LOCAL DEFAULT ABS test.c
  183. 38: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
  184. 39: 080485e4 0 OBJECT LOCAL DEFAULT 18 __FRAME_END__
  185. 40: 080495f0 0 OBJECT LOCAL DEFAULT 21 __JCR_END__
  186. 41: 00000000 0 FILE LOCAL DEFAULT ABS
  187. 42: 080495ec 0 NOTYPE LOCAL DEFAULT 19 __init_array_end
  188. 43: 080495f4 0 OBJECT LOCAL DEFAULT 22 _DYNAMIC
  189. 44: 080495e8 0 NOTYPE LOCAL DEFAULT 19 __init_array_start
  190. 45: 080484c8 0 NOTYPE LOCAL DEFAULT 17 __GNU_EH_FRAME_HDR
  191. 46: 080496e0 0 OBJECT LOCAL DEFAULT 24 _GLOBAL_OFFSET_TABLE_
  192. 47: 080484a0 2 FUNC GLOBAL DEFAULT 14 __libc_csu_fini
  193. 48: 08048320 4 FUNC GLOBAL HIDDEN 14 __x86.get_pc_thunk.bx
  194. 49: 080496f4 0 NOTYPE WEAK DEFAULT 25 data_start
  195. 50: 00000000 0 FUNC GLOBAL DEFAULT UND printf@@GLIBC_2.0
  196. 51: 080496fc 0 NOTYPE GLOBAL DEFAULT 25 _edata
  197. 52: 080484a4 0 FUNC GLOBAL DEFAULT 15 _fini
  198. 53: 080496f4 0 NOTYPE GLOBAL DEFAULT 25 __data_start
  199. 54: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
  200. 55: 080496f8 0 OBJECT GLOBAL HIDDEN 25 __dso_handle
  201. 56: 080484bc 4 OBJECT GLOBAL DEFAULT 16 _IO_stdin_used
  202. 57: 00000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_
  203. 58: 08048440 93 FUNC GLOBAL DEFAULT 14 __libc_csu_init
  204. 59: 08049700 0 NOTYPE GLOBAL DEFAULT 26 _end
  205. 60: 080482f0 0 FUNC GLOBAL DEFAULT 14 _start
  206. 61: 080484b8 4 OBJECT GLOBAL DEFAULT 16 _fp_hw
  207. 62: 080496fc 0 NOTYPE GLOBAL DEFAULT 26 __bss_start
  208. 63: 08048418 32 FUNC GLOBAL DEFAULT 14 main
  209. 64: 080483eb 45 FUNC GLOBAL DEFAULT 14 function
  210. 65: 080496fc 0 OBJECT GLOBAL HIDDEN 25 __TMC_END__
  211. 66: 0804828c 0 FUNC GLOBAL DEFAULT 11 _init
  212.  
  213.  
  214. performance WTFFF? :)
Advertisement
Add Comment
Please, Sign In to add comment