메모리 주소별 용량.

Programming/OS Development 2009. 5. 15. 03:30
0x100 -> 16 * 16 = 256 byte
0x200 -> 16 * 16 * 2 = 512 byte
0x1000 -> 16 * 16 * 16 = 4 KB
0x10000 -> 64 KB
0x100000 -> 1 MB

'Programming > OS Development' 카테고리의 다른 글

하드 디스크 드라이버 ( Hard Disk Driver )  (0) 2009.05.29
OS 제작의 원리 그리고 Codes - Ch 6. Memory Management  (1) 2009.05.19
어셈블러에서 16진수 입력  (0) 2009.05.15
naked 함수  (0) 2009.05.11
Stack Frame  (0) 2009.05.11

설정

트랙백

댓글

어셈블러에서 16진수 입력

Programming/OS Development 2009. 5. 15. 02:01
0Eh or 0EH, 0201H, 0AA55H.

여기서 h 는 16진수를 표시하기 위한 것으로 소/대 문자 어떤 것을 사용해도 됩니다.
그리고 앞에 붙는 0은 그 다음 나오는 것이 문자( A, B,C, D, E)일 경우에는 사용해야 하지만
숫자일 경우에는 0을 항상 붙일 필요가 없습니다.

'Programming > OS Development' 카테고리의 다른 글

OS 제작의 원리 그리고 Codes - Ch 6. Memory Management  (1) 2009.05.19
메모리 주소별 용량.  (0) 2009.05.15
naked 함수  (0) 2009.05.11
Stack Frame  (0) 2009.05.11
NASM - 1  (0) 2009.03.11

설정

트랙백

댓글

naked 함수

Programming/OS Development 2009. 5. 11. 03:06
__naked 호출 규약은 컴파일러가 접두, 접미를 작성하지 않는 호출 규약이다.
스택 프레임의 상태 보존을 위해 컴파일러가 어떤 코드도 작성하지 않으므로 접두, 접미는 사용자가 직접 작성해야 한다. C에서는 inline 어셈블리를 사용해야 한다.
함수 정의부에 __declspec(naked) 를 적어주면 naked 호출 규약을 사용 할 수 있다.

'Programming > OS Development' 카테고리의 다른 글

메모리 주소별 용량.  (0) 2009.05.15
어셈블러에서 16진수 입력  (0) 2009.05.15
Stack Frame  (0) 2009.05.11
NASM - 1  (0) 2009.03.11
Segmant and Offset  (0) 2009.03.08

설정

트랙백

댓글

Stack Frame

Programming/OS Development 2009. 5. 11. 02:59
스택 프레임 : 스택에 저장되는 함수의 호출 정보


 int Add( int a, int b )
{
   int c,d,e;
   c = a + b;
   return c;
}

void main()
{
   int result;
   result = Add( 1, 2 );
   printf("result= %d\n", result );
}

Add 함수에서 중단점을 설정 한 후 View/ Debug Window/ Disassembly 를 선택하면 Assem 코드를 볼 수 있다.



함수를 호출 할 때 ebp 를 먼저 스택에 push 한 뒤에 함수내에서 필요한 정보들을 push 한다.
esp는 함수의 변수와 인자들을 가리키기 위한 기준 번지로써 esp가 바뀌더라도 ebp는 변하지 않는다.
Add 함수의 수행을 마칠 때, 남은 정리 작업을 수행하는 코드를 접미( epilog ) 라고 하는데 이 함수의 경우 다음의 세줄 이다.

mov esp, ebp ; 지역변수를 위해 할당했던 스택 영역을 회수 한다는 뜻.
pop ebp
ret                 ; 스택에 저장된 복귀 번지를 꺼내서 그 번지로 리턴한다.

함수가 연속적으로 두번 호출될 때 는 다음과 같다.
void Dog( int v )
{
   int n, m;
   n = Add( 1, 2 );
   ...
}


위의 그림과 같이 각 함수의 스택 프레임이 저장 된다.
main 스택 프레임 위에 Dog 스택 프레임이 올라가고 그 위에 Add의 스택프레임이 올라가게 된다.
Dog 스택프레임은 먼저 인자 값인 v가 들어가고 난 뒤 복귀 번지, 그리고 ebp, 지역변수들 이 들어가고,
Add 함수의 경우도 마찬가지이다.

자세한 내용을 알고 싶으면 Winapi 사이트를 방문하기 바랍니다. 이 글은 Winapi 에서 발췌한 글입니다.

'Programming > OS Development' 카테고리의 다른 글

어셈블러에서 16진수 입력  (0) 2009.05.15
naked 함수  (0) 2009.05.11
NASM - 1  (0) 2009.03.11
Segmant and Offset  (0) 2009.03.08
Real Mode, Protected Mode  (0) 2009.03.08

설정

트랙백

댓글

Coding Standard

Programming/C Language 2009. 5. 1. 15:31

각 소스 주석 : 프로그램의 시작시

  1. /*-------------------------------
  2. **     File Name  : test.c
  3. **     Date       : 2007.08.24
  4. **     Author     : ChanSub Shin
  5. **     Brief      : ~~
  6. ---------------------------------*/

변수 선언을 제외하고는 "//"를 사용하여 위쪽에 주석 달기.

두줄 이상의 주석인 경우 /*-----

                                  **

                                  **

                                  -----*/ 식으로 주석 달기.

변수

변수 선언시 : Tab 사용하여 줄 맞추기.

      변수 선언시 주석은 우측편에 Tab으로 띄워서 "// " 사용 하기 

 
헝가리언 표기법

표기법 의미 표기법 의미
a 배열 l long 형 변수
b BOOL형 변수( b : bool ) p 포인터 변수
by BYTE( unsigned char ) 형 변수 lp long 포인터 변수
c 카운터로 사용하는 변수 st 구조체
cx, cy x, y 길이를 나타내기 위해 사용하는 변수 u unsigned int 형 변수
d double 형 변수 w WORD( unsigned short ) 형 변수
f float 형 변수 dw DWORD( unsigned long ) 형 변수
n int형 변수 h 핸들( HANDLE ) 형 변수
ch char 형 변수 g_ 전역 변수

 

함수

대문자로 시작하기 - GetTotalOfStack();
함수 이름으로 충분히 설명이 되지 않을 경우 함수 위에 주석 달기

'Programming > C Language' 카테고리의 다른 글

코딩 스타일  (0) 2009.08.15
#ifndef ~ #define ~ #endif  (0) 2009.08.15
헤더파일과 소스파일  (0) 2009.08.02
모듈화 프로그래밍 - 2  (0) 2009.06.28
모듈화 프로그래밍 - 1  (0) 2009.06.28

설정

트랙백

댓글

4th Week

English/Words 2009. 4. 15. 09:06

Day 22 Monday

underneath ( prep ) - If one thing is underneath another, it is directly under it, and may be covered or hidden by it.
               ex ) The device exploded underneath a van.
                      Her apartment was underneath a bar, called `The Lift'.

label ( v ) - If you say that someone or something is labelled as a particular thing, you mean that people generally describe them that way and you think that this is unfair. ~라는 명칭을 붙이다. ~라는 딱지를 붙이다.
              ex ) Too often the press are labelled as bad boys...
                     Certain estates are labelled as undesirable...

inability ( n ) - If you refer to someone's inability to do something, you are referring to the fact that they are unable to do it.
              ex ) Her inability to concentrate could cause an accident.

inferm with age 노쇠한

perspective ( n ) -
A particular perspective is a particular way of thinking about something, especially one that is influenced by your beliefs or experiences. 전망
               ex ) He says the death of his father 18 months ago has given him a new perspective on life...

'English > Words' 카테고리의 다른 글

[Computer] Words - 2  (0) 2009.06.20
[Computer] Words - 1  (0) 2009.06.20
3rd week  (2) 2009.04.03
2st Week  (0) 2009.03.24
My Last Cigarette  (0) 2009.03.18

설정

트랙백

댓글

3rd week

English/Words 2009. 4. 3. 10:49
Day 15 Monday

breakthrough( n, C ) - an important development or achievement
큰 발전, 약진, 난관의 돌파(구), 타개(책)
ex ) The company looks posied to make a significant ~ in China.
poised ( a ) - If a part of your body is poised, it is completely still but ready to move at any moment. ex ) He studied the keyboard carefully, one finger poised.
If sbd is poised to do sth, they are ready to take action at any moment.

Begining to ask questions about life is a sign ~~ 인생에 대해 질문하기 시작하는 것은 사인이다.

as it has always been. 그것이 항상 있었 던 것 처럼....


Day 16 Thuesday

possess ( v ) - If you ~ sth, you have it or own it. / If sbd or sth ~es a particular quality, ability, or
feature,  they have it.
unfathomable ( a ) = inexplicable - If you describe sth as ~, you mean that it cannot be understood or explained, usually because it is very strange or complicated. 알수 없는, 깊이를 해아릴수 없는, 이해 할 수 없는. inexplicable - if sth is ~, you can't explain why it happens or why it is ture.
설명 할 수 없는, 납득이 가지 않는, 불가해한. ex ) an ~ phenomenon. 불가해한 현상

Day 17 Wednesday




Day 18 Thrusday

well-being( n, U ) -
Sbd's ~ is their health and happiness 복지( =welfare ), 행복, 건강.
a welfare state 복지 국가, welfare work 복지 사업, welfare facilities 복지 시설, welfare system 복지 제도, welfare policy 복지 정책. / a relief case 구호 대상자, a welfare case 복지 대상자.
relief ( n, U ) - If you feel a sense of ~, you feel happy because sth unpleasant has not happended or is no longer happening. / ~ is money, food, or clothing that is provided for people who are very poor, or who have been affected by war or a natural disaster.

eradicate ( v  ) - To ~ sth means to get rid of it completely. 뿌리째 뽑다, 근절하다, 박멸하다. = eliminate 제거하다, 없애다. [생리]~을 배출[배설]하다. [수학]소거하다.
          ex ) ~ waste matter from the system. 노폐물을 몸에서 배설하다.
                the system / one's system : 신체, 전신. the system : 세계, 우주


Day 19 Friday

immaculately ( adv ) - If you describe something as immaculate, you mean that it is extremely clean, tidy, or neat. 티끝 하나 없이
           ex ) Her front room was kept immaculate( a ).

Day 20 Saturday

Day 21 Sunday

compel ( v ) -
If a situation, a rule, or a person compels you to do something, they force you to do it.

orderly ( a ) - If something is done in an orderly fashion or manner, it is done in a well-organized and controlled way. 질서 정연한, 순서 바른, 정돈된
           ex ) Despite the violence that preceded the elections, reports say that polling was orderly and peaceful.

worthwhile ( a ) - If something is worthwhile, it is enjoyable or useful, and worth the time, money, or effort that is spent on it.

'English > Words' 카테고리의 다른 글

[Computer] Words - 1  (0) 2009.06.20
4th Week  (0) 2009.04.15
2st Week  (0) 2009.03.24
My Last Cigarette  (0) 2009.03.18
1st Week  (1) 2009.03.14

설정

트랙백

댓글

리눅스

Programming/Linux 2009. 3. 25. 12:10

'Programming > Linux' 카테고리의 다른 글

Vi 편집기  (0) 2009.09.19
Virtual Box 게스트 확장 설치  (0) 2009.09.15
vi / vim 단축키 모음  (0) 2009.09.10
1. Red Hat Linux 5 - basic instructions ①  (0) 2009.03.23
1. Red Hat Linux 5 - basic instructions ①  (0) 2009.03.23

설정

트랙백

댓글

2st Week

English/Words 2009. 3. 24. 21:29
Day 8 Monday

~ ,when spoken, ~

unfathomable

wipe out negativiy.

abundance in all things.

summon

There are just two words standing between you, happiness, and the life of your dreams...


Day 9 Tuesday

We attract to ourselves what we hold inside.

based on what is inside of us.

Your life is a reflection of what you hold inside you.

what you hold inside you is always under your control.


Day 10 Wednesday


Day 11 Thursday

harmony -

When you have relaxed your whole body, then relax it some more. Now relax it even more. Repeat this deeper relaxing seven times, each time relaxing as much as you can.

When you have finished, compared with how you felt when you began.


Day 12 Friday

persist


Day 13 Saturday

the absence of something. ~의 없음


Day 14 Sunday

inner <-> outer

"The greatest revolution in our generation is the discovery that human beings, by changing the inner attitudes of their minds, can change the outer aspects of their lives."

'English > Words' 카테고리의 다른 글

[Computer] Words - 1  (0) 2009.06.20
4th Week  (0) 2009.04.15
3rd week  (2) 2009.04.03
My Last Cigarette  (0) 2009.03.18
1st Week  (1) 2009.03.14

설정

트랙백

댓글

1. Red Hat Linux 5 - basic instructions ①

Programming/Linux 2009. 3. 23. 18:01
User Identification confirmation

whoami - to confirm login account

su - It means 'substitue user'. It's used to change another user ID, not to login,to use another new shell. Commonly it's used to change root account for a moment to do management work. then return to the previous login account.

passwd <ID>- used to change password.

File, Directory
ls [directory] [option]- Show Files and directories list.
  -l : Show specific info of files.
  -a : Show all files,regardless of the type of files.

mv <original filename> <new filename>: move or rename files.

chmod( permission ) <permission option> <objective file>
 
d rwx rwx rwx : The first character is either directory or file. 'd' means directory, '-'
                           means file. The first "rwx" is the authority of an owner. The second one 
                           is the authority of a group. The final one is the authority of other users.
   To give an authority 
      1) rwx(421) add the number. - give owner, all groups, all users an authority.
              read + write + execution 7, read + write 6,
              read + execution 5,  read 4, write + execution 3, write 2, execution 1
      2) a( all ), u( user ), g( groups ), o( other ) / r( read ), w( write ), x( execution )
          + ( add permission ), - ( remove permission )
        ex ) chmod 777 redhat -> Give all owners, groups, users all authorities.
               chmod u+x redhat -> Give owner execution autority.

Link
ln -s <object of link> <filename of link> : object can be file or directory.
  ex ) ln -s a b : Make b link to point at a file or directory.
         cd b : Enter a which a point at



'Programming > Linux' 카테고리의 다른 글

Vi 편집기  (0) 2009.09.19
Virtual Box 게스트 확장 설치  (0) 2009.09.15
vi / vim 단축키 모음  (0) 2009.09.10
리눅스  (0) 2009.03.25
1. Red Hat Linux 5 - basic instructions ①  (0) 2009.03.23

설정

트랙백

댓글