{"id":6107,"date":"2026-06-30T13:00:00","date_gmt":"2026-06-30T04:00:00","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=6107"},"modified":"2026-06-30T12:59:41","modified_gmt":"2026-06-30T03:59:41","slug":"os-minios-7-3","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2026\/06\/30\/os-minios-7-3\/","title":{"rendered":"[OS]miniOS-7(3)"},"content":{"rendered":"\n<p>\ud83d\udc49\ufe0f \ub370\uc774\ud130 \uc601\uc5ed: GDT(Global Descriptor Table) \uad6c\uc870 \uc815\uc758 \ubd80\ubd84 \ucf54\ub4dc \uc124\uba85\uc785\ub2c8\ub2e4.<br>Data Area: This is an explanation of the code defining the GDT (Global Descriptor Table) structure.<\/p>\n\n\n\n<p>\u2714\ufe0f \ub370\uc774\ud130 \uc601\uc5ed\uc73c\ub85c GDT(Global Descriptor Table) \uad6c\uc870\ub97c \uc815\uc758 \ud569\ub2c8\ub2e4.<br>Define the GDT (Global Descriptor Table) structure in the data area.<\/p>\n\n\n\n<p>&#8212; 4\ubc14\uc774\ud2b8 \uc815\ub82c \/ 4-byte alignment<\/p>\n\n\n\n<p>1)\ud604\uc7ac \uc704\uce58\uc758 \ucf54\ub4dc \ub370\uc774\ud130\uc758 \ubc14\uc774\ud2b8 \uc218\ub97c 4\ub85c \ub098\ub204\uc5c8\uc744\uacbd\uc6b0 \ub098\uba38\uc9c0\uac00 0\uc774 \uc544\ub2c8\uba74 0~3\ubc14\uc774\ud2b8\ub97c 0\uc744 \ucd94\uac00\ud574\uc11c 4\ub85c \ub098\ub208 \ub098\uba38\uc9c0\uac000\uc774 \ub418\ub3c4\ub85d \ub9de\ucda5\ub2c8\ub2e4.<br>If the byte count of the code data at the current position is not divisible by 4 (i.e., the remainder is not 0), 0 to 3 bytes are added to make the remainder 0 when divided by 4.<\/p>\n\n\n\n<p>2)\ud544\uc218 \uc0ac\ud56d\uc740 \uc544\ub2c8\uba70 GDT\uc758 \uae54\ub054\ud55c \uc815\ub82c \ub54c\ubb38\uc5d0 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<br>It is not mandatory; I use it because of GDT&#8217;s clean alignment.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>align 4<\/code><\/pre>\n\n\n\n<p>&#8212; \ub110 \ub514\uc2a4\ud06c\ub9bd\ud130 \uc785\ub2c8\ub2e4.<br>It is a null descriptor.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dd 0, 0 <\/code><\/pre>\n\n\n\n<p>1)GDT\uc758 \uccab \ubc88\uc9f8 \uc5d4\ud2b8\ub9ac\ub294 Null Descriptor\uc5ec\uc57c \ud569\ub2c8\ub2e4.<br>The first entry of the GDT must be a null descriptor.<\/p>\n\n\n\n<p>2)\ub514\uc2a4\ud06c\ub9bd\ud130\ub294 \uc138\uadf8\uba3c\ud2b8\ub97c \uc124\uba85\ud558\ub294 8\ubc14\uc774\ud2b8\uc9dc\ub9ac \uc815\ubcf4\uc785\ub2c8\ub2e4.<br>A descriptor is an 8-byte piece of information that describes a segment.<\/p>\n\n\n\n<p>3) GDT\ub294 \ud14c\uc774\ube14\uc774\uace0 \ub514\uc2a4\ud06c\ub9bd\ud130\ub294 \ud14c\uc774\ube14\uc758 \uc6d0\uc18c\uc785\ub2c8\ub2e4.<br>The GDT is a table, and descriptors are the elements of that table.<\/p>\n\n\n\n<p>4) dd 0, 0\uc740 32\ube44\ud2b8(double word) \ub370\uc774\ud130 \ub450 \uac1c\ub97c 0\uc73c\ub85c \uc800\uc7a5\ud558\ub77c\ub294 \uc758\ubbf8\uc785\ub2c8\ub2e4.<br>&#8220;dd 0, 0&#8221; means to store two 32-bit (double-word) data items as 0.<\/p>\n\n\n\n<p>5) \uc9c0\uc2dc\uc5b4\uc758 \ud06c\uae30 \/ Size of the directive<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>db (Define Byte) : 1Byte\ndw (Define Word) : 2Byte\ndd (Define Double Word) : 4Byte<\/code><\/pre>\n\n\n\n<p>6)\uc2e4\uc81c \uba54\ubaa8\ub9ac\uc5d0\ub294 \ub2e4\uc74c\uacfc \uac19\uc774 \uc800\uc7a5 \ub429\ub2c8\ub2e4.(4\ubc14\uc774\ud2b8 + 4\ubc14\uc774\ud2b8 = 8\ubc14\uc774\ud2b8)<br>It is stored in actual memory as follows (4 bytes + 4 bytes = 8 bytes).<\/p>\n\n\n\n<p>6-1) \ub110\ub514\uc2a4\ud06c\ub9bd\ud130\uc758 \ud06c\uae30\ub294 8\ubc14\uc774\ud2b8\uc774\uba70 \uba54\ubaa8\ub9ac\uc5d0\ub294 \uc2e4\uc81c\ub85c \uc544\ub798\uc640 \uac19\uc774 \uc800\uc7a5\ub429\ub2c8\ub2e4.<br>The null descriptor is 8 bytes in size and is actually stored in memory as shown below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>00 00 00 00\n00 00 00 00<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>&#8212; \ucf54\ub4dc \uc138\uadf8\uba3c\ud2b8 \ub514\uc2a4\ud06c\ub9bd\ud130 (\uc624\ud504\uc14b 0x08 = \ub110 \ub514\uc2a4\ud06c\ub9bd\ud130 8\ubc14\uc774\ud2b8)<br>Code segment descriptor (offset 0x08 = 8-byte null descriptor)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    dw 0xFFFF, 0x0000\n    db 0x00, 0x9A, 0xCF, 0x00<\/code><\/pre>\n\n\n\n<p>1) \ucf54\ub4dc \uc138\uadf8\uba3c\ud2b8 \ub514\uc2a4\ud06c\ub9bd\ud130\ub294 \ucf54\ub4dc \uc138\uadf8\uba3c\ud2b8\uc758 \uc704\uce58\uc5d0 \ub300\ud55c \uc815\ubcf4\uac00 \uc800\uc7a5\ub429\ub2c8\ub2e4.<br>A code segment descriptor stores information about the location of a code segment.<\/p>\n\n\n\n<p>2)dw\ub294 2\ubc14\uc774\ud2b8\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4.<br>dw generates 2 bytes.<\/p>\n\n\n\n<p>3) 0xFFFF\ub294 FF FF 2\ubc14\uc774\ud2b8\uac00 \ub418\uace0 0x0000\ub294 00 00\ub85c 2\ubc14\uc774\ud2b8\uac00 \ub429\ub2c8\ub2e4.<br>0xFFFF becomes the two bytes FF FF, and 0x0000 becomes the two bytes 00 00.<\/p>\n\n\n\n<p>4) \uadf8\ub7ec\uba74 \ucd1d 4\ubc14\uc774\ud2b8\uac00 \ub429\ub2c8\ub2e4.<br>That makes a total of 4 bytes.<\/p>\n\n\n\n<p>5) db\ub294 1\ubc14\uc774\ud2b8\ub97c \ub9cc\ub4ed\ub2c8\ub2e4.<br><code>db<\/code> creates a 1-byte value.<\/p>\n\n\n\n<p>6) \uadf8\ub7ec\uba74 \uc544\ub798\ucc98\ub7fc \uac011\ubc14\uc774\ud2b8\uc758 \ud569\uacc4\ub294 \ucd1d4\ubc14\uc774\ud2b8\uac00 \ub429\ub2c8\ub2e4.<br>Then, as shown below, the sum of the 1-byte values \u200b\u200bresults in a total of 4 bytes.<\/p>\n\n\n\n<p>1)dw\ub294 2\ubc14\uc774\ud2b8\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4.<br>dw generates 2 bytes.<\/p>\n\n\n\n<p>2) 0xFFFF\ub294 FF FF 2\ubc14\uc774\ud2b8\uac00 \ub418\uace0 0x0000\ub294 00 00\ub85c 2\ubc14\uc774\ud2b8\uac00 \ub429\ub2c8\ub2e4.<br>0xFFFF becomes the two bytes FF FF, and 0x0000 becomes the two bytes 00 00.<\/p>\n\n\n\n<p>3) \uadf8\ub7ec\uba74 \ucd1d 4\ubc14\uc774\ud2b8\uac00 \ub429\ub2c8\ub2e4.<br>That makes a total of 4 bytes.<\/p>\n\n\n\n<p>4) db\ub294 1\ubc14\uc774\ud2b8\ub97c \ub9cc\ub4e4\uace0 \ucd1d 4\ubc14\uc774\ud2b8\uac00 \ub429\ub2c8\ub2e4.<br><code>db<\/code> creates 1 byte, resulting in a total of 4 bytes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>db 0x00 \u2192 1 byte\ndb 0x9A \u2192 1 byte\ndb 0xCF \u2192 1 byte\ndb 0x00 \u2192 1 byte\n--------------------\n\ud569\uacc4\/total 4  byte<\/code><\/pre>\n\n\n\n<p>5) \ucf54\ub4dc \uc138\uadf8\uba3c\ud2b8 \ub514\uc2a4\ud06c\ub9bd\ud130\ub294 dw(2byte\u00d72) 4\ubc14\uc774\ud2b8\uc640 db(1byte\u00d74) 4\ubc14\uc774\ud2b8\ub97c \ud569\ud574\uc11c \ucd1d 8\ubc14\uc774\ud2b8\uac00 \ub429\ub2c8\ub2e4.<br>A code segment descriptor totals 8 bytes, combining 4 bytes from <code>dw<\/code> (2 bytes \u00d7 2) and 4 bytes from <code>db<\/code> (1 byte \u00d7 4).<\/p>\n\n\n\n<p>6) \uba54\ubaa8\ub9ac\uc5d0\ub294 \ub2e4\uc74c\ucc98\ub7fc 8\ubc14\uc774\ud2b8\uac00 \uc0dd\uc131\ub429\ub2c8\ub2e4.<br>8 bytes are created in memory as follows.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>FF FF 00 00 00 9A CF 00<\/code><\/pre>\n\n\n\n<p>7) \ucf54\ub4dc \ub514\uc2a4\ud06c\ub9bd\ud130\uc758 \uad6c\uc870\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<br>The structure of the code descriptor is as follows.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>+----------------+----------------+\n| Limit(2B)      |\n+----------------+----------------+\n| Base(2B)       |\n+----------------+----------------+\n| Base(1B)       |\n+----------------+----------------+\n| Access(1B)     |\n+----------------+----------------+\n| Flags+Limit(1B)|\n+----------------+----------------+\n| Base(1B)       |\n+----------------+----------------+<\/code><\/pre>\n\n\n\n<p>8) \ub2e4\uc74c\uc740 \ucf54\ub4dc \ub514\uc2a4\ud06c\ub9bd\ud130\uc758 \uae30\ub2a5\uc785\ub2c8\ub2e4.<br>The following are the functions of the code descriptor.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Code Descriptor\n\nBase\n-- \ucf54\ub4dc \uc138\uadf8\uba3c\ud2b8\uac00 \uc2dc\uc791\ub420 \uc704\uce58\nThe starting location of the code segment\n\nLimit\n-- \uc0ac\uc6a9\ud560 \uba54\ubaa8\ub9ac \uc6a9\ub7c9\nMemory capacity to use\n\nAccess\n -- \ucf54\ub4dc\uc778\uc9c0 \ub370\uc774\ud130\uc778\uc9c0 \uc124\uc815\nConfigure whether it is code or data.\n -- \uc2e4\ud589 \uac00\ub2a5\ud55c\uc9c0 \uc124\uc815\nSet whether it is executable\n -- \uad8c\ud55c\uc124\uc815\nPermission Settings\n\nFlags\n-- 16\ube44\ud2b8\uc778\uc9c0 32\ube44\ud2b8\uc778\uc9c0 \uc124\uc815\nSet to 16-bit or 32-bit\n-- Limit\ub97c \ubc14\uc774\ud2b8 \ub2e8\uc704\ub85c \ubcfc\uc9c0 4KB \ub2e8\uc704\ub85c \ubcfc\uc9c0 \uc124\uc815\nConfigure whether to view the limit in bytes or 4KB units.<\/code><\/pre>\n\n\n\n<p>7-2) \ucf54\ub4dc\ub514\uc2a4\ud06c\ub9bd\ud130\uc758 \uac01 \ucf54\ub4dc\uc640 \uae30\ub2a5 \uc124\uba85\uc785\ub2c8\ub2e4.<br>Here are the descriptions of the codes and functions for the code descriptor.<\/p>\n\n\n\n<pre class=\"wp-block-code has-normal-font-size\"><code>dw 0xFFFF\n-- Limit\uc758 \ud558\uc704 16\ube44\ud2b8\nThe lower 16 bits of the Limit\n-- 0xCF \uc548\uc5d0\ub3c4 Limit\uc758 \uc0c1\uc704 4\ube44\ud2b8\uac00 \ub4e4\uc5b4\uac11\ub2c8\ub2e4.\nThe upper 4 bits of the Limit are also included in 0xCF.\n\u2705 Limit = \uc0c1\uc704 4\ube44\ud2b8(0xF) + \ud558\uc70416\ube44\ud2b8(0xFFFF) = 4GB\nLimit = Upper 4 bits (0xF) + Lower 16 bits (0xFFFF) = 4GB\n\ndw 0x0000 \n-- Base Address \ud558\uc704 16\ube44\ud2b8\nLower 16 bits of the base address\n-- \uc138\uadf8\uba3c\ud2b8\uc758 \uc2dc\uc791 \uc8fc\uc18c\uc785\ub2c8\ub2e4.\nThis is the starting address of the segment.\n-- Base = 0x0000\n\ndb 0x00 \n-- Base Address 16~23bit\n-- Base = 0x000000\n\ndb 0x9A\n-- Access Byte(\uad8c\ud55c \ubc0f \uc138\uadf8\uba3c\ud2b8 \uc885\ub958)\ud83d\udcd3\nAccess Byte (Permissions and Segment Type)\n\ndb 0xCF\n-- 11001111\uc5d0\uc11c 1100\uc740 \ud50c\ub798\uadf8\ud83d\udcd3, 1111\uc740 Limit\uc758 \uc0c1\uc704 4\ube44\ud2b8\uc785\ub2c8\ub2e4.\nIn 11001111, 1100 represents the flags \ud83d\udcd3, and 1111 represents the upper 4 bits of the Limit.\n\ndb 0x00\n-- Base = 0x00000000\n\u2705 Base Address\ub294 dw 0x0000 , db 0x00 ,db 0x00\ub97c \uc870\ud569\ud574\uc11c 32\ube44\ud2b8\ub97c \ub9cc\ub4ed\ub2c8\ub2e4.\nThe Base Address is formed as a 32-bit value by combining `dw 0x0000`, `db 0x00`, and `db 0x00`.<\/code><\/pre>\n\n\n\n<p>\ud83d\udcd3 \uc811\uadfc\uad8c\ud55c\ubc14\uc774\ud2b8 \/ Access Byte<\/p>\n\n\n\n<p>&#8212; 0x9A = 10011010<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\ube44\ud2b8\/Bit<\/th><th>\uc774\ub984\/Name<\/th><th>\uac12\/Vale<\/th><th>\uc124\uba85\/Description<\/th><\/tr><\/thead><tbody><tr><td>7<\/td><td>P(Present)<\/td><td>1<\/td><td>\uba54\ubaa8\ub9ac\uc5d0 \uc874\uc7ac<br>Resides in memory<\/td><\/tr><tr><td>6~5<\/td><td>DPL<\/td><td>00<\/td><td>Ring0<\/td><\/tr><tr><td>4<\/td><td>S<\/td><td>1<\/td><td>Code\/Data \uc138\uadf8\uba3c\ud2b8<br>Code\/Data segment<\/td><\/tr><tr><td>3<\/td><td>E<\/td><td>1<\/td><td>\uc2e4\ud589 \uac00\ub2a5Feasible(Code)<\/td><\/tr><tr><td>2<\/td><td>C<\/td><td>0<\/td><td>Conforming \uc548 \ud568<br>Non-conforming<\/td><\/tr><tr><td>1<\/td><td>R<\/td><td>1<\/td><td>\uc77d\uae30 \uac00\ub2a5<br>Readable<\/td><\/tr><tr><td>0<\/td><td>A<\/td><td>0<\/td><td>CPU\uac00 \uc811\uadfc\ud558\uba74 1\ub85c \ubcc0\uacbd<br>Changes to 1 when accessed by the CPU.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\ube44\ud2b8\/Bit<\/th><th>\uc774\ub984\/Name<\/th><th>\uac12\/Vale<\/th><th>\uc124\uba85\/Description<\/th><\/tr><\/thead><tbody><tr><td>7<\/td><td>P(Present)<\/td><td>1<\/td><td>\uba54\ubaa8\ub9ac\uc5d0 \uc874\uc7ac<br>Resides in memory<\/td><\/tr><tr><td>6~5<\/td><td>DPL<\/td><td>00<\/td><td>Ring0<\/td><\/tr><tr><td>4<\/td><td>S<\/td><td>1<\/td><td>Code\/Data \uc138\uadf8\uba3c\ud2b8<br>Code\/Data segment<\/td><\/tr><tr><td>3<\/td><td>E<\/td><td>1<\/td><td>\uc2e4\ud589 \uac00\ub2a5Feasible(Code)<\/td><\/tr><tr><td>2<\/td><td>C<\/td><td>0<\/td><td>Conforming \uc548 \ud568<br>Non-conforming<\/td><\/tr><tr><td>1<\/td><td>R<\/td><td>1<\/td><td>\uc77d\uae30 \uac00\ub2a5<br>Readable<\/td><\/tr><tr><td>0<\/td><td>A<\/td><td>0<\/td><td>CPU\uac00 \uc811\uadfc\ud558\uba74 1\ub85c \ubcc0\uacbd<br>Changes to 1 when accessed by the CPU.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\ud83d\udcd3 \ud50c\ub798\uadf8 \/ Flags<\/p>\n\n\n\n<p>&#8212; 1100(G D L AVL)<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\ube44\ud2b8<br>Bit<\/th><th>\uc774\ub984<br>Name<\/th><th>\ud604\uc7ac \uac12<br>Current Value<\/th><th>\uc758\ubbf8<br>Description<\/th><\/tr><\/thead><tbody><tr><td>7<\/td><td>G (Granularity)<\/td><td>1<\/td><td>Limit\ub97c 4KB \ub2e8\uc704\ub85c \ud574\uc11d\ud569\ub2c8\ub2e4.<br>The limit is interpreted in 4KB units.<\/td><\/tr><tr><td>6<\/td><td>D (Default Operation Size)<\/td><td>1<\/td><td>32\ube44\ud2b8 \ucf54\ub4dc\/\ub370\uc774\ud130<br>32-bit code\/data<\/td><\/tr><tr><td>5<\/td><td>L (Long Mode)<\/td><td>0<\/td><td>64\ube44\ud2b8 \uc544\ub2d8<br>Not 64-bit<\/td><\/tr><tr><td>4<\/td><td>AVL (Available)<\/td><td>0<\/td><td>\uc6b4\uc601\uccb4\uc81c\uac00 \uc790\uc720\ub86d\uac8c \uc0ac\uc6a9\ud558\ub294 \ube44\ud2b8<br>bits freely used by the operating system<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>1)G (Granularity)<\/p>\n\n\n\n<p>1-1) G=0\uc774\uba74 Limit\ub97c 1\ubc14\uc774\ud2b8 \ub2e8\uc704\ub85c \ud574\uc11d\ud569\ub2c8\ub2e4.Limit = 100\uc774\uba74 100Byte\uae4c\uc9c0\ub9cc \uc0ac\uc6a9 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br>If G=0, the limit is interpreted in 1-byte units. If Limit = 100, only up to 100 bytes can be used.<\/p>\n\n\n\n<p>1-2)G=1\uc774\uba74  Limit\ub97c 4KB \ub2e8\uc704\ub85c \ud574\uc11d\ud569\ub2c8\ub2e4.100 \u00d7 4096 Byte\ub97c \uc0ac\uc6a9 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. <br>If G=1, the Limit is interpreted in 4 KB units; 100 \u00d7 4,096 bytes can be used.<\/p>\n\n\n\n<p>1-3)\ud604\uc7ac \ucf54\ub4dc\uc5d0\uc11c 0xFFFFF(1,048,575) \u00d7 4096 + 4095 = 4GB\uc774 \ub429\ub2c8\ub2e4.<br>In the current code, 0xFFFFF (1,048,575) \u00d7 4096 + 4095 equals 4 GB.<\/p>\n\n\n\n<p>1-4)0~4GB\uc774\uae30 \ub54c\ubb38\uc5d0 0xFFFFF(1,048,575) \u00d7 4096  \uc774 \ubd80\ubd84\uc5d0\uc11c 4096\uc740 0~4095\uae4c\uc9c0\uc758 \uac12\uc785\ub2c8\ub2e4.<br>Since the range is 0 to 4 GB, in the expression 0xFFFFF (1,048,575) \u00d7 4096, the value 4096 represents the range from 0 to 4095.<\/p>\n\n\n\n<p>1-5)\uadf8\ub798\uc11c \uba54\ubaa8\ub9ac \uc804\uccb4 \uc6a9\ub7c9\uc740 1~4GB\uac00 \uc544\ub2c8\ub77c 0~4GB\ub97c \uc0ac\uc6a9 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br>Therefore, the total usable memory capacity is 0 to 4 GB, rather than 1 to 4 GB.<\/p>\n\n\n\n<p>1-6)1~4GB\uc5d0 \ub300\ud55c \uacc4\uc0b0\uc740 0xFFFFF(1,048,575) \u00d7 4096  \uc785\ub2c8\ub2e4. <br>The calculation for 1\u20134 GB is 0xFFFFF (1,048,575) \u00d7 4096.<\/p>\n\n\n\n<p>1-7)\uc704\uc758 \uac12\uc5d0 0\uc5d0\uc11c \ubd80\ud130 1\uc0ac\uc774\uc758 \uac12\uc778 4095\ub97c \ub354\ud569\ub2c8\ub2e4.(4096\uac1c\uc5d0\uc11c 0\uc744 \ube7c\uba74 4095)<br>Add 4095\u2014a value ranging from 0 to 4095\u2014to the value above. (Subtracting 0 from 4,096 yields 4,095.)<\/p>\n\n\n\n<p>1-8)\uadf8\ub7ec\uba74 \uc804\uccb4 \uba54\ubaa8\ub9ac \uc6a9\ub7c9\uc740  0xFFFFF(1,048,575) \u00d7 4096 + 4095 = 4GB \uc774\ub807\uac8c \ub429\ub2c8\ub2e4.<br>Then, the total memory capacity becomes 0xFFFFF (1,048,575) \u00d7 4096 + 4095 = 4 GB.<\/p>\n\n\n\n<p>2)D (Default Operation Size)<\/p>\n\n\n\n<p>2-1)CPU\uac00 \uc774 \uc138\uadf8\uba3c\ud2b8\ub97c 16\ube44\ud2b8\ub85c \uc0ac\uc6a9\ud560\uc9c0 32\ube44\ud2b8\ub85c \uc0ac\uc6a9\ud560\uc9c0\ub97c \uacb0\uc815\ud569\ub2c8\ub2e4.<br>It determines whether the CPU uses this segment as 16-bit or 32-bit.<\/p>\n\n\n\n<p>3)L (Long Mode)<\/p>\n\n\n\n<p>3-1)64\ube44\ud2b8 \ubaa8\ub4dc \uc5ec\ubd80\uc785\ub2c8\ub2e4.<br>Indicates whether 64-bit mode is enabled.<\/p>\n\n\n\n<p>4)AVL (Available)<\/p>\n\n\n\n<p>4-1)\uc6b4\uc601\uccb4\uc81c\uac00 \uc790\uc720\ub86d\uac8c \uc0ac\uc6a9\ud558\ub294 \ube44\ud2b8\ub85c cpu\ub294 \ubcc4\ub85c \uc2e0\uacbd\uc4f0\uc9c0 \uc54a\uc73c\uba70 \ubcf4\ud1b5 0\uc73c\ub85c \ub461\ub2c8\ub2e4.<br>This is a bit that the operating system is free to use; the CPU generally pays no attention to it and usually leaves it set to 0.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>&#8212; \ub370\uc774\ud130 \uc138\uadf8\uba3c\ud2b8 \ub514\uc2a4\ud06c\ub9bd\ud130<br>Data segment descriptor<\/p>\n\n\n\n<p>1)\ucf54\ub4dc \uc138\uadf8\uba3c\ud2b8 \ub514\uc2a4\ud06c\ub9bd\ud130\uc640 \ub370\uc774\ud130 \uc138\uadf8\uba3c\ud2b8 \ub514\uc2a4\ud06c\ub9bd\ud130\uc758 Base, Limit, Flags\ub294 \ub3d9\uc77c\ud569\ub2c8\ub2e4.<br>The Base, Limit, and Flags of the code segment descriptor and the data segment descriptor are identical.<\/p>\n\n\n\n<p>2) access byte\uc5d0\uc11c \ub294 bit3\uc758 \uc124\uc815\uac12\uc774 \ub2ec\ub77c \ucf54\ub4dc\/\ub370\uc774\ud130\ub97c \uad6c\ubd84\ud569\ub2c8\ub2e4.<br>In the access byte, the setting of bit 3 distinguishes between code and data.<\/p>\n\n\n\n<p>3)\uadf8\ub9ac\uace0 CPU\ub294 \uadf8 \uacb0\uacfc\uc5d0 \ub530\ub77c bit2\uc640 bit1\uc744 \uc11c\ub85c \ub2e4\ub978 \uc758\ubbf8(\ucf54\ub4dc\uc5d0\uc11c\ub294 Conforming\/Readable, \ub370\uc774\ud130\uc5d0\uc11c\ub294 Expand Down\/Writable)\ub85c \ud574\uc11d\ud569\ub2c8\ub2e4.<br>Based on that result, the CPU interprets bits 2 and 1 differently (as Conforming\/Readable for code, and as Expand-Down\/Writable for data).<\/p>\n\n\n\n<p>2)0x92 = 10010010<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\ube44\ud2b8<br>Bit<\/th><th>\uc774\ub984<br>Name<\/th><th>\uac12<br>Value<\/th><th>\uc124\uba85<br>Description<\/th><\/tr><\/thead><tbody><tr><td>7<\/td><td>P (Present)<\/td><td>1<\/td><td>\uc138\uadf8\uba3c\ud2b8\uac00 \uba54\ubaa8\ub9ac\uc5d0 \uc874\uc7ac<br>Segment exists in memory<\/td><\/tr><tr><td>6~5<\/td><td>DPL<\/td><td>00<\/td><td>Ring 0<\/td><\/tr><tr><td>4<\/td><td>S<\/td><td>1<\/td><td>\uc2dc\uc2a4\ud15c \uc138\uadf8\uba3c\ud2b8\uac00 \uc544\ub2c8\ub77c Code\/Data \uc138\uadf8\uba3c\ud2b8<br>Code\/Data segment, not a system segment.<\/td><\/tr><tr><td>3<\/td><td>E (Executable)<\/td><td>0<\/td><td>\uc2e4\ud589 \ubd88\uac00 \u2192 \ub370\uc774\ud130 \uc138\uadf8\uba3c\ud2b8<br>Non-executable \u2192 Data segment<\/td><\/tr><tr><td>2<\/td><td>ED (Expand Down)<\/td><td>0<\/td><td>\uc77c\ubc18 \ub370\uc774\ud130 \uc138\uadf8\uba3c\ud2b8<br>General data segment<\/td><\/tr><tr><td>1<\/td><td>W (Writable)<\/td><td>1<\/td><td>\uc4f0\uae30 \uac00\ub2a5<br>Writable<\/td><\/tr><tr><td>0<\/td><td>A (Accessed)<\/td><td>0<\/td><td>\uc544\uc9c1 \uc811\uadfc \uc548 \ud568<br>Not yet approached.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>1)P,DPL,S\ubd80\ubd84\uc740 \ucf54\ub4dc \uc138\uadf8\uba3c\ud2b8 \ub514\uc2a4\ud06c\ub9bd\ud130\uc640 \ub3d9\uc77c\ud569\ub2c8\ub2e4.<br>The P, DPL, and S fields are identical to those of the code segment descriptor.<\/p>\n\n\n\n<p>2)E (Executable)<\/p>\n\n\n\n<p>2-1)\uc774\uac12\uc774 0\uc774\uba74 \ub370\uc774\ud130 \uc138\uadf8\uba3c\ud2b8\ub77c\uace0 \ud310\ub2e8\ud569\ub2c8\ub2e4.<br>If this value is 0, it is determined to be a data segment.<\/p>\n\n\n\n<p>3)ED &#8211; Expand Down (\ub370\uc774\ud130 \uc138\uadf8\uba3c\ud2b8 \uc804\uc6a9\uc73c\ub85c \uc0ac\uc6a9\/Used exclusively for data segments)<\/p>\n\n\n\n<p>3-1)ED = 1\uc774\uba74 \uc2a4\ud0dd\ucc98\ub7fc \ub192\uc740 \uc8fc\uc18c\uc5d0\uc11c \ub0ae\uc740 \uc8fc\uc18c \ubc29\ud5a5\uc73c\ub85c \uc0ac\uc6a9\ud558\ub294 \ud2b9\uc218\ud55c \ub370\uc774\ud130 \uc138\uadf8\uba3c\ud2b8 \uc785\ub2c8\ub2e4.<br>If ED = 1, it is a special data segment that is used in the direction from high addresses to low addresses, similar to a stack.<\/p>\n\n\n\n<p>3-2)ED = 0\uc774\uba74 \uc77c\ubc18\uc801\uc778 \ub370\uc774\ud130 \uc138\uadf8\uba3c\ud2b8\uc785\ub2c8\ub2e4.<br>If ED = 0, it is a standard data segment.<\/p>\n\n\n\n<p>4)W<\/p>\n\n\n\n<p>4-1)\uc774 \uac12\uc774 1\uc774\uba74 \uc4f0\uae30\uac00 \uac00\ub2a5\ud569\ub2c8\ub2e4.<br>If this value is 1, writing is possible.<\/p>\n\n\n\n<p>5)A<\/p>\n\n\n\n<p>5-1)A \ube44\ud2b8\ub294 \ud504\ub85c\uadf8\ub798\uba38\uac00 \uc9c1\uc811 \uc0ac\uc6a9\ud558\ub294 \uac83\uc774 \uc544\ub2c8\ub77c CPU\uac00 &#8220;\uc774 \uc138\uadf8\uba3c\ud2b8\ub97c \uc0ac\uc6a9\ud588\ub2e4&#8221;\ub294 \ud45c\uc2dc\ub85c \uc0ac\uc6a9\ud558\ub294 \ube44\ud2b8\uc785\ub2c8\ub2e4.<br>The A-bit is not used directly by the programmer; instead, it is a bit used by the CPU to indicate that &#8220;this segment has been used.&#8221;<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>&#8212; CPU\uc5d0\uac8c &#8220;GDT\uac00 \uc5b4\ub514 \uc788\ub294\uc9c0&#8221; \uc54c\ub824\uc8fc\ub294 \uad6c\uc870\uccb4\uc785\ub2c8\ub2e4.(dw 2byte,dd 4byte)<br>It is a structure that tells the CPU &#8220;where the GDT is.&#8221;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gdt_pointer:\n    dw gdt_end - gdt_start - 1  ; GDT\uc758 \ud06c\uae30 (Size of GDT)\n    dd gdt_start                ; GDT\uc758 \uc2dc\uc791 \uc8fc\uc18c (Starting address of GDT)<\/code><\/pre>\n\n\n\n<p>1)lgdt [gdt_pointer] \uc774 \ucf54\ub4dc\uc5d0\uc11c \uc0ac\uc6a9\ud558\uae30 \uc704\ud55c \ubd80\ubd84\uc785\ub2c8\ub2e4.<br>This part is intended for use with the <code>lgdt [gdt_pointer]<\/code> instruction.<\/p>\n\n\n\n<p>2) gdt_end\uc640 gdt_start\ub294 \ub77c\ubca8\uc758 \uc704\uce58\uc785\ub2c8\ub2e4.<br>gdt_end and gdt_start are the locations of the labels.<\/p>\n\n\n\n<p>3)gdt_end &#8211; gdt_start = 24(8[Null Descriptor]+8[Code Descriptor]+8[Data Descriptor])<\/p>\n\n\n\n<p>4)\uadf8\ub798\uc11c dw gdt_end &#8211; gdt_start &#8211; 1 \uc774 \uac12\uc740 dw 23\uc774 \uc800\uc7a5 \ub429\ub2c8\ub2e4.<br>Therefore, the value <code>dw 23<\/code> is stored for the expression <code>dw gdt_end - gdt_start - 1<\/code>.<\/p>\n\n\n\n<p>5)gdt_start\ub294 gdt\uc2dc\uc791 \uc8fc\uc18c\uac00 \uc800\uc7a5\ub429\ub2c8\ub2e4.<br>The starting address of the GDT is stored in gdt_start.<\/p>\n\n\n\n<p>&#8212; (sector2.asm) 512\ubc14\uc774\ud2b8\uc5d0\uc11c \ub370\uc774\ud130\ub85c \uc0ac\uc6a9\ub418\uace0 \ub09c \ub098\uba38\uc9c0 \ucf54\ub4dc\ub294 0\uc73c\ub85c \ub9de\ucd94\ub294 \ubd80\ubd84\uc785\ub2c8\ub2e4.<br>(sector2.asm) This section pads the remaining space within the 512 bytes with zeros after the code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>times 512 - ($ - $$) db 0<\/code><\/pre>\n\n\n\n<p>1) boot.asm\uc5d0\uc11c \ub2e4\uc74c\uacfc \uac19\uc774 \uc139\ud130\ub97c 1\uac1c\ub9cc \uc77d\uc5b4\uc624\uba74 512\ubc14\uc774\ud2b8\uac00 \ub429\ub2c8\ub2e4.<br>If you read only one sector in boot.asm as shown below, it amounts to 512 bytes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>boot.asm\nmov al, 1 \u2192 1\uc139\ud130 \uc77d\uc74c \/ 1 Sector Read\n\nsecotr2.asm\ntimes 512 - ($ - $$) db 0<\/code><\/pre>\n\n\n\n<p>2) boot.asm\uc5d0\uc11c \ub2e4\uc74c\uacfc \uac19\uc774 \uc139\ud130\ub97c 2\uac1c\ub97c \uc77d\uc5b4\uc624\uba74 1024\ubc14\uc774\ud2b8\uac00 \ub429\ub2c8\ub2e4.<br>If you read two sectors in boot.asm as shown below, it amounts to 1024 bytes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>boot.asm\nmov al, 2 \u2192 2\uc139\ud130 \uc77d\uc74c \/ 2 Sector Read\n\nsector2.asm\ntimes 1024 - ($ - $$) db 0\n<\/code><\/pre>\n\n\n\n<p>3) boot.asm\uc5d0\uc11c \ub2e4\uc74c\uacfc \uac19\uc774 \uc139\ud130\ub97c 3\uac1c\ub97c \uc77d\uc5b4\uc624\uba74 1536\ubc14\uc774\ud2b8\uac00 \ub429\ub2c8\ub2e4.<br>If you read three sectors in boot.asm as shown below, it amounts to 1,536 bytes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>boot.asm\nmov al, 3 \u2192 3\uc139\ud130 \uc77d\uc74c \/ 3 Sector Read\n\nsector2.asm\ntimes 1536 - ($ - $$) db 0<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc49\ufe0f \ub370\uc774\ud130 \uc601\uc5ed: GDT(Global Descriptor Table) \uad6c\uc870 \uc815\uc758 \ubd80\ubd84 \ucf54\ub4dc \uc124\uba85\uc785\ub2c8\ub2e4.Data Area: This is an explanation of the code defining the GDT (Global Descriptor Table) structure. \u2714\ufe0f \ub370\uc774\ud130 \uc601\uc5ed\uc73c\ub85c GDT(Global Descriptor Table) \uad6c\uc870\ub97c \uc815\uc758 \ud569\ub2c8\ub2e4.Define the GDT (Global Descriptor Table) structure in the data area. &#8212; 4\ubc14\uc774\ud2b8 \uc815\ub82c \/ 4-byte alignment 1)\ud604\uc7ac \uc704\uce58\uc758 \ucf54\ub4dc \ub370\uc774\ud130\uc758 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,1],"tags":[],"class_list":["post-6107","post","type-post","status-publish","format-standard","hentry","category-os","category-uncategorized","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/6107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=6107"}],"version-history":[{"count":4,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/6107\/revisions"}],"predecessor-version":[{"id":6112,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/6107\/revisions\/6112"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=6107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=6107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=6107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}