Microsoft Word - ExecutionStack

Size: px
Start display at page:

Download "Microsoft Word - ExecutionStack"

Transcription

1 Lecture 15: LM code from high level language /* Simple Program */ external int get_int(); external void put_int(); int sum; clear_sum() { sum=0; int step=2; main() { register int i; static int count; clear_sum(); count = get_int(); for (i=0; i<count; i+=step) sum += i; put_int(sum); External declarations Uninitialized global variable Initialized global variable Register local variable Static local variable Memory Allocation Stack Heap SS sum: uninitialized global count: uninitialized local static Data 하드디스크에저장된실행파일 step: initialized global 0: constant Text

2 다음은앞의 source program 을 target code 를 LM 로하여 compile 한것이다. 여기서 MOV 는 LD, ST, MOVE 를합한형태의 mnemonic code 인데 LM 기계어가새로정의된것은아니고단순히 assembly language 차원에서정의된것이다. 이를 <1xx>, <2xx> 등으로번역할수있는 smart assembler 가있다고가정한다. // Simple Program SIMPLE START 0 ETDEF SUM LEARSUM STEP MAIN ETREF GET_INT PUT_INT FIRST MOV SP, #STK_TM We have a smart assembler! ALL MAIN O HEAP RESDO 500 STK_TM EQU $ SUM RESDO 1 int sum; LEARSUM MOV A, =0 MOV SUM, A sum = 0; STEP DO 2 int step=2; MAIN ALL LEARSUM clear_sum(); ALL GET_INT MOV OUNT, A count = get_int(); MOV, =0 register int i; i=0; FORLOOP MOV A, SUM for ( ) ADD A, MOV SUM, A sum += i; ADD, STEP i += step; MOV, OUNT SU, JP FORLOOP i < count MOV A, SUM ALL PUT_INT put_int(sum); OUNT RESDO 1 static int count; END FIRST 이 code 는프로그램과데이터가섞여있으므로메모리를 segment 별로관리하는것을어렵게한다. 따라서

3 // Simple Program SIMPLE START 0 ETDEF SUM LEARSUM STEP MAIN ETREF GET_INT PUT_INT USE TET // (A) FIRST MOV SP, #STK_TM We have a smart assembler! ALL MAIN O USE DATA USE SS USE STAK // () HEAP RESDO 500 STK_TM EQU $ USE SS // () SUM RESDO 1 int sum; USE TET // (D) LEARSUM MOV A, =0 MOV SUM, A sum=0; USE DATA // (E) STEP DO 2 int step=2; USE TET // (F) MAIN ALL LEARSUM clear_sum(); ALL GET_INT MOV OUNT, A count=getint(); MOV, =0 register int i; i=0; FORLOOP MOV A, SUM for ( ) ADD A, MOV SUM, A sum += i; ADD, STEP i += step; MOV, OUNT SU, JP FORLOOP i < count MOV A, SUM ALL PUT_INT put_int(sum) USE SS // (G) OUNT RESDO 1 static int counter; USE DATA // (H) LTORG END FIRST

4 After Loading to Memory FIRST LEARSUM MAIN FORLOOP (A) (D) (F) TET STEP (E) =0 (H) SUM () OUNT (G) HEAP DATA SS HDD () STAK STK_TM SP After execution of the first instruction

5 Static lass Symbol 의 Memory Allocation /* Simple Program 2 */ external int get_int(); external int put_int(); int sum; add_two 는이모듈밖에서는정의되지않는다. static int add_two(int a, int b) { return a+b; step 은이모듈밖에서는정의되지않는다. static int step=2; main() { register int i; ount 는 main 에서만보이는지역 static int count; 변수이지만 main 이끝난후에도값을유지한다. sum=0; count = get_int(); for(i=0; i<count; i+=step) sum = add_two(sum,i); put_int(sum); Global symbol (function, variable) 을 static class 로하면해당 module 안으로 scope 가한정된다. 즉다른 module 에서는이 symbol 의존재를모른다. Local variable 을 static class 로하면 scope 는그대로 local 이지만 life time 은 global variable 과같이프로그램의종료까지연장된다.

6 Activation Record. P for add_two Return Addr to main sum i P for main Return Addr to FIRST P for first (null) SP P 각함수호출을위한 activation record 는현재의 register 가가리키는곳에서시작한다. 따라서호출된함수를위한 argument 들은바로아래에저장된 Return Address 를감안할때 %4, %6. %8 순으로저장되어있다. %-2, %-4, 등위쪽은 local auto variable 을위한공간이다. 이 auto variable 들은함수가 return 될때 "MOV SP, " 에의해서소멸되어버린다. 그리고 local auto variable 위의공간은 register 를 save 하는등의임시목적으로활용된다. temporary location.. local auto variables.. previous P return address urrent P arguments 각 activation record 의 ase 들은 register 를시작으로하여 linked list 를형성하여함수가 return 된후에돌아갈환경을기억하고있다. 각함수를호출하기전에는그함수를위한 argument 를역순으로 stack 에 push 하여전달하고 return 값은 A register 를통해서전달한다. Return 된후에는 Stack Pointer 를조정하여 push 된 argument 를제거한다.

7 SIMPLE2 START 0 ETREF GET_INT PUT_INT ETDEF SUM MAIN USE TET FIRST MOV SP, #STK_TM MOV, =0 ALL MAIN O USE DATA USE SS USE STAK HEAP RESDO 100 STK_TM EQU $ USE SS SUM RESDO 1 ADD_TWO 와 STEP 은 static 이므로제외된다. HEAP STK_TM SP ADD_TWO USE TET PUSH MOV, SP PUSH PUSH save registers MOV,%4 get the first argument ADD,%6 get the second argument MOV A, return the result via A register restore registers MOV SP, USE DATA STEP DO 2 각함수에서는시작할때모든 register 를 save 하였다가끝날때다시 restore 함으로서함수안에서 register 의사용을자유롭게한다. 그런데, SP 는 activation record 와관련된특수목적이있고, A 는 return value 를담기로하였으므로, 만 save/restore 하면된다. 함수안에서 A,, SP register 를임시로사용할때는극도로주의가필요하다.

8 MAIN USE TET PUSH MOV, SP MOV A, =0 MOV SUM, A ALL GET_INT MOV OUNT, A MOV, =0 i=0; FORLOOP PUSH push i MOV A, SUM 함수에서 return 된후 argument 를 push sum 제거하기위한것이다 ALL ADD_TWO ADD SP, =4 adjust SP MOV SUM, A sum = add_two(sum,i); ADD, STEP i+=step; MP, OUNT i - count JN FORLOOP i < count MOV A, SUM ALL PUT_INT ADD SP, =2 adjust SP MOV SP, USE SS OUNT RESDO 1 USE DATA LTORG END FIRST OUNT 는 main 의 local variable 이지만 life time 을연장하기위해서 SS block 으로 allocation 된다.

9 Local auto variable 의 memory allocation /* Simple Program 2 */ external int get_int(); external int put_int(); int sum; int add_two(int a, int b) { int tmp; tmp = a+b; return tmp; local auto variable stack 영역에자리잡는다. static step=2; main() { register int i; static int count; sum=0; count = get_int(); for(i=0; i<count; i+=step) sum = add_two(sum,i); put_int(sum); 새로운 activation record 를준비한다. SP tmp %-2 P old P Return Addr argument 1 %4 argument 2 %6 urrent activation record USE TET ADD_TWO PUSH SNAP11 MOV, SP SNAP12 SU SP, =2 for the local auto variable tmp SNAP13 PUSH PUSH 사용된 activation record 를제거한다. Argument 는그대로남아있으므로 return 된후 SP 를 adjust 하여제거한다. MOV,%4 get the first argument ADD,%6 get the second argument MOV %-2, store the result to tmp MOV A, %-2 return the result via A register MOV SP, SNAP14 SNAP15 SP P tmp old P Return Addr argument 1 argument 2 another old P %-2 urrent activation record

10 앞의 ADD_TWO 를다음과같이호출한다면 // x = add_two(1,2); MOV A, =2 push the second argument SNAP1 MOV A, =1 push the first argument SNAP2 ALL ADD_TWO SNAP3 ADD SP, =4 adjust SP to remove arguments SNAP4 At SNAP1 (push the second argument) SP: 2 : RA %-2 %4 At SNAP2 (push the first argument) 1 SP: 2 : RA %-2 %4

11 At ADD_TWO (after ALL ADD_TWO) ALL 에의해 push 됨 1 SP: 2 : RA %-2 %4 At SNAP11 (after PUSH ) 1 SP: 2 : RA %-2 %4 이전 activation record 를기억하기위함

12 At SNAP12 (after MOV, SP) 1 %4 SP: 2 %6 activation record 새로형성됨 가 : RA At SNAP13 (after SU SP, =2) %-2 local auto variable tmp 1 %4 새로형성된 activation SP: 2 %6 record 에 local variable 을위한공간을만듬 : RA

13 At SNAP14 (after MOV SP, ) tmp is removed 1 %4 우선 local variable 들을 SP: 2 %6 제거함 : RA At SNAP15 (after ) 1 SP: 2 : RA %-2 %4 Pop 을통해서이전 activation record 로돌아감아직 return address 와 argument 들은남아있음

14 At SNAP3 (after ) 1 SP: 2 : RA Return addr is poped %-2 %4 에의해서 이 pop 되므로 SP 가한칸아래를가리킴을주의할것 At SNAP4 (after ADD SP, =4) 1 SP: 2 : RA %-2 %4 Arguments are removed. 최종적으로 argument 들을 stack 에서제거하여 top 에있던 activation record 를완전히제거함

15 여러가지함수의호출 /* A example of three function calls */ external void put_int(); SP a %-4 b %-2 P Old P RA // argument 는없고 local auto variable 이 2 개 static int func_one() { int a=1; int b=2; return fun_two(a,b,3) + 4; // 3 개의 argument static int func_two(int x, int y, int z) { return func_three(x+y,z)+5; // 2 개의 argumrnt 와 2 개의 local variable int func_three(int x, int y) { int a=6; int b; b = x+y; return a+b; main() { int r; r = func_one(); put_int(r); Local variable a,b 는각각 %-4, %-2 로 reference 된다. P,SP Old P RA x %4 y %6 z %8 Argument x,y,z 는각각 %4,%6,%8 로 reference 된다. SP a %-4 b %-2 P Old P RA x %4 y %6 Argument x,y 는 %4,%6 으로 local variable a,b 는 %-4, %-2 로 reference 된다.

16 THREE START 0 ETDEF ETREF MAIN FUN_THREE PUT_INT USE TET FIRST MOV SP, #STK_TM MOV, =0 ALL MAIN O USE DATA USE SS USE STAK HEAP RESO 500 STK_TM EQU $ MAIN SNAP1 PUSH MOV, SP SU SP, =2 int r; PUSH PUSH save registers SNAP1-2 ALL FUN_ONE MOV %-2, A r = func_one(); MOV A, %-2 ALL PUT_INT put_print(r); ADD SP, =2 SP %-2 r of main 0 SP 0 FUN_ONE 의 argument 가아니라 temporary location 으로사용한것임 %-2 r of main restore registers MOV SP,

17 FUN_ONE SNAP2 PUSH MOV, SP SU SP, =4 int a; int b; PUSH PUSH MOV A, =1 MOV %-4, A a=1; MOV A, =2 MOV %-2, A b=2; SP %-4 a of func_one %-2 b of func_one r of main 0 MOV A, =3 push 3 MOV A, %-2 push b MOV A, %-4 push a ALL FUN_TWO RA2 ADD SP, =6 ADD A, =4 MOV SP,

18 FUN_TWO SNAP3 PUSH MOV, SP PUSH PUSH MOV A, %8 push z MOV A, %4 ADD A, %6 push x+y ALL FUN_THREE RA3 SNAP6 ADD SP, =4 SNAP7 ADD A, =5,SP Old RA2 1(a) %4 x of func_two 2(b) %6 y of func_two 3 %8 z of func_two 1 a of func_one 2 b of func_one Old r of main 0 MOV SP, SP Old RA2 1(a) %4 x of func_two 2(b) %6 y of func_two 3 %8 z of func_two 1 a of func_one 2 b of func_one Old r of main 0 SP 3(x+y) x of func three 3(z) y of func_three Old RA2 1(a) %4 x of func_two 2(b) %6 y of func_two 3 %8 z of func_two 1 a of func_one 2 b of func_one Old r of main 0

19 FUN_THREE PUSH MOV, SP SU SP, =4 int a; int b; SNAP4 PUSH PUSH SNAP5 MOV A, =6 MOV %-4, A a=6; MOV A, %4 x ADD A, %6 +y MOV %-2, A b = x+y; MOV A, %-4 ADD A, %-2 a+b MOV SP, SP %-4 a of func_three %-2 b of func_three Old RA3 3(x+y) %4 x of func three 3(z) %6 y of func_three Old RA2 1(a) x of func_two 2(b) y of func_two 3 z of func_two 1 a of func_one 2 b of func_one Old r of main 0 USE DATA LTORG END FIRST SP RA3 3(x+y) x of func three 3(z) y of func_three Old RA2 1(a) %4 x of func_two 2(b) %6 y of func_two 3 %8 z of func_two 1 a of func_one 2 b of func_one Old r of main 0

20 Pointer 의처리및 Recursive Function /* Recursive Function */ external int GET_INT(); external PUT_INT(); int sum; rec_add(int *pcount, int n) { int result; (*pcount)++; if (n==0) return 0; else { result = n + rec_add(pcount, n-1); return result; SP result %-2 P old P RA pcount %4 n %6 Argument pcount, n 은각각 %4, %6 으로 local variable result 는 %-2 로 reference 된다. int count=0; main() { register int n; sum=0; n=get_int(); PUT_INT(rec_add(&count,n)); PUT_INT(count); 이함수가몇번호출되었는지센다

21 OUNT 0 DATA lock // Recursive Function RE START 0 ETDEF SUM RE_ADD OUNT MAIN ETREF GET_INT PUT_INT USE TET FIRST MOV SP, #STK_TM MOV, =0 ALL MAIN O USE DATA USE SS USE STAK HEAP RESO 500 STK_TM EQU $ USE SS SUM RESDO 1 RE_ADD SNAP2 USE TET PUSH MOV, SP SU SP, =2 PUSH PUSH SP %-2 result of rec_add Old OUNT %4 pcount of rec_add 2(n) %6 n of rec_add 0 The first call of rec add OUNT 1 DATA lock SP %-2 result of rec_add Old RA2 OUNT %4 pcount of rec_add 1(n-1) %6 n of rec_add result of rec_add Old OUNT pcount of rec_add 2(n) n of rec_add 0 The second call of rec_add MOV, %4 MOV A, * ADD A, =1 MOV *, A, (*pcount)++ MOV A, %6 MP A, =0 n==0? JNE ELSE MOV SP, RT_THEN return 0; OUNT 2 DATA lock SP %-2 result of rec_add Old RA2 OUNT %4 pcount of rec_add 0(n-1) %6 n of rec_add result of rec_add Old RA2 OUNT pcount of rec_add 1(n-1) n of rec_add result of rec_add Old OUNT pcount of rec_add 2(n) n of rec_add The third call of rec_add

22 ELSE SU A, =1 n-1 MOV A, %4 pcount ALL RE_ADD RA2 ADD SP, =4 adjust SP SNAP3 ADD A, %6 n + rec_add(...) MOV %-2, A result = MOV A, %-2 RT_ELSE MOV SP, OUNT 3 DATA lock SP %-2 result of rec_add Old RA2 OUNT %4 pcount of rec_add 1(n-1) %6 n of rec_add result of rec_add Old OUNT pcount of rec_add 2(n) n of rec_add 0 A: 0 Return from RT_THEN OUNT 3 DATA lock SP Old OUNT 2(n) 0 %-2 result of rec_add %4 pcount of rec_add %6 n of rec_add A: 1(1+0) Return from RT_ELSE

23 USE DATA OUNT DO 0 SP 0 USE TET MAIN PUSH MOV, SP OUNT 0 DATA lock SNAP1 PUSH PUSH SP OUNT 2(n) MOV A, =0 MOV SUM, A sum=0; 0 ALL GET_INT n=get_int(); GET_INT() 에서 2 를입력받아 n=2 에서 push n 시작했다면 PUSH #OUNT push &count SNAP1-2 ALL RE_ADD ADD SP, =4 adjust SP (two argument) SNAP4 ALL PUT_INT put_int( ) ADD SP, =2 MOV A, OUNT ALL PUT_INT put_int(count) ADD SP, =2 OUNT 3 DATA lock MOV SP, USE DATA LTORG END FIRST SP 0 A: 3(1+2) Return from RT_ELSE

24 Array 및 dynamic memory allocation /* A sample program for pointer and malloc*/ external void put_int(); int *TINY_ALLO(int size) { /* see the LM ode */ int *func(int *pcount, int x[]) { int* pa; int d=x[0]; int s=x[1]; SP pa %-6 d %-4 s %-2 P old P Return Addr pcount %4 x %6 x[i] 는 *(x+i) 로 reference 된다. *pcount++; pa = TINY_ALLO(2*s); pa[0] = d; pa[s-1] = d+2; return pa; main() { int *pcount; int a[2]; int *r; pcount = TINY_ALLO(2); *pcount=0; a[0]=1; a[1]=2; r = func(pcount,a); SP pcount %-8 a[0] %-6 a[1] %-4 r %-2 P old P P Return Addr a 는 array a[2] 의시작주소를나타내는데 global variable 과는달리따로 label 이없으므로현재 register 의값을기준으로하여계산해낸다. 즉 () 6 이 int a[2] 의시작주소이다.

25 POINTER START 0 ETDEF TINY_ALLO MAIN FUN USE TET FIRST MOV SP, #STK_TM MOV, =0 ALL MAIN O USE DATA USE SS USE STAK HEAP DO FREE initialize Heap pointer FREE RESDO 499 STK_TM EQU $ TINY_ALLO PUSH MOV, SP PUSH PUSH MOV A, HEAP return start address of an allocated block MOV, %4 ADD, A HEAP + size MOV HEAP, adjust free pointer for further allocations MOV SP, HEAP Free block Return this address Adjust free pointer SP STK_TM

26 MAIN SNAP1 PUSH MOV, SP SU SP, =8 PUSH PUSH MOV A, =2 push 2 ALL TINY_ALLO ADD SP, =2 MOV %-8, A pcount = TINY_ALLO(2); SNAP2-1 MOV, %-8 MOV A, =0 MOV *, A *pcount=0; MOV, =0 MOV A, =1 a[0]=1; MOV %@-6, A MOV, =2 DO integer! MOV A, =2 MOV %@-6, A a[1]=2 MOV A, SU A, =6 SNAP2-2 MOV A, %-8 ALL FUN push a push pcount HEAP FREE FREE SP %-8 pcount of main %-6 a[2] of main 0 HEAP H2 H1 0 *pcount H2 %-2 r of main HEAP H2 H1 *pcount H2 SP H1 0 A H1 %-8 pcount of main %-6 a[2] of main %-2 r of main SP 6 a H1 %-8 pcount of main -6 1 %-6 a[2] of main 2 %-2 r of main 0

27 SNAP6 ADD SP, =4 SNAP7 MOV %-2, A r = func(); SNAP8 MOV SP, HEAP H4 H1 1 *pcount H2 1 pa[0] H3 3 pa[1] H4 SP H1 pcount of func a a of func H1 %-8 pcount of main 1 %-6 a[2] of main 2 %-2 r of main 0 A H2 HEAP H4 H1 1 *pcount H2 1 pa[0] H3 3 pa[1] H4 SP H1 pcount of main 1 a[0] of main 2 a[1] of main H2 r of main 0 HEAP H4 H1 1 *pcount H2 1 pa[0] H3 3 pa[1] H4 SP H1 %-8 pcount of main 1 %-6 a[2] of main 2 %-2 r of main 0 A H2

28 HEAP H2 H1 0 *pcount H2 FUN SNAP3 PUSH MOV, SP SU SP, =6 PUSH PUSH MOV, %6 MOV A, * MOV %-4A d=x[0]; ADD, =2 DO integer! MOV A, * MOV %-2A s=x[1]; MOV, %4 MOV A, * ADD A, =1 MOV *, A *pcount++; SP %-6 pa of func %-4 d of func %-2 s of func Old H1 %4 pcount of func a %6 a of func H1 pcount of main 1 a[0] of main 2 a[1] of main r of main 0 HEAP H4 H1 1 *pcount H2 pa[0] H3 pa[1] H4 MOV A, %-2 ADD A, A 2 * s push 2*s ALL TINY_ALLO ADD SP, =2 MOV %-6, A pa= SNAP4 MOV A, %-4 MOV, %-6 MOV *, A pa[0]=d; ADD A, =2 d+2 ADD, %-2 ADD, %-2 pa+2*s SU, =2 pa+2(s-1) MOV *, A pa[s-1]=d+2; MOV A, %-6 return pa SP H2 %-6 pa of func 1 %-4 d of func 2 %-2 s of func Old H1 a %4 pcount of func %6 a of func H1 pcount of main 1 a[0] of main 2 a[1] of main r of main 0 SNAP5 MOV SP, USE DATA LTORG END FIRST HEAP H4 H1 1 *pcount H2 1 pa[0] H3 3 pa[1] H4 SP H1 pcount of func a a of func H1 %-8 pcount of main 1 %-6 a[2] of main 2 %-2 r of main 0

Microsoft Word - FunctionCall

Microsoft Word - FunctionCall Function all Mechanism /* Simple Program */ #define get_int() IN KEYOARD #define put_int(val) LD A val \ OUT MONITOR int add_two(int a, int b) { int tmp; tmp = a+b; return tmp; } local auto variable stack

More information

강의10

강의10 Computer Programming gdb and awk 12 th Lecture 김현철컴퓨터공학부서울대학교 순서 C Compiler and Linker 보충 Static vs Shared Libraries ( 계속 ) gdb awk Q&A Shared vs Static Libraries ( 계속 ) Advantage of Using Libraries Reduced

More information

Microsoft PowerPoint - a8a.ppt [호환 모드]

Microsoft PowerPoint - a8a.ppt [호환 모드] 이장의내용 8 장고급프로시저 스택프레임 재귀 (Recursion) Invoke, Addr, Proc, Proto 디렉티브 다중모듈프로그램작성 2 8.2 스택프레임 Stack Frame ( 또는 activation record) procedure 의다음사항을저장한 영역 urn address passed parameter ( 스택매개변수 ) saved register

More information

chap01_time_complexity.key

chap01_time_complexity.key 1 : (resource),,, 2 (time complexity),,, (worst-case analysis) (average-case analysis) 3 (Asymptotic) n growth rate Θ-, Ο- ( ) 4 : n data, n/2. int sample( int data[], int n ) { int k = n/2 ; return data[k]

More information

2. GCC Assembler와 AVR Assembler의차이 A. GCC Assembler 를사용하는경우 i. Assembly Language Program은.S Extension 을갖는다. ii. C Language Program은.c Extension 을갖는다.

2. GCC Assembler와 AVR Assembler의차이 A. GCC Assembler 를사용하는경우 i. Assembly Language Program은.S Extension 을갖는다. ii. C Language Program은.c Extension 을갖는다. C 언어와 Assembly Language 을사용한 Programming 20011.9 경희대학교조원경 1. AVR Studio 에서사용하는 Assembler AVR Studio에서는 GCC Assembler와 AVR Assmbler를사용한다. A. GCC Assembler : GCC를사용하는경우 (WinAVR 등을사용하는경우 ) 사용할수있다. New Project

More information

INTRO Basic architecture of modern computers Basic and most used assembly instructions on x86 Installing an assembly compiler and RE tools Practice co

INTRO Basic architecture of modern computers Basic and most used assembly instructions on x86 Installing an assembly compiler and RE tools Practice co Basic reverse engineering on x86 This is for those who want to learn about basic reverse engineering on x86 (Feel free to use this, email me if you need a keynote version.) v0.1 SeungJin Beist Lee beist@grayhash.com

More information

슬라이드 1

슬라이드 1 -Part3- 제 4 장동적메모리할당과가변인 자 학습목차 4.1 동적메모리할당 4.1 동적메모리할당 4.1 동적메모리할당 배울내용 1 프로세스의메모리공간 2 동적메모리할당의필요성 4.1 동적메모리할당 (1/6) 프로세스의메모리구조 코드영역 : 프로그램실행코드, 함수들이저장되는영역 스택영역 : 매개변수, 지역변수, 중괄호 ( 블록 ) 내부에정의된변수들이저장되는영역

More information

No Slide Title

No Slide Title Copyright, 2017 Multimedia Lab., UOS 시스템프로그래밍 (Assembly Code and Calling Convention) Seong Jong Choi chois@uos.ac.kr Multimedia Lab. Dept. of Electrical and Computer Eng. University of Seoul Seoul, Korea

More information

untitled

untitled 9 hamks@dongguk.ac.kr : Source code Assembly language code x = a + b; ld a, %r1 ld b, %r2 add %r1, %r2, %r3 st %r3, x (Assembler) (bit pattern) (machine code) CPU security (code generator).. (Instruction

More information

Microsoft PowerPoint - chap6 [호환 모드]

Microsoft PowerPoint - chap6 [호환 모드] 제 6 장프로세스 (Process) 숙대창병모 1 내용 프로세스시작 / 종료 명령중인수 / 환경변수 메모리배치 / 할당 비지역점프 숙대창병모 2 프로세스시작 / 종료 숙대창병모 3 Process Start Kernel exec system call user process Cstart-up routine call return int main(int argc,

More information

9

9 9 hamks@dongguk.ac.kr : Source code Assembly language code x = a + b; ld a, %r1 ld b, %r2 add %r1, %r2, %r3 st %r3, x (Assembler) (bit pattern) (machine code) CPU security (code generator).. (Instruction

More information

A Dynamic Grid Services Deployment Mechanism for On-Demand Resource Provisioning

A Dynamic Grid Services Deployment Mechanism for On-Demand Resource Provisioning C Programming Practice (II) Contents 배열 문자와문자열 구조체 포인터와메모리관리 구조체 2/17 배열 (Array) (1/2) 배열 동일한자료형을가지고있으며같은이름으로참조되는변수들의집합 배열의크기는반드시상수이어야한다. type var_name[size]; 예 ) int myarray[5] 배열의원소는원소의번호를 0 부터시작하는색인을사용

More information

Microsoft PowerPoint - ch07 - 포인터 pm0415

Microsoft PowerPoint - ch07 - 포인터 pm0415 함수의인수 (argument) 전달방법 C 에서함수의인수전달방법 값에의한호출 (call-by-value): 기본적인방법 포인터에의한호출 (call-by-pointer): 포인터이용 참조에의한호출 (call-by-reference): 참조 (reference) 이용 7-35 값에의한호출 (call-by-value) 함수호출시에변수의값을함수에복사본으로전달 복사본이전달되며,

More information

Deok9_Exploit Technique

Deok9_Exploit Technique Exploit Technique CodeEngn Co-Administrator!!! and Team Sur3x5F Member Nick : Deok9 E-mail : DDeok9@gmail.com HomePage : http://deok9.sur3x5f.org Twitter :@DDeok9 > 1. Shell Code 2. Security

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 제 3 장함수와문자열 1. 함수의기본적인개념을이해한다. 2. 인수와매개변수의개념을이해한다. 3. 함수의인수전달방법 2가지를이해한다 4. 중복함수를이해한다. 5. 디폴트매개변수를이해한다. 6. 문자열의구성을이해한다. 7. string 클래스의사용법을익힌다. 이번장에서만들어볼프로그램 함수란? 함수선언 함수호출 예제 #include using

More information

Microsoft PowerPoint - a10.ppt [호환 모드]

Microsoft PowerPoint - a10.ppt [호환 모드] Structure Chapter 10: Structures t and Macros Structure 관련된변수들의그룹으로이루어진자료구조 template, pattern field structure를구성하는변수 (cf) C언어의 struct 프로그램의 structure 접근 entire structure 또는 individual fields Structure는

More information

MPLAB C18 C

MPLAB C18 C MPLAB C18 C MPLAB C18 MPLAB C18 C MPLAB C18 C #define START, c:\mcc18 errorlevel{0 1} char isascii(char ch); list[list_optioin,list_option] OK, Cancel , MPLAB IDE User s Guide MPLAB C18 C

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 4 (Object) (Class) (Instance) (Method) (Constructor) Memory 1 UML 1 @ & 1 (Real World) (Software World) @ &.. () () @ & 2 (Real World) (Software World) OOA/ Modeling Abstraction Instantiation

More information

10주차.key

10주차.key 10, Process synchronization (concurrently) ( ) => critical section ( ) / =>, A, B / Race condition int counter; Process A { counter++; } Process B { counter ;.. } counter++ register1 = counter register1

More information

구문 분석

구문 분석 컴파일러구성 제 10 강 중간언어 / 인터프리터 Motivation rapid development of machine architectures proliferation of programming languages portable & adaptable compiler design --- P_CODE porting --- rewriting only back-end

More information

Microsoft PowerPoint - 15-MARS

Microsoft PowerPoint - 15-MARS MARS 소개및실행 어셈블리프로그램실행예 순천향대학교컴퓨터공학과이상정 1 MARS 소개및실행 순천향대학교컴퓨터공학과 2 MARS 소개 MARS MIPS Assembler and Runtime Simulator MIPS 어셈블리언어를위한소프트웨어시뮬레이터 미주리대학 (Missouri State Univ.) 의 Ken Vollmar 등이자바로개발한교육용시뮬레이터

More information

C# Programming Guide - Types

C# Programming Guide - Types C# Programming Guide - Types 최도경 lifeisforu@wemade.com 이문서는 MSDN 의 Types 를요약하고보충한것입니다. http://msdn.microsoft.com/enus/library/ms173104(v=vs.100).aspx Types, Variables, and Values C# 은 type 에민감한언어이다. 모든

More information

chap10.PDF

chap10.PDF 10 C++ Hello!! C C C++ C++ C++ 2 C++ 1980 Bell Bjarne Stroustrup C++ C C++ C, C++ C C 3 C C++ (prototype) (type checking) C C++ : C++ 4 C C++ (prototype) (type checking) [ 10-1] #include extern

More information

chap 5: Trees

chap 5: Trees 5. Threaded Binary Tree 기본개념 n 개의노드를갖는이진트리에는 2n 개의링크가존재 2n 개의링크중에 n + 1 개의링크값은 null Null 링크를다른노드에대한포인터로대체 Threads Thread 의이용 ptr left_child = NULL 일경우, ptr left_child 를 ptr 의 inorder predecessor 를가리키도록변경

More information

IDA 5.x Manual 07.02.hwp

IDA 5.x Manual 07.02.hwp IDA 5.x Manual - Manual 01 - 영리를 목적으로 한 곳에서 배포금지 Last Update 2007. 02 이강석 / certlab@gmail.com 어셈블리어 개발자 그룹 :: 어셈러브 http://www.asmlove.co.kr - 1 - IDA Pro 는 Disassembler 프로그램입니다. 기계어로 되어있는 실행파일을 어셈블리언어

More information

hlogin2

hlogin2 0x02. Stack Corruption off-limit Kernel Stack libc Heap BSS Data Code off-limit Kernel Kernel : OS Stack libc Heap BSS Data Code Stack : libc : Heap : BSS, Data : bss Code : off-limit Kernel Kernel : OS

More information

HW5 Exercise 1 (60pts) M interpreter with a simple type system M. M. M.., M (simple type system). M, M. M., M.

HW5 Exercise 1 (60pts) M interpreter with a simple type system M. M. M.., M (simple type system). M, M. M., M. 오늘할것 5 6 HW5 Exercise 1 (60pts) M interpreter with a simple type system M. M. M.., M (simple type system). M, M. M., M. Review: 5-2 7 7 17 5 4 3 4 OR 0 2 1 2 ~20 ~40 ~60 ~80 ~100 M 언어 e ::= const constant

More information

Microsoft PowerPoint - chap06-5 [호환 모드]

Microsoft PowerPoint - chap06-5 [호환 모드] 2011-1 학기프로그래밍입문 (1) chapter 06-5 참고자료 변수의영역과데이터의전달 박종혁 Tel: 970-6702 Email: jhpark1@seoultech.ac.kr h k 한빛미디어 출처 : 뇌를자극하는 C프로그래밍, 한빛미디어 -1- ehanbit.net 자동변수 지금까지하나의함수안에서선언한변수는자동변수이다. 사용범위는하나의함수내부이다. 생존기간은함수가호출되어실행되는동안이다.

More information

untitled

untitled Embedded System Lab. II Embedded System Lab. II 2 RTOS Hard Real-Time vs Soft Real-Time RTOS Real-Time, Real-Time RTOS General purpose system OS H/W RTOS H/W task Hard Real-Time Real-Time System, Hard

More information

OCaml

OCaml OCaml 2009.. (khheo@ropas.snu.ac.kr) 1 ML 2 ML OCaml INRIA, France SML Bell lab. & Princeton, USA nml SNU/KAIST, KOREA 3 4 (let) (* ex1.ml *) let a = 10 let add x y = x + y (* ex2.ml *) let sumofsquare

More information

5.스택(강의자료).key

5.스택(강의자료).key CHP 5: https://www.youtube.com/watch?v=ns-r91557ds ? (stack): (LIFO:Last-In First-Out):. D C B C B C B C B (element) C (top) B (bottom) (DT) : n element : create() ::=. is_empty(s) ::=. is_full(s) ::=.

More information

03장.스택.key

03장.스택.key ---------------- DATA STRUCTURES USING C ---------------- 03CHAPTER 1 ? (stack): (LIFO:Last-In First-Out) 2 : top : ( index -1 ),,, 3 : ( ) ( ) -> ->. ->.... 4 Stack ADT : (LIFO) : init():. is_empty():

More information

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100 2015-1 프로그래밍언어 9. 연결형리스트, Stack, Queue 2015 년 5 월 4 일 교수김영탁 영남대학교공과대학정보통신공학과 (Tel : +82-53-810-2497; Fax : +82-53-810-4742 http://antl.yu.ac.kr/; E-mail : ytkim@yu.ac.kr) 연결리스트 (Linked List) 연결리스트연산 Stack

More information

61 62 63 64 234 235 p r i n t f ( % 5 d :, i+1); g e t s ( s t u d e n t _ n a m e [ i ] ) ; if (student_name[i][0] == \ 0 ) i = MAX; p r i n t f (\ n :\ n ); 6 1 for (i = 0; student_name[i][0]!= \ 0&&

More information

Microsoft PowerPoint - ch07 - 포인터 pm0415

Microsoft PowerPoint - ch07 - 포인터 pm0415 2015-1 프로그래밍언어 7. 포인터 (Pointer), 동적메모리할당 2015 년 4 월 4 일 교수김영탁 영남대학교공과대학정보통신공학과 (Tel : +82-53-810-2497; Fax : +82-53-810-4742 http://antl.yu.ac.kr/; E-mail : ytkim@yu.ac.kr) Outline 포인터 (pointer) 란? 간접참조연산자

More information

11장 포인터

11장 포인터 Dynamic Memory and Linked List 1 동적할당메모리의개념 프로그램이메모리를할당받는방법 정적 (static) 동적 (dynamic) 정적메모리할당 프로그램이시작되기전에미리정해진크기의메모리를할당받는것 메모리의크기는프로그램이시작하기전에결정 int i, j; int buffer[80]; char name[] = data structure"; 처음에결정된크기보다더큰입력이들어온다면처리하지못함

More information

MAX+plus II Getting Started - 무작정따라하기

MAX+plus II Getting Started - 무작정따라하기 무작정 따라하기 2001 10 4 / Version 20-2 0 MAX+plus II Digital, Schematic Capture MAX+plus II, IC, CPLD FPGA (Logic) ALTERA PLD FLEX10K Series EPF10K10QC208-4 MAX+plus II Project, Schematic, Design Compilation,

More information

슬라이드 제목 없음

슬라이드 제목 없음 2006-09-27 경북대학교컴퓨터공학과 1 제 5 장서브넷팅과슈퍼넷팅 서브넷팅 (subnetting) 슈퍼넷팅 (Supernetting) 2006-09-27 경북대학교컴퓨터공학과 2 서브넷팅과슈퍼넷팅 서브넷팅 (subnetting) 하나의네트워크를여러개의서브넷 (subnet) 으로분할 슈퍼넷팅 (supernetting) 여러개의서브넷주소를결합 The idea

More information

DocsPin_Korean.pages

DocsPin_Korean.pages Unity Localize Script Service, Page 1 Unity Localize Script Service Introduction Application Game. Unity. Google Drive Unity.. Application Game. -? ( ) -? -?.. 준비사항 Google Drive. Google Drive.,.. - Google

More information

C 언어 프로그래밊 과제 풀이

C 언어 프로그래밊 과제 풀이 과제풀이 (1) 홀수 / 짝수판정 (1) /* 20094123 홍길동 20100324 */ /* even_or_odd.c */ /* 정수를입력받아홀수인지짝수인지판정하는프로그램 */ int number; printf(" 정수를입력하시오 => "); scanf("%d", &number); 확인 주석문 가필요한이유 printf 와 scanf 쌍

More information

11 템플릿적용 - Java Program Performance Tuning (김명호기술이사)

11 템플릿적용 - Java Program Performance Tuning (김명호기술이사) Java Program Performance Tuning ( ) n (Primes0) static List primes(int n) { List primes = new ArrayList(n); outer: for (int candidate = 2; n > 0; candidate++) { Iterator iter = primes.iterator(); while

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 System Software Experiment 1 Lecture 5 - Array Spring 2019 Hwansoo Han (hhan@skku.edu) Advanced Research on Compilers and Systems, ARCS LAB Sungkyunkwan University http://arcs.skku.edu/ 1 배열 (Array) 동일한타입의데이터가여러개저장되어있는저장장소

More information

The_IDA_Pro_Book

The_IDA_Pro_Book The IDA Pro Book Hacking Group OVERTIME force (forceteam01@gmail.com) GETTING STARTED WITH IDA IDA New : Go : IDA Previous : IDA File File -> Open Processor type : Loading Segment and Loading Offset x86

More information

Chapter #01 Subject

Chapter #01  Subject Device Driver March 24, 2004 Kim, ki-hyeon 목차 1. 인터럽트처리복습 1. 인터럽트복습 입력검출방법 인터럽트방식, 폴링 (polling) 방식 인터럽트서비스등록함수 ( 커널에등록 ) int request_irq(unsigned int irq, void(*handler)(int,void*,struct pt_regs*), unsigned

More information

11장 포인터

11장 포인터 누구나즐기는 C 언어콘서트 제 9 장포인터 이번장에서학습할내용 포인터이란? 변수의주소 포인터의선언 간접참조연산자 포인터연산 포인터와배열 포인터와함수 이번장에서는포인터의기초적인지식을학습한다. 포인터란? 포인터 (pointer): 주소를가지고있는변수 메모리의구조 변수는메모리에저장된다. 메모리는바이트단위로액세스된다. 첫번째바이트의주소는 0, 두번째바이트는 1, 변수와메모리

More information

Chapter 4. LISTS

Chapter 4. LISTS 연결리스트의응용 류관희 충북대학교 1 체인연산 체인을역순으로만드는 (inverting) 연산 3 개의포인터를적절히이용하여제자리 (in place) 에서문제를해결 typedef struct listnode *listpointer; typedef struct listnode { char data; listpointer link; ; 2 체인연산 체인을역순으로만드는

More information

Microsoft PowerPoint - o8.pptx

Microsoft PowerPoint - o8.pptx 메모리보호 (Memory Protection) 메모리보호를위해 page table entry에 protection bit와 valid bit 추가 Protection bits read-write / read-only / executable-only 정의 page 단위의 memory protection 제공 Valid bit (or valid-invalid bit)

More information

[ 마이크로프로세서 1] 2 주차 3 차시. 포인터와구조체 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Functi

[ 마이크로프로세서 1] 2 주차 3 차시. 포인터와구조체 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Functi 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Function) 1. 함수의개념 입력에대해적절한출력을발생시켜주는것 내가 ( 프로그래머 ) 작성한명령문을연산, 처리, 실행해주는부분 ( 모듈 ) 자체적으로실행되지않으며,

More information

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 System call table and linkage v Ref. http://www.ibm.com/developerworks/linux/library/l-system-calls/ - 2 - Young-Jin Kim SYSCALL_DEFINE 함수

More information

금오공대 컴퓨터공학전공 강의자료

금오공대 컴퓨터공학전공 강의자료 C 프로그래밍프로젝트 Chap 14. 포인터와함수에대한이해 2013.10.09. 오병우 컴퓨터공학과 14-1 함수의인자로배열전달 기본적인인자의전달방식 값의복사에의한전달 val 10 a 10 11 Department of Computer Engineering 2 14-1 함수의인자로배열전달 배열의함수인자전달방식 배열이름 ( 배열주소, 포인터 ) 에의한전달 #include

More information

untitled

untitled - -, (insert) (delete) - - (insert) (delete) (top ) - - (insert) (rear) (delete) (front) A A B top A B C top push(a) push(b) push(c) A B top pop() top A B D push(d) top #define MAX_STACK_SIZE 100 int

More information

Modern Javascript

Modern Javascript ES6 - Arrow Function Class Template String Destructuring Default, Rest, Spread let, const for..of Promises Module System Map, Set * Generator * Symbol * * https://babeljs.io/ Babel is a JavaScript compiler.

More information

6.1 Addresses and Pointers Recall memory concepts from Ch2 ch6_testbasicpointer.c int x1=1, x2=7; double distance; int *p; int q=8; p = &q; name addre

6.1 Addresses and Pointers Recall memory concepts from Ch2 ch6_testbasicpointer.c int x1=1, x2=7; double distance; int *p; int q=8; p = &q; name addre GEN1031 Computer Programming Chapter 6 Pointer 포인터 Kichun Lee Department of Industrial Engineering Hanyang Univesity 1 6.1 Addresses and Pointers Recall memory concepts from Ch2 ch6_testbasicpointer.c

More information

Chapter 4. LISTS

Chapter 4. LISTS 6. 동치관계 (Equivalence Relations) 동치관계 reflexive, symmetric, transitive 성질을만족 "equal to"(=) 관계는동치관계임. x = x x = y 이면 y = x x = y 이고 y = z 이면 x = z 동치관계를이용하여집합 S 를 동치클래스 로분할 동일한클래스내의원소 x, y 에대해서는 x y 관계성립

More information

Poison null byte Excuse the ads! We need some help to keep our site up. List 1 Conditions 2 Exploit plan 2.1 chunksize(p)!= prev_size (next_chunk(p) 3

Poison null byte Excuse the ads! We need some help to keep our site up. List 1 Conditions 2 Exploit plan 2.1 chunksize(p)!= prev_size (next_chunk(p) 3 Poison null byte Excuse the ads! We need some help to keep our site up. List 1 Conditions 2 Exploit plan 2.1 chunksize(p)!= prev_size (next_chunk(p) 3 Example 3.1 Files 3.2 Source code 3.3 Exploit flow

More information

JVM 메모리구조

JVM 메모리구조 조명이정도면괜찮조! 주제 JVM 메모리구조 설미라자료조사, 자료작성, PPT 작성, 보고서작성. 발표. 조장. 최지성자료조사, 자료작성, PPT 작성, 보고서작성. 발표. 조원 이용열자료조사, 자료작성, PPT 작성, 보고서작성. 이윤경 자료조사, 자료작성, PPT작성, 보고서작성. 이수은 자료조사, 자료작성, PPT작성, 보고서작성. 발표일 2013. 05.

More information

A Hierarchical Approach to Interactive Motion Editing for Human-like Figures

A Hierarchical Approach to Interactive Motion Editing for Human-like Figures 단일연결리스트 (Singly Linked List) 신찬수 연결리스트 (linked list)? tail 서울부산수원용인 null item next 구조체복습 struct name_card { char name[20]; int date; } struct name_card a; // 구조체변수 a 선언 a.name 또는 a.date // 구조체 a의멤버접근 struct

More information

untitled

untitled int i = 10; char c = 69; float f = 12.3; int i = 10; char c = 69; float f = 12.3; printf("i : %u\n", &i); // i printf("c : %u\n", &c); // c printf("f : %u\n", &f); // f return 0; i : 1245024 c : 1245015

More information

SRC PLUS 제어기 MANUAL

SRC PLUS 제어기 MANUAL ,,,, DE FIN E I N T R E A L L O C E N D SU B E N D S U B M O TIO

More information

untitled

untitled Step Motor Device Driver Embedded System Lab. II Step Motor Step Motor Step Motor source Embedded System Lab. II 2 open loop, : : Pulse, 1 Pulse,, -, 1 +5%, step Step Motor (2),, Embedded System Lab. II

More information

Microsoft PowerPoint - chap10-함수의활용.pptx

Microsoft PowerPoint - chap10-함수의활용.pptx #include int main(void) { int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; } 1 학습목표 중 값에 의한 전달 방법과

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Chapter 08 함수 01 함수의개요 02 함수사용하기 03 함수와배열 04 재귀함수 함수의필요성을인식한다. 함수를정의, 선언, 호출하는방법을알아본다. 배열을함수의인자로전달하는방법과사용시장점을알아본다. 재귀호출로해결할수있는문제의특징과해결방법을알아본다. 1.1 함수의정의와기능 함수 (function) 특별한기능을수행하는것 여러가지함수의예 Page 4 1.2

More information

No Slide Title

No Slide Title Copyright, 2001 Multimedia Lab., CH 3. COM object (In-process server) Eun-sung Lee twoss@mmlab.net Multimedia Lab. Dept. of Electrical and Computer Eng. University of Seoul Seoul, Korea 0. Contents 1.

More information

6주차.key

6주차.key 6, Process concept A program in execution Program code PCB (process control block) Program counter, registers, etc. Stack Heap Data section => global variable Process in memory Process state New Running

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Chapter 10 포인터 01 포인터의기본 02 인자전달방법 03 포인터와배열 04 포인터와문자열 변수의주소를저장하는포인터에대해알아본다. 함수의인자를값과주소로전달하는방법을알아본다. 포인터와배열의관계를알아본다. 포인터와문자열의관계를알아본다. 1.1 포인터선언 포인터선언방법 자료형 * 변수명 ; int * ptr; * 연산자가하나이면 1 차원포인터 1 차원포인터는일반변수의주소를값으로가짐

More information

Microsoft PowerPoint - PL_03-04.pptx

Microsoft PowerPoint - PL_03-04.pptx Copyright, 2011 H. Y. Kwak, Jeju National University. Kwak, Ho-Young http://cybertec.cheju.ac.kr Contents 1 프로그래밍 언어 소개 2 언어의 변천 3 프로그래밍 언어 설계 4 프로그래밍 언어의 구문과 구현 기법 5 6 7 컴파일러 개요 변수, 바인딩, 식 및 제어문 자료형 8

More information

제 14 장포인터활용 유준범 (JUNBEOM YOO) Ver 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다.

제 14 장포인터활용 유준범 (JUNBEOM YOO) Ver 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 제 14 장포인터활용 유준범 (JUNBEOM YOO) Ver. 2.0 jbyoo@konkuk.ac.kr http://dslab.konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 이중포인터란무엇인가? 포인터배열 함수포인터 다차원배열과포인터 void 포인터 포인터는다양한용도로유용하게활용될수있습니다. 2 이중포인터

More information

Microsoft Word - 1. ARM Assembly 실습_xp2.doc

Microsoft Word - 1. ARM Assembly 실습_xp2.doc ARM asm 의구조 ARM Assembly 실습 1. 기본골격 AREA armex,code, READONLY ;Mark first instruction to execute start MOV r0, #10 MOV r1,#3 ADD r0, r0, r1 ; r0 = r0 + r1 stop NOP NOP B stop ; Mark end of file 위의 asm의구조를이해하고실행해보세요.

More information

歯9장.PDF

歯9장.PDF 9 Hello!! C printf() scanf() getchar() putchar() gets() puts() fopen() fclose() fprintf() fscant() fgetc() fputs() fgets() gputs() fread() fwrite() fseek() ftell() I/O 2 (stream) C (text stream) : `/n'

More information

C 프로그래밊 개요

C 프로그래밊 개요 함수 (2) 2009 년 9 월 24 일 김경중 공지사항 10 월 1 일목요일수업휴강 숙제 #1 마감 : 10 월 6 일화요일 기초 함수를만들어라! 입력 함수 ( 기능수행 ) 반환 사용자정의함수 정의 : 사용자가자신의목적에따라직접작성한함수 함수의원형 (Function Prototype) + 함수의본체 (Function Body) : 함수의원형은함수에대한기본적정보만을포함

More information

중간고사

중간고사 중간고사 예제 1 사용자로부터받은두개의숫자 x, y 중에서큰수를찾는알고리즘을의사코드로작성하시오. Step 1: Input x, y Step 2: if (x > y) then MAX

More information

Microsoft PowerPoint - chap-11.pptx

Microsoft PowerPoint - chap-11.pptx 쉽게풀어쓴 C 언어 Express 제 11 장포인터 컴퓨터프로그래밍기초 이번장에서학습할내용 포인터이란? 변수의주소 포인터의선언 간접참조연산자 포인터연산 포인터와배열 포인터와함수 이번장에서는포인터의기초적인지식을학습한다. 컴퓨터프로그래밍기초 2 포인터란? 포인터 (pointer): 주소를가지고있는변수 컴퓨터프로그래밍기초 3 메모리의구조 변수는메모리에저장된다. 메모리는바이트단위로액세스된다.

More information

슬라이드 1

슬라이드 1 CHAP 2: 순환 (Recursion) 순환 (recursion) 이란? 알고리즘이나함수가수행도중에자기자신을다시호출하여문제를해결하는기법 정의자체가순환적으로 되어있는경우에적합한방법 순환 (recursion) 의예 팩토리얼값구하기 피보나치수열 1 n! n*( n 1)! fib( n) 0 1 fib( n 2) n n 0 ` 1 fib( n 1) if n 0 if

More information

- 이 문서는 삼성전자의 기술 자산으로 승인자만이 사용할 수 있습니다 Part Picture Description 5. R emove the memory by pushing the fixed-tap out and Remove the WLAN Antenna. 6. INS

- 이 문서는 삼성전자의 기술 자산으로 승인자만이 사용할 수 있습니다 Part Picture Description 5. R emove the memory by pushing the fixed-tap out and Remove the WLAN Antenna. 6. INS [Caution] Attention to red sentence 3-1. Disassembly and Reassembly R520/ 1 2 1 1. As shown in picture, adhere Knob to the end closely into the arrow direction(1), then push the battery up (2). 2. Picture

More information

Runtime Data Areas 엑셈컨설팅본부 /APM 팀임대호 Runtime Data Area 구조 Runtime Data Area 는 JVM 이프로그램을수행하기위해할당받는메모리영역이라고할수있다. 실제 WAS 성능문제에직면했을때, 대부분의문제점은 Runtime Da

Runtime Data Areas 엑셈컨설팅본부 /APM 팀임대호 Runtime Data Area 구조 Runtime Data Area 는 JVM 이프로그램을수행하기위해할당받는메모리영역이라고할수있다. 실제 WAS 성능문제에직면했을때, 대부분의문제점은 Runtime Da Runtime Data Areas 엑셈컨설팅본부 /APM 팀임대호 Runtime Data Area 구조 Runtime Data Area 는 JVM 이프로그램을수행하기위해할당받는메모리영역이라고할수있다. 실제 WAS 성능문제에직면했을때, 대부분의문제점은 Runtime Data Area 에서발생하는경우가많다. Memory Leak 이나 Garbage Collection

More information

Microsoft PowerPoint 세션.ppt

Microsoft PowerPoint 세션.ppt 웹프로그래밍 () 2006 년봄학기 문양세강원대학교컴퓨터과학과 세션변수 (Session Variable) (1/2) 쇼핑몰장바구니 장바구니에서는사용자가페이지를이동하더라도장바구니의구매물품리스트의내용을유지하고있어야함 PHP 에서사용하는일반적인변수는스크립트의수행이끝나면모두없어지기때문에페이지이동시변수의값을유지할수없음 이러한문제점을해결하기위해서 PHP 에서는세션 (session)

More information

K7VT2_QIG_v3

K7VT2_QIG_v3 1......... 2 3..\ 4 5 [R] : Enter Raid setup utility 6 Press[A]keytocreateRAID RAID Type: JBOD RAID 0 RAID 1: 2 7 " RAID 0 Auto Create Manual Create: 2 RAID 0 Block Size: 16K 32K

More information

hlogin7

hlogin7 0x07. Return Oriented Programming ROP? , (DEP, ASLR). ROP (Return Oriented Programming) (excutable memory) rop. plt, got got overwrite RTL RTL Chain DEP, ASLR gadget Basic knowledge plt, got call function

More information

hwp

hwp BE 8 BE 6 BE 4 BE 2 BE 0 y 17 y 16 y 15 y 14 y 13 y 12 y 11 y 10 y 9 y 8 y 7 y 6 y 5 y 4 y 3 y 2 y 1 y 0 0 BE 7 BE 5 BE 3 BE 1 BE 16 BE 14 BE 12 BE 10 y 32 y 31 y 30 y 29 y 28 y 27 y 26 y 25 y 24 y 23

More information

4.18.국가직 9급_전산직_컴퓨터일반_손경희_ver.1.hwp

4.18.국가직 9급_전산직_컴퓨터일반_손경희_ver.1.hwp 2015년도 국가직 9급 컴퓨터 일반 문 1. 시스템 소프트웨어에 포함되지 않는 것은? 1 1 스프레드시트(spreadsheet) 2 로더(loader) 3 링커(linker) 4 운영체제(operating system) - 시스템 소프트웨어 : 운영체제, 데이터베이스관리 프로그램,, 컴파일러, 링커, 로더, 유틸리티 소프트웨 어 등 - 스프레드시트 : 일상

More information

Microsoft PowerPoint - function

Microsoft PowerPoint - function 제 7 장함수구현 7.1 함수정의 7.2 매개변수전달 7.3 함수구현 7.4 인터프리터에서함수구현 Reading Chap 8 숙대창병모 Nov. 2007 1 7.1 함수정의및호출 숙대창병모 Nov. 2007 2 프로시저 / 함수? 프로시저 (Procedure) 한그룹의계산과정을추상화하는메커니즘으로반환값없으며 매개변수나비지역변수를변경한다. 함수 (Function)

More information

商用

商用 商用 %{ /* * line numbering 1 */ int lineno = 1 % \n { lineno++ ECHO ^.*$ printf("%d\t%s", lineno, yytext) $ lex ln1.l $ gcc -o ln1 lex.yy.c -ll day := (1461*y) div 4 + (153*m+2) div 5 + d if a then c :=

More information

11강-힙정렬.ppt

11강-힙정렬.ppt 11 (Heap ort) leejaku@shinbiro.com Topics? Heap Heap Opeations UpHeap/Insert, DownHeap/Extract Binary Tree / Index Heap ort Heap ort 11.1 (Priority Queue) Operations ? Priority Queue? Priority Queue tack

More information

Chapter 4. LISTS

Chapter 4. LISTS C 언어에서리스트구현 리스트의생성 struct node { int data; struct node *link; ; struct node *ptr = NULL; ptr = (struct node *) malloc(sizeof(struct node)); Self-referential structure NULL: defined in stdio.h(k&r C) or

More information

2007_2_project4

2007_2_project4 Programming Methodology Instructor: Kyuseok Shim Project #4: external sort with template Due Date: 0:0 a.m. between 2007-12-2 & 2007-12-3 Introduction 이프로젝트는 C++ 의 template을이용한 sorting algorithm과정렬해야할데이터의크기가

More information

BMP 파일 처리

BMP 파일 처리 BMP 파일처리 김성영교수 금오공과대학교 컴퓨터공학과 학습내용 영상반전프로그램제작 2 Inverting images out = 255 - in 3 /* 이프로그램은 8bit gray-scale 영상을입력으로사용하여반전한후동일포맷의영상으로저장한다. */ #include #include #define WIDTHBYTES(bytes)

More information

Microsoft PowerPoint - additional01.ppt [호환 모드]

Microsoft PowerPoint - additional01.ppt [호환 모드] 1.C 기반의 C++ part 1 함수 오버로딩 (overloading) 디폴트매개변수 (default parameter) 인-라인함수 (in-line function) 이름공간 (namespace) Jong Hyuk Park 함수 Jong Hyuk Park 함수오버로딩 (overloading) 함수오버로딩 (function overloading) C++ 언어에서는같은이름을가진여러개의함수를정의가능

More information

Microsoft PowerPoint - Chapter8.pptx

Microsoft PowerPoint - Chapter8.pptx Computer Engineering g Programming g 2 제 8 장함수 Lecturer: JUNBEOM YOO jbyoo@konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 모듈화 함수의개념, 역할 함수작성방법 반환값 인수전달 규모가큰프로그램은전체문제를보다단순하고이해하기쉬운함수로나누어서프로그램을작성하여야합니다.

More information

제 11 장포인터 유준범 (JUNBEOM YOO) Ver 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다.

제 11 장포인터 유준범 (JUNBEOM YOO) Ver 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 제 11 장포인터 유준범 (JUNBEOM YOO) Ver. 2.0 jbyoo@konkuk.ac.kr http://dslab.konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 포인터이란? 변수의주소 포인터의선언 간접참조연산자 포인터연산 포인터와배열 포인터와함수 이번장에서는포인터의기초적인지식을학습합니다.

More information

슬라이드 1

슬라이드 1 정적메모리할당 (Static memory allocation) 일반적으로프로그램의실행에필요한메모리 ( 변수, 배열, 객체등 ) 는컴파일과정에서결정되고, 실행파일이메모리에로드될때할당되며, 종료후에반환됨 동적메모리할당 (Dynamic memory allocation) 프로그램의실행중에필요한메모리를할당받아사용하고, 사용이끝나면반환함 - 메모리를프로그램이직접관리해야함

More information

학습목표 함수프로시저, 서브프로시저의의미를안다. 매개변수전달방식을학습한다. 함수를이용한프로그래밍한다. 2

학습목표 함수프로시저, 서브프로시저의의미를안다. 매개변수전달방식을학습한다. 함수를이용한프로그래밍한다. 2 학습목표 함수프로시저, 서브프로시저의의미를안다. 매개변수전달방식을학습한다. 함수를이용한프로그래밍한다. 2 6.1 함수프로시저 6.2 서브프로시저 6.3 매개변수의전달방식 6.4 함수를이용한프로그래밍 3 프로시저 (Procedure) 프로시저 (Procedure) 란무엇인가? 논리적으로묶여있는하나의처리단위 내장프로시저 이벤트프로시저, 속성프로시저, 메서드, 비주얼베이직내장함수등

More information

이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다. 2

이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다. 2 제 17 장동적메모리와연결리스트 유준범 (JUNBEOM YOO) Ver. 2.0 jbyoo@konkuk.ac.kr http://dslab.konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다.

More information

자바 프로그래밍

자바 프로그래밍 5 (kkman@mail.sangji.ac.kr) (Class), (template) (Object) public, final, abstract [modifier] class ClassName { // // (, ) Class Circle { int radius, color ; int x, y ; float getarea() { return 3.14159

More information

Microsoft PowerPoint - 제11장 포인터(강의)

Microsoft PowerPoint - 제11장 포인터(강의) 쉽게풀어쓴 C 언어 Express 제 11 장포인터 이번장에서학습할내용 포인터이란? 변수의주소 포인터의선언 간접참조연산자 포인터연산 포인터와배열 포인터와함수 이번장에서는포인터의기초적인지식을학습한다. 포인터란? 포인터 (pointer): 주소를가지고있는변수 1003 1004 1005 영화관 1002 1006 1001 포인터 (pointer) 1007 메모리의구조

More information

example code are examined in this stage The low pressure pressurizer reactor trip module of the Plant Protection System was programmed as subject for

example code are examined in this stage The low pressure pressurizer reactor trip module of the Plant Protection System was programmed as subject for 2003 Development of the Software Generation Method using Model Driven Software Engineering Tool,,,,, Hoon-Seon Chang, Jae-Cheon Jung, Jae-Hack Kim Hee-Hwan Han, Do-Yeon Kim, Young-Woo Chang Wang Sik, Moon

More information

Microsoft PowerPoint - chap06-2pointer.ppt

Microsoft PowerPoint - chap06-2pointer.ppt 2010-1 학기프로그래밍입문 (1) chapter 06-2 참고자료 포인터 박종혁 Tel: 970-6702 Email: jhpark1@snut.ac.kr 한빛미디어 출처 : 뇌를자극하는 C프로그래밍, 한빛미디어 -1- 포인터의정의와사용 변수를선언하는것은메모리에기억공간을할당하는것이며할당된이후에는변수명으로그기억공간을사용한다. 할당된기억공간을사용하는방법에는변수명외에메모리의실제주소값을사용하는것이다.

More information

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V Mobile Service > IAP > Android SDK IAP SDK TOAST SDK. IAP SDK. Android Studio IDE 2.3.3 Android SDK Version 2.3.3 (API Level 10). Name Reference Version License okhttp http://square.github.io/okhttp/ 1.5.4

More information

(72) 발명자 이동희 서울 동작구 여의대방로44길 10, 101동 802호 (대 방동, 대림아파트) 노삼혁 서울 중구 정동길 21-31, B동 404호 (정동, 정동상 림원) 이 발명을 지원한 국가연구개발사업 과제고유번호 2010-0025282 부처명 교육과학기술부

(72) 발명자 이동희 서울 동작구 여의대방로44길 10, 101동 802호 (대 방동, 대림아파트) 노삼혁 서울 중구 정동길 21-31, B동 404호 (정동, 정동상 림원) 이 발명을 지원한 국가연구개발사업 과제고유번호 2010-0025282 부처명 교육과학기술부 (19) 대한민국특허청(KR) (12) 등록특허공보(B1) (45) 공고일자 2015년01월13일 (11) 등록번호 10-1480424 (24) 등록일자 2015년01월02일 (51) 국제특허분류(Int. Cl.) G06F 12/00 (2006.01) G11C 16/00 (2006.01) (21) 출원번호 10-2013-0023977 (22) 출원일자 2013년03월06일

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 쉽게풀어쓴 C 언어 Express 제 9 장함수와변수 이번장에서학습할내용 변수의속성 전역, 지역변수 자동변수와정적변수 재귀호출 이번장에서는함수와변수와의관계를집중적으로살펴볼것이다. 또한함수가자기자신을호출하는재귀호출에대하여살펴본다. 변수의속성 변수의속성 : 이름, 타입, 크기, 값 + 범위, 생존시간, 연결 범위 (scope) : 변수가사용가능한범위, 가시성생존시간

More information

ch15

ch15 쉽게풀어쓴 C 언어 Express 제 14 장포인터활용 C Express 이중포인터 이중포인터 (double pointer) : 포인터를가리키는포인터 int i = 10; int *p = &i; int **q = &p; // i 는 int 형변수 // p 는 i 를가리키는포인터 // q 는포인터 p 를가리키는이중포인터 이중포인터 이중포인터의해석 이중포인터 //

More information