{"action":"created","issue":{"url":"https://api.github.com/repos/Wonicon/nju-oslab-lecture/issues/1","repository_url":"https://api.github.com/repos/Wonicon/nju-oslab-lecture","labels_url":"https://api.github.com/repos/Wonicon/nju-oslab-lecture/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/Wonicon/nju-oslab-lecture/issues/1/comments","events_url":"https://api.github.com/repos/Wonicon/nju-oslab-lecture/issues/1/events","html_url":"https://github.com/Wonicon/nju-oslab-lecture/pull/1","id":136680529,"number":1,"title":"modified phase 1","user":{"login":"shinezyy","id":8508508,"avatar_url":"https://avatars.githubusercontent.com/u/8508508?v=3","gravatar_id":"","url":"https://api.github.com/users/shinezyy","html_url":"https://github.com/shinezyy","followers_url":"https://api.github.com/users/shinezyy/followers","following_url":"https://api.github.com/users/shinezyy/following{/other_user}","gists_url":"https://api.github.com/users/shinezyy/gists{/gist_id}","starred_url":"https://api.github.com/users/shinezyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shinezyy/subscriptions","organizations_url":"https://api.github.com/users/shinezyy/orgs","repos_url":"https://api.github.com/users/shinezyy/repos","events_url":"https://api.github.com/users/shinezyy/events{/privacy}","received_events_url":"https://api.github.com/users/shinezyy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-26T12:05:10Z","updated_at":"2016-02-26T12:12:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Wonicon/nju-oslab-lecture/pulls/1","html_url":"https://github.com/Wonicon/nju-oslab-lecture/pull/1","diff_url":"https://github.com/Wonicon/nju-oslab-lecture/pull/1.diff","patch_url":"https://github.com/Wonicon/nju-oslab-lecture/pull/1.patch"},"body":"modified phase 1"},"comment":{"url":"https://api.github.com/repos/Wonicon/nju-oslab-lecture/issues/comments/189250072","html_url":"https://github.com/Wonicon/nju-oslab-lecture/pull/1#issuecomment-189250072","issue_url":"https://api.github.com/repos/Wonicon/nju-oslab-lecture/issues/1","id":189250072,"user":{"login":"Wonicon","id":5786478,"avatar_url":"https://avatars.githubusercontent.com/u/5786478?v=3","gravatar_id":"","url":"https://api.github.com/users/Wonicon","html_url":"https://github.com/Wonicon","followers_url":"https://api.github.com/users/Wonicon/followers","following_url":"https://api.github.com/users/Wonicon/following{/other_user}","gists_url":"https://api.github.com/users/Wonicon/gists{/gist_id}","starred_url":"https://api.github.com/users/Wonicon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wonicon/subscriptions","organizations_url":"https://api.github.com/users/Wonicon/orgs","repos_url":"https://api.github.com/users/Wonicon/repos","events_url":"https://api.github.com/users/Wonicon/events{/privacy}","received_events_url":"https://api.github.com/users/Wonicon/received_events","type":"User","site_admin":false},"created_at":"2016-02-26T12:12:24Z","updated_at":"2016-02-26T12:12:24Z","body":"第一段感觉还是有点绕，我准备这么写：\r\n现在你知道了系统启动时便会执行 0x7c00 处的代码，那么我们能不能在这里就开始运行由 C 代码编译而来的程序呢？答案是否定的，因为我们处于实模式下并且 A20 地址线未打开。\r\n\r\n在实模式下，地址线的宽度是 16 位，配合段寄存器只能访问 1M 的内容；并且我们只能执行 16 位的机器指令，而编译器编译 C 代码一般得到的应该是 32 位的机器码（如果你的机器是 64 位的，那么默认生成 64 位代码，注意给 `gcc` 加上 `-m32` 编译选项）。\r\n\r\n如果我们设置了 CR0 的 `PE` 位从而进入了保护模式，可以执行 32 位代码了，但是如果 A20 地址线没有打开，则可以访问的内存只能是奇数 1M 段，即 1M, 3M, 5M...也就是 00000-FFFFF, 200000-2FFFFF, 300000-3FFFFF...\r\n\r\n为了将游戏运行起来，首先需要打破这些枷锁。那么我们是先开启保护模式还是先打开A20地址线呢？在开启保护模式前，可以方便地使用 BIOS 中断来开启 A20 地址线，所以我们建议你先打开 A20 地址线。"}}