diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
new file mode 100644
index 0000000000000000000000000000000000000000..40e72158bdc374ad55673064cf4e06fa29909e5f
--- /dev/null
+++ b/CONTRIBUTORS.md
@@ -0,0 +1,15 @@
+
+# Contributors
+- Quentin "MrXedac" Bergougnoux
+- Gilles Grimaud
+
+Some sources of inspirations:
+
+the OSDev Wiki & Forums:
+- http://wiki.osdev.org/Main_Page
+- http://forum.osdev.org
+
+James Molloy's Kernel Dev "Tutorial" as well as from Bran's one:
+- http://www.jamesmolloy.co.uk/tutorial_html/
+- http://www.osdever.net/bkerndev/Docs/intro.htm
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..9cecc1d4669ee8af2ca727a5d8cde10cd8b2d7cc
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    {one line to give the program's name and a brief idea of what it does.}
+    Copyright (C) {year}  {name of author}
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    {project}  Copyright (C) {year}  {fullname}
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..ef4893f535af55544d18b096ca5c76177a1f6005
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,61 @@
+IMAGE=mykernel.iso
+BINFILE=iso/boot/mykernel.bin
+SRC_DIR=src
+INC_DIR=include
+
+# Toolchain
+CC=gcc #x86_64-pc-linux-gnu-gcc
+AS=nasm
+LD=ld  #x86_64-elf-ld
+
+# Sources
+CSOURCES=$(wildcard $(SRC_DIR)/*.c)
+HSOURCES=$(wildcard $(INC_DIR)/*.h)
+ASOURCES=$(sort $(wildcard  $(SRC_DIR)/*.s))
+
+# Objects
+COBJ=$(CSOURCES:.c=.o)
+AOBJ=$(ASOURCES:.s=.o)
+
+# Toolchain flags
+CFLAGS=-m32 -Wall -Werror -nostdlib -fno-builtin -fno-stack-protector -std=gnu99 -ffreestanding -c -g -Wno-unused-variable -fPIC -g
+LDFLAGS=-melf_i386 -z max-page-size=0x1000 -g
+ASFLAGS=-felf
+
+# Include directories
+CFLAGS+=-I$(INC_DIR)
+
+all: $(IMAGE)
+	@echo "Done !"
+
+$(IMAGE): $(BINFILE)
+	grub-mkrescue -d /usr/lib/grub/i386-pc/ -o $(IMAGE) iso
+
+run:
+	qemu-system-x86_64 -boot d -m 2048 -cdrom mykernel.iso
+
+run_curses:
+	qemu-system-x86_64 -boot d -m 2048 -cdrom mykernel.iso -curses
+
+debug:
+	qemu-system-i386 -s -S -boot d -m 2048 -cdrom mykernel.iso -d cpu_reset -monitor stdio
+
+debug_curses:
+	qemu-system-i386 -s -S -boot d -m 2048 -cdrom mykernel.iso -curses -d cpu_reset -monitor stdio
+
+attach:
+	gdb -ex "set arch i386" -ex "file $(BINFILE)" -ex "target remote localhost:1234"
+
+$(BINFILE): $(AOBJ) $(COBJ)
+	$(LD) $(LDFLAGS) -Tlink.ld $^ -o $@
+
+%.o: %.c $(HSOURCES)
+	$(CC) $(CFLAGS) $< -o $@
+
+%.o: %.s
+	$(AS) $(ASFLAGS) $< -o $@
+
+clean:
+	rm -f $(COBJ) $(AOBJ) $(BINFILE) $(IMAGE)
+
+.PHONY: run run_curses
diff --git a/README.md b/README.md
index ee59c3012f7768e5aad686d53fcebfdd80e571db..928cb164bd906c1a61a7579becf48d7338e8a5b8 100644
--- a/README.md
+++ b/README.md
@@ -1,92 +1,129 @@
-# my kernel
+first kernel
+------------
 
+The first kernel project is a skeleton for low level direct programming of x86 hardware. 
+It builds a simple bootable .iso file using grub and running your main.c file. 
 
+## files description
+ 
+Here is the initial file structure of the project : 
 
-## Getting started
+```
+	.
+	├── boot		The directory structure used by grub-mkrescue to build a bootable .iso
+	│   └── grub		
+	│       ├── grub.cfg	The grub configuration file
+	│       └── unicode.pf2	The unicode font used by grub
+	├── CONTRIBUTORS.md	The contributors list of this skeleton
+	├── include		The directory used to store .h file
+	    ├── ioport.h	C wrapper to in and out intel assembly instructions 
+	    ├── gdt.h		Global Descriptor Table interface providing a default setup
+	    ├── idt.h		Interrupt Descriptor Table configuration and interface
+	├── LICENSE		The GNU General Public Licence used by this project
+	├── link.ld		The link script used by gcc to build the project
+	├── Makefile		The makefile building mykernel.iso from the source 
+	├── README.md		This file (using markdown)
+	└── src			The directory used to store the assembly and C sources
+	    ├── 0boot.s		The actual entrypoint called by multiboot
+	    ├── idt0.s		Interrupt Descriptor Table assembly routines
+	    ├── idt.c		Interrupt Descriptor Table configuration and interface
+	    ├── gdt.c		Global Descriptor Table configuration and interface
+	    └── main.c		The main.c file where the main() is implemented.
+```
 
-To make it easy for you to get started with GitLab, here's a list of recommended next steps.
+## get started
 
-Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
+The source of your kernel is splitted in five files : 
+1. 0boot.s 
+2. main.c
+4. gdt.c
+5. idt0.s
+6. idt.c
 
-## Add your files
+0boot.s is the real entry point of your kernel. It just stops hardware interrupt, sets a call-stack and
+jumps to the C main with the multiboot structure address as argument of main.
 
-- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
-- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
+IDT and GDT-related files should be working out of the box, and configure the CPU on boot. You can play
+with the IDT configuration to handle various interrupts.
 
-```
-cd existing_repo
-git remote add origin https://gitlab.univ-lille.fr/fil-ase2023-groupe2/my-kernel.git
-git branch -M main
-git push -uf origin main
-```
+main.c is the C code that will run : your kernel ! You can change it in order to print "Hello My World".
+
+	$ vi src/main.c   
+
+In order to build you first kernel, just run the Makefile :
+
+	$ make
+
+"make" will assembly the assembly code (using nasm) and compile the C code (using gcc). 
 
-## Integrate with your tools
+It will use a specific link script "./link.ld" to build the binary image (using ld). 
 
-- [ ] [Set up project integrations](https://gitlab.univ-lille.fr/fil-ase2023-groupe2/my-kernel/-/settings/integrations)
+The binary image (namely mykernel.bin) will be copied in ./grub/ in order to build the .iso file 
+(using grub-mkrescue). 
 
-## Collaborate with your team
+If nothing goes wrong you will get a "mykernel.iso" file in "./" of the project. 
+You can burn it to run your software. In this case your code will be run on a bare metal environment. 
+This is the goal of the project. Nevertheless, developping software on bare metal environment is boring.
+You don't have your usual "operating system facility" to run and test your software. 
+Most of the time, a bug will conclude by freezing or rebooting the machine. So we invite you to debug your
+kernel on an emulator, namely qemu.
 
-- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
-- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
-- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
-- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
-- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
+In order to run your .iso file on qemu just try :
 
-## Test and Deploy
+	$ make run
 
-Use the built-in continuous integration in GitLab.
+qemu will emulate an x86 hardware environment running your iso file. That's it ! 
 
-- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
-- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
-- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
-- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
-- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
 
-***
+You could also clean your project using :
 
-# Editing this README
+	$ make clean
 
-When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
+## Build the kernel on OSX
 
-## Suggestions for a good README
-Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
+First, you need to set up yours. Using [MacPorts](https://www.macports.org/install.php) you will be able to install needed tools.
 
-## Name
-Choose a self-explaining name for your project.
+	$ port install i386-elf-binutils nasm
 
-## Description
-Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
 
-## Badges
-On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
+After that, test if and are installed, for example with the following command:
 
-## Visuals
-Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
+	$ which i386-elf-gcc nasm
+	/opt/local/bin/i386-elf-gcc
+	/opt/local/bin/nasm
 
-## Installation
-Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
+Now, you need to install GRUB2. Source: [os-dev](http://wiki.osdev.org/GRUB_2#Installing_GRUB_2_on_OS_X)
 
-## Usage
-Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
+1. Clone the developer version of the sources:
 
-## Support
-Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
+```
+$ git clone git://git.savannah.gnu.org/grub.git
+```
+2. A tool named [objconv](https://github.com/vertis/objconv) is required, get it from:
+```
+$ git clone https://github.com/vertis/objconv.git
+```
+Download sources, compile (see website for details) and make available in your PATH.
+
+3. Run "autogen.sh" in the GRUB sources folder 
+
+4. Create a seperate build directory, switch to it, and run GRUB's configure script (insert your target-specific tools!): 
+```
+$ ../grub/configure --disable-werror TARGET_CC=i386-elf-gcc TARGET_OBJCOPY=i386-elf-objcopy \ TARGET_STRIP=i386-elf-strip TARGET_NM=i386-elf-nm TARGET_RANLIB=i386-elf-ranlib --target=i386-elf
+```
+5. Run "make" and "make install" 
+Now you have a working GRUB 2 that has the required files to build an image that boots on i386 platforms. 
 
-## Roadmap
-If you have ideas for releases in the future, it is a good idea to list them in the README.
+Finaly, you will need a version of xorriso above 1.2.9, using [brew](https://brew.sh/):
 
-## Contributing
-State if you are open to contributions and what your requirements are for accepting them.
+	$ brew install xorriso
 
-For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
+PS: If you miss some dependencies, fix it and let me know.
 
-You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
+Now, you will need to tell, where are your installed package. In order to do that, add the prefix i386-elf to gcc and ld. Then change targeted directory by the one you will found with the next command:
 
-## Authors and acknowledgment
-Show your appreciation to those who have contributed to the project.
+	$ sudo find / -type f -name modinfo.sh
 
-## License
-For open source projects, say how it is licensed.
+In my case: /usr/local/lib/grub/i386-pc/
 
-## Project status
-If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
+/!\ Don't forget to update the Makefile with the right tools /!\
diff --git a/include/gdt.h b/include/gdt.h
new file mode 100644
index 0000000000000000000000000000000000000000..7446cd5a57298920094306c208af4ba29677ad33
--- /dev/null
+++ b/include/gdt.h
@@ -0,0 +1,115 @@
+/**
+ * Global Descriptor Table structure and configuration
+ */
+
+#ifndef __GDT__
+#define __GDT__
+
+#include <stdint.h>
+
+/**
+ * gdt_init_default init the global descriptor table with to provide a complete access to the
+ * memory. In this way segments are almost "invisibles". others gdt.h declarations are useless 
+ * until you wanna to manage intel segmentation.   
+ */
+void gdt_init_default();
+
+/**
+ * struct gdt_entry_s is the data structure for a single gdt entry as specify by intel.
+ */
+struct gdt_entry_s {
+	unsigned int limit_low   : 16;/* Lower 16bits of address limit */
+	unsigned int base_low    : 16;/* Lower 16bits of base address */
+	unsigned int base_middle : 8; /* Middle 8bits of base address */
+	unsigned int access_ac   : 1; /* Access bit will be set when cpu actually use the entry */
+	unsigned int access_RW   : 1; /* Readable segment for code/Writable segment for data (cfEx)*/
+	unsigned int access_DC   : 1; /* Direction bit for data or Conforming bit for code */
+	unsigned int access_Ex   : 1; /* Executable bit. 1 means code segment, 0 means data segment */
+	unsigned int access_one  : 1; /* must be set to 1 */
+	unsigned int access_Privl: 2; /* Ring level of the segment : from 0(kernel) to 3(user)*/
+	unsigned int access_Pr   : 1; /* Present bit : set to one for a valid gdt entry */
+	unsigned int limit_high  : 4; /* Higher 4bits of the address limit */
+	unsigned int flags_zero  : 1; /* must be set to 0 */
+	unsigned int flags_L     : 1; /* must be set for 64bits large gdt entry. */
+	unsigned int flags_Sz    : 1; /* must be set for 32bits protected mod entry */
+	unsigned int flags_Gr    : 1; /* when set, the limit is multiply by 4096 */
+	unsigned int base_high   : 8; /* Higher bytes of base address */
+} ;
+
+/**
+ * GDT_NULL_SEGMENT() define a struct gdt_entry initializer declaring a NULL segment gdt_entry_s.
+ *   i.e. All flags init to zero. 
+ */
+#define GDT_NULL_SEGMENT() {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
+
+/**
+ * GDT_CODE_SEGMENT() define a struct gdt_entry initializer declaring a code segment gdt_entry_s.
+ *  parameters description are described in the dynamic counterpart 'void gdt_set_codesegment_entry(...)'.
+ */
+#define GDT_CODE_SEGMENT(base,limit,limit_gr,accessible, conforming, ring_level) {(limit & 0xFFFF),(base & 0xFFFF),(base>>16)&0xFF,0,accessible,conforming,1,1,ring_level,1,((limit >> 16) & 0x0F),0,0,1,limit_gr,(base >> 24) & 0xFF }
+/**
+ * GDT_DATA_SEGMENT() define a struct gdt_entry initializer declaring a data segment gdt_entry_s.
+ *  parameters description are described in the dynamic counterpart 'void gdt_set_datasegment_entry(...)'.
+ */
+#define GDT_DATA_SEGMENT(base, limit, limit_gr, accessible, direction, ring_level) {(limit & 0xFFFF),(base & 0xFFFF),(base >> 16) & 0xFF,0,accessible,direction,0,1,ring_level,1,((limit >> 16) & 0x0F),0,0,1,limit_gr,(base >> 24) & 0xFF }
+
+#define GDT_TSS(base, limit, ring_level) {(limit & 0xFFFF),(base & 0xFFFF),(base >> 16) & 0xFF,1,0,0,1,0,ring_level,1,((limit >> 16) & 0x0F),0,0,0,0,(base >> 24) & 0xFF }
+
+/**
+ * here after the gdt_entries used by the default_setup.
+ */ 
+#define DEFAULT_GDT_ENTRIES 6
+extern struct gdt_entry_s default_gdt[DEFAULT_GDT_ENTRIES];
+
+/**
+ * gdt_activate setup the cpu gdt register and associated segments register
+ *   gdt_base   : the address of the global descriptor table             (part of intel register gdt)
+ *   gdt_limit  : the size, in bytes, of the global descriptor table - 1 (part of intel register gdt)
+ *   cs         : offset of the code segment to use in this table        (intel register cs)
+ *   ds         : offset of the 1st data segment to use in this table    (intel register ds)
+ *   es         : offset of the 2nd data segment to use in this table    (intel register es) 
+ *   fs         : offset of the 3rd data segment to use in this table    (intel register fs)
+ *   gs         : offset of the 4th data segment to use in this table    (intel register gs)
+ *   ss         : offset of the stack segment to use in this table       (intel register ss) 
+ */
+void gdt_activate(struct gdt_entry_s *gdt_base, uint16_t gdt_limit, uint16_t cs, uint16_t ds, uint16_t es, uint16_t fs, uint16_t gs, uint16_t ss);
+
+/**
+ * gdt_set_codesegment_entry is used to setup an entry of the gdt. 
+ *  - entry : the entry address ;
+ *  - base  : the base address for the segment ;
+ *  - limit : the size of the segment ;
+ *  - limit_granularity : the metric of 'limit' 
+ *              0 means limit is give in bytes, 
+ *              1 means limit is give in page of 4096 bytes ;
+ *  - accessible :      for code segment, if accessible, reading is allowed,
+ *                      for data segment, if accessible, writing is allowed (reading allways allowed)
+ *  - conforming : 
+ *              0 means the segment can only be call/jump form a segment of the same ring level
+ *              1 means the segment can be call/jump from a segment of higher ring level
+ *  - ring_level : the ring_level give to the segment ;
+ */
+void gdt_set_codesegment_entry(struct gdt_entry_s *entry, uint32_t base, uint32_t limit, int limit_granularity, int accessible, int conforming, int ring_level );
+
+/**
+ * gdt_set_datasegment_entry is used to setup an entry of the gdt. 
+ *  - entry : the entry address ;
+ *  - base  : the base address for the segment ;
+ *  - limit : the size of the segment ;
+ *  - limit_granularity : the metric of 'limit' 
+ *              0 means limit is give in bytes, 
+ *              1 means limit is give in page of 4096 bytes ;
+ *  - accessible : if accessible(==1), writing is allowed (reading allways allowed)
+ *  - direction : 
+ *              0 means segment is growing (limit is after base address)
+ *              1 means segment is decreasing (limit is before base address, like a stack) 
+ *  - ring_level : the ring_level give to the segment ;
+ */
+void gdt_set_datasegment_entry(struct gdt_entry_s *entry, uint32_t base, uint32_t limit, int limit_granularity, int accessible, int direction, int ring_level );
+
+/**
+ * gdt_set_null_entry is used to setup an entry of the gdt. 
+ *  - entry : the entry address ;
+ */
+void gdt_set_null_entry(struct gdt_entry_s *entry);
+#endif
diff --git a/include/idt.h b/include/idt.h
new file mode 100644
index 0000000000000000000000000000000000000000..39d2ae43df4e5b8449f5a5621422bdba7b161e38
--- /dev/null
+++ b/include/idt.h
@@ -0,0 +1,55 @@
+/**
+ * Interrupt Descriptor Table structure and configuration
+ */
+
+#ifndef __IDT__
+#define __IDT__
+
+#include <stdint.h>
+
+struct idt_entry_struct
+{
+	uint16_t base_lo;
+	uint16_t sel;
+	uint8_t  always0; 	
+	uint8_t  flags; 	
+	uint16_t base_hi; 
+} __attribute__((packed));
+
+struct idt_ptr_struct
+{
+	uint16_t limit; //!< Address limit
+	uint32_t base; //!< IDT pointer base
+} __attribute__((packed));
+
+typedef const struct int_regs
+{
+    uint32_t ds;
+	uint32_t edi; 
+	uint32_t esi; 
+	uint32_t ebp; 
+	uint32_t esp; 
+	uint32_t ebx; 
+	uint32_t edx; 
+	uint32_t ecx; 
+	uint32_t eax; 
+    uint32_t int_no; 
+	uint32_t err_code; 
+	uint32_t eip; 
+	uint32_t cs; 
+	uint32_t eflags; 
+	uint32_t useresp; 
+	uint32_t ss; 
+} int_regs_t ;
+
+void setup_idt();
+void idt_setup_descriptor(uint8_t num, uint32_t base, uint16_t sel, uint8_t flags);
+void idt_setup_irq_handler(int irq, void (*handler)(int_regs_t *r));
+void idt_setup_int_handler(int intno, void (*handler)(int_regs_t *r));
+extern void zero_idt(struct idt_entry_struct *entries);
+void end_of_interrupt();
+
+#define irq_enable() asm("sti")
+#define irq_disable() asm("cli")
+
+#endif
diff --git a/include/ioport.h b/include/ioport.h
new file mode 100644
index 0000000000000000000000000000000000000000..8111a00f864bbf81b55e1d77fc8842ed5744fa23
--- /dev/null
+++ b/include/ioport.h
@@ -0,0 +1,28 @@
+#ifndef _IOPORT_H_
+#define _IOPORT_H_
+
+/* read a byte from the ioport 'port' */
+static inline unsigned char _inb(unsigned short port) {
+  unsigned char ret;
+  asm("inb %1,%0": "=a" (ret) : "Nd" (port) :);
+  /***
+   * N.B. in inb %0,%1 :  
+   *   %0 must be the register al => "=a" 
+   *   %1 must be a 8bits imediate value (N) or the register dx (d) =>"Nd"
+   *      %1 constraint also limit the var. port to a 16bits value => "[unsigned] short".
+   */
+  return ret;
+} 
+
+/* write a byte value in the ioport 'port' */
+static inline void _outb(unsigned short port, unsigned char value) {
+  asm("outb %0,%1":: "a" (value), "Nd" (port) :);
+  /***
+   * N.B. in outb %0,%1 :
+   *   %0 must be the register al => "a"
+   *   %1 must be a 8bits imediate value (N) or the register dx =>"Nd"
+   *      %1 constraint also limit the var. port to a 16bits value => "[unsigned] short".
+   */
+}
+
+#endif
diff --git a/include/minilib.h b/include/minilib.h
new file mode 100644
index 0000000000000000000000000000000000000000..16ca8430c6c63ae8330f3a4f5b872d8b6ff42263
--- /dev/null
+++ b/include/minilib.h
@@ -0,0 +1,18 @@
+#ifndef __MINILIB_H__
+#define __MINILIB_H__
+
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
+
+extern void __assert__(int x, char *f, unsigned line);
+
+#define assert(x) __assert__(x, __FILE__, __LINE__) 
+
+void clear_screen();				/* clear screen */
+void putc(char aChar);				/* print a single char on screen */
+void puts(char *aString);			/* print a string on the screen */
+void puthex(unsigned aNumber);		/* print an Hex number on screen */
+void putud(unsigned aNumber);       /* print a unsigned decimal on screen */
+void memset(void *, int, int);
+#endif
diff --git a/include/mmu.h b/include/mmu.h
new file mode 100644
index 0000000000000000000000000000000000000000..13a95694ba57046f71ef48f95d7362a28a3ad0e9
--- /dev/null
+++ b/include/mmu.h
@@ -0,0 +1,47 @@
+#ifndef __MMU_H__
+
+#define __MMU_H__
+
+#define CR0_PG	0x80000000
+#define CR0_WP	0x00010000
+
+#define PAGE_SIZE	4096
+
+#define PAGE_TABLE_KERNEL	0
+#define PAGE_TABLE_USER		1
+#define PAGE_TABLE_FREE		2
+
+struct pde_s {
+    int p:1;
+    int rw:1;
+    int us:1;
+    int pwt: 1;
+    int pcd:1;
+    int a:1;
+    int unused2:1;
+    int ps:1;
+    int unused1:4;
+    int address:20;
+} __attribute__((packed));
+
+struct pte_s {
+    int p:1;
+    int rw:1;
+    int us:1;
+    int pwt: 1;
+    int pcd:1;
+    int a:1;
+    int d:1;
+    int pat:1;
+    int g:1;
+    int unused1:3;
+    int address:20;
+} __attribute__((packed));
+
+#define PT_SIZE 1024
+
+extern void setup_mmu();
+extern unsigned int get_fault_address();
+extern void flush_tlb();
+extern void setup_page_table(int, struct pte_s[]);
+#endif
diff --git a/include/syscalls.h b/include/syscalls.h
new file mode 100644
index 0000000000000000000000000000000000000000..0bcc971b1c9355755d76b9fcda4760ae8330b163
--- /dev/null
+++ b/include/syscalls.h
@@ -0,0 +1,4 @@
+#ifndef __SYSCALLS_H__
+#define __SYSCALLS_H__
+#define SYSCALL_PUTC	1
+#endif
diff --git a/include/tss.h b/include/tss.h
new file mode 100644
index 0000000000000000000000000000000000000000..a50dd4a37b50b2215ef1347163ffc5c9aa85dd41
--- /dev/null
+++ b/include/tss.h
@@ -0,0 +1,36 @@
+#ifndef __TSS_H__
+#define __TSS_H__
+#include "gdt.h"
+
+struct tss_s { /* Copypaste from OSDev wiki */
+	unsigned int prev_tss; 
+	unsigned int esp0;
+	unsigned int ss0;
+	unsigned int esp1;
+	unsigned int ss1;
+	unsigned int esp2;
+	unsigned int ss2;
+	unsigned int cr3;
+	unsigned int eip;
+	unsigned int eflags;
+	unsigned int eax;
+	unsigned int ecx;
+	unsigned int edx;
+	unsigned int ebx;
+	unsigned int esp;
+	unsigned int ebp;
+	unsigned int esi;
+	unsigned int edi;
+	unsigned int es;
+	unsigned int cs;
+	unsigned int ss;
+	unsigned int ds;
+	unsigned int fs;
+	unsigned int gs;
+	unsigned int ldt;
+	unsigned short int trap;
+	unsigned short int iomap_base;
+} __attribute__ ((packed));
+
+extern void setup_tss(struct gdt_entry_s*);
+#endif
diff --git a/iso/boot/grub/grub.cfg b/iso/boot/grub/grub.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..aadecd647af2a9e0a11e6a5e57678340cfa50fb1
--- /dev/null
+++ b/iso/boot/grub/grub.cfg
@@ -0,0 +1,22 @@
+set timeout=10
+set default=0
+
+function load_video {
+	insmod vbe
+	insmod vga
+	insmod png
+}
+
+if loadfont /boot/grub/unicode.pf2
+then
+	load_video
+	insmod gfxterm
+	set gfxmode=640x480x32
+	set gfxpayload=keep
+	terminal_output gfxterm
+fi
+
+menuentry "my first kernel" {
+	multiboot2 /boot/mykernel.bin -v 
+	boot
+}
diff --git a/iso/boot/grub/unicode.pf2 b/iso/boot/grub/unicode.pf2
new file mode 100644
index 0000000000000000000000000000000000000000..8412a6a37341d4ef2bcb63f11c3846418ba36321
Binary files /dev/null and b/iso/boot/grub/unicode.pf2 differ
diff --git a/link.ld b/link.ld
new file mode 100644
index 0000000000000000000000000000000000000000..b2a055b636175059f721744dbc5bd06061174b67
--- /dev/null
+++ b/link.ld
@@ -0,0 +1,39 @@
+OUTPUT_FORMAT("elf32-i386")
+ENTRY(start)
+phys = 0x00100000;
+SECTIONS
+{
+	.user 0x400000 :
+	{
+		src/user.o (.text* .data .rodata .bss)
+	}
+
+	.text phys : AT(phys)
+	{
+		code = .; _code = .; __code = .;
+		*(.text)
+		. = ALIGN(4096);
+	}
+	.data :
+	{
+		data = .; _data = .; __data = .;
+		*(.data)
+		*(.rodata)
+		. = ALIGN(4096);
+	}
+	.bss :
+	{
+		bss = .; _bss = .; __bss = .;
+		*(.bss)
+		. = ALIGN(4096);
+	}
+	.stack :
+	{
+		stack = .; _stack = .; __stack = .;
+		*(.stack)
+		. = ALIGN(4096);
+	}
+
+
+	end = .; _end = .; __end = .;
+}
diff --git a/src/0boot.s b/src/0boot.s
new file mode 100644
index 0000000000000000000000000000000000000000..a5ebea05aeb5ae60b7483308a0ee82f783b7ba1e
--- /dev/null
+++ b/src/0boot.s
@@ -0,0 +1,40 @@
+[BITS 32]
+
+[GLOBAL start]
+[GLOBAL mboot]
+[EXTERN main]
+ALIGN 4
+
+SECTION .text
+; Multiboot2 header
+mboot:
+	MBOOT_HEADER_MAGIC	equ	0xe85250d6
+	MBOOT_ARCH_I386		equ	0x0
+	MBOOT_SIZE			equ	multiboot_header_end - mboot
+	MBOOT_CHECKSUM		equ	-(MBOOT_HEADER_MAGIC + MBOOT_ARCH_I386 + multiboot_header_end - mboot)
+
+	EXTERN code, bss, end
+
+	dd  MBOOT_HEADER_MAGIC
+	dd  MBOOT_ARCH_I386
+	dd  MBOOT_SIZE
+	dd  MBOOT_CHECKSUM
+	dd  mboot
+	dd  code
+	dd  bss
+	dd  end
+	dd  start
+multiboot_header_end:
+
+; x86 bootstrap code
+start:
+	cli			; Clear interrupts
+	mov esp, _earlystack	; Setup early-boot stack
+	push ebx		; Push multiboot2 info to main()
+	call main		; Call main()
+	jmp $			; We shouldn't return from main. If so, loop forever.
+
+SECTION .stack
+	times 8192 db 0		; Allocate a 8kb early-boot stack. This should be more than enough.
+	_earlystack:
+
diff --git a/src/0user.s b/src/0user.s
new file mode 100644
index 0000000000000000000000000000000000000000..9136dc6d49eed816c223afb415328873cd526aa5
--- /dev/null
+++ b/src/0user.s
@@ -0,0 +1,23 @@
+global user
+
+extern user_entry
+extern user_stack
+
+user:
+	mov ax, 0x28
+	ltr ax
+	
+	mov ax, 0x23
+	mov ds, ax
+	mov es, ax
+	mov fs, ax
+	mov gs, ax
+	mov eax, user_stack + 65536 - 4
+	push 0x23
+	push eax
+	pushf
+	push 0x1B
+	push user_entry
+	iret
+
+
diff --git a/src/appmain.c b/src/appmain.c
new file mode 100644
index 0000000000000000000000000000000000000000..6d8841c2cb96eed74a8030b8c9d1ae554d6875d7
--- /dev/null
+++ b/src/appmain.c
@@ -0,0 +1,6 @@
+#include "minilib.h"
+
+void app_main()
+{
+    puts("TODO\n");
+}
diff --git a/src/gdt.c b/src/gdt.c
new file mode 100644
index 0000000000000000000000000000000000000000..a7e28e19650681086ce8a7da49056dab048b7beb
--- /dev/null
+++ b/src/gdt.c
@@ -0,0 +1,158 @@
+#include "gdt.h"
+#include "tss.h"
+
+#include "minilib.h"
+
+#define GDT_TSS_INDEX	5
+struct gdt_entry_s default_gdt[DEFAULT_GDT_ENTRIES] = {
+	GDT_NULL_SEGMENT(), 			/* 0x00 is not present */ 
+	GDT_CODE_SEGMENT(0,0xFFFFF,1,1,0,0),	/* 0x08 is code seg: base 0, limit 4Gb, ring lvl 0 */ 
+	GDT_DATA_SEGMENT(0,0xFFFFF,1,1,0,0),	/* 0x10 is data seg: base 0, limit 4Gb, ring lvl 0 */
+	GDT_CODE_SEGMENT(0,0xFFFFF,1,1,0,3),	/* 0x18 is code seg: base 0, limit 4Gb, ring lvl 3 */ 
+	GDT_DATA_SEGMENT(0,0xFFFFF,1,1,0,3),	/* 0x20 is data seg: base 0, limit 4Gb, ring lvl 3 */
+	GDT_TSS(0, sizeof(struct tss_s), 0),		/* 0x28 is TSS, ring lvl 0 */
+
+};
+
+/**
+ * struct gdt_register is the 48 bits data structure of the intel Gobal Descriptor Table register.
+ */
+struct gdt_register
+{
+        uint16_t limit : 16;	/* 16 bits for the size of the Global Descriptor Table (-1) */
+        uint32_t base  : 32;	/* 32 bits for the address of the Global Descriptor Table */
+} __attribute__((packed));	/* this gcc directive avoid fields padding, base will not be aligned */ 
+
+/**
+ * gdt_activate setup the cpu gdt register and associated segments register
+ *   gdt_base	: the address of the global descriptor table             (part of intel register gdt)
+ *   gdt_limit	: the size, in bytes, of the global descriptor table - 1 (part of intel register gdt)
+ *   cs 	: offset of the code segment to use in this table        (intel register cs)
+ *   ds		: offset of the 1st data segment to use in this table    (intel register ds)
+ *   es		: offset of the 2nd data segment to use in this table    (intel register es) 
+ *   fs		: offset of the 3rd data segment to use in this table    (intel register fs)
+ *   gs		: offset of the 4th data segment to use in this table    (intel register gs)
+ *   ss		: offset of the stack segment to use in this table       (intel register ss) 
+ */
+void gdt_activate(struct gdt_entry_s *gdt_base, uint16_t gdt_limit, uint16_t cs, uint16_t ds, uint16_t es, uint16_t fs, uint16_t gs, uint16_t ss) {
+	struct gdt_register gr;
+	gr.base  = (uint32_t)gdt_base;
+	gr.limit = gdt_limit;
+
+	setup_tss(gdt_base + GDT_TSS_INDEX); 
+
+	/* set the gdt for the 48bits ptr */
+	asm( "lgdt %0" : :"m" (gr) :);  
+	/* set the data segment registers (ds,es,fs,gs & ss) */
+	asm( "movw %0,%%ds" : :"r" (ds) :);
+	asm( "movw %0,%%es" : :"r" (es) :);
+	asm( "movw %0,%%fs" : :"r" (fs) :);
+	asm( "movw %0,%%gs" : :"r" (gs) :);
+	asm( "movw %0,%%ss" : :"r" (ss) :);
+	/* set the code segment register (cs) using a fake retf */ 
+	asm( 	"pushl %0     \n"
+		"push $cs_set \n"
+		"retf         \n" /* far jump to cs_set with %0 as cs */
+		"cs_set:      \n"
+		::"r" ((uint32_t)cs):);
+}
+
+/**
+ * gdt_set_codesegment_entry is used to set up an entry of the gdt used as a codesegment. 
+ *  - entry : the entry address ;
+ *  - base  : the base address for the segment ;
+ *  - limit : the size of the segment ;
+ *  - limit_granularity : the metric of 'limit' 
+ *		0 means limit is give in bytes, 
+ * 		1 means limit is give in page of 4096 bytes ;
+ *  - accessible : 	for code segment, if accessible, reading is allowed,
+ *			for data segment, if accessible, writing is allowed (reading allways allowed)
+ *  - conforming : 
+ *		0 means the segment can only be call/jump form a segment of the same ring level
+ * 		1 means the segment can be call/jump from a segment of higher ring level
+ *  - ring_level : the ring_level give to the segment ;
+ */
+ 
+void gdt_set_codesegment_entry(struct gdt_entry_s *entry, uint32_t base, uint32_t limit, int limit_granularity, int accessible, int conforming, int ring_level ) {
+	entry->base_low    = (base & 0xFFFF);
+	entry->base_middle = (base >> 16) & 0xFF;
+	entry->base_high   = (base >> 24) & 0xFF;
+	entry->limit_low   = (limit & 0xFFFF);
+	entry->limit_high  = ((limit >> 16) & 0x0F);
+	entry->flags_zero  = 0;
+	entry->flags_L     = 0; /* here we assume 32bits protected mod and not 64 */
+	entry->flags_Sz    = 1; /* here we assume 32bits protected mod and not 16 */
+	entry->flags_Gr    = limit_granularity;
+	entry->access_ac   = 0;
+	entry->access_RW   = accessible;
+	entry->access_DC   = conforming;
+	entry->access_Ex   = 1; /* this is a code segment entry */
+	entry->access_one  = 1;
+	entry->access_Privl= ring_level;
+	entry->access_Pr   = 1;
+}
+
+/**
+ * gdt_set_datasegment_entry is used to set up an entry of the gdt used as datasegment. 
+ *  - entry : the entry address ;
+ *  - base  : the base address for the segment ;
+ *  - limit : the size of the segment ;
+ *  - limit_granularity : the metric of 'limit' 
+ *		0 means limit is give in bytes, 
+ * 		1 means limit is give in page of 4096 bytes ;
+ *  - accessible : if accessible(==1), writing is allowed (reading allways allowed)
+ *  - direction : 
+ *		0 means segment is growing (limit is after base address)
+ * 		1 means segment is decreasing (limit is before base address, like a stack) 
+ *  - ring_level : the ring_level give to the segment ;
+ */
+void gdt_set_datasegment_entry(struct gdt_entry_s *entry, uint32_t base, uint32_t limit, int limit_granularity, int accessible, int direction, int ring_level ) {
+	entry->base_low    = (base & 0xFFFF);
+	entry->base_middle = (base >> 16) & 0xFF;
+	entry->base_high   = (base >> 24) & 0xFF;
+	entry->limit_low   = (limit & 0xFFFF);
+	entry->limit_high  = ((limit >> 16) & 0x0F);
+	entry->flags_zero  = 0;
+	entry->flags_L     = 0; /* this is not a 64bits large entry */
+	entry->flags_Sz    = 1; /* this is not a 16bits entry, but a 32 bits protected mod entry */
+	entry->flags_Gr    = limit_granularity;
+	entry->access_ac   = 0;
+	entry->access_RW   = accessible;
+	entry->access_DC   = direction;
+	entry->access_Ex   = 0; /* this is a data segment entry */
+	entry->access_one  = 1;
+	entry->access_Privl= ring_level;
+	entry->access_Pr   = 1;
+}
+
+/**
+ * gdt_set_null_entry is used to set up an entry of the gdt unused (nul). 
+ *  - entry : the entry address ;
+ */
+void gdt_set_null_entry(struct gdt_entry_s *entry) {
+	entry->base_low    = 0;
+	entry->base_middle = 0;
+	entry->base_high   = 0;
+	entry->limit_low   = 0;
+	entry->limit_high  = 0;
+	entry->flags_zero  = 0;
+	entry->flags_L     = 0; 
+	entry->flags_Sz    = 0; 
+	entry->flags_Gr    = 0;
+	entry->access_ac   = 0;
+	entry->access_RW   = 0;
+	entry->access_DC   = 0;
+	entry->access_Ex   = 0;
+	entry->access_one  = 0;
+	entry->access_Privl= 0;
+	entry->access_Pr   = 0;
+}
+
+/**
+ * init a default global descriptor table. 
+ */
+void gdt_init_default()
+{
+	int gdt_size = (DEFAULT_GDT_ENTRIES*sizeof(struct gdt_entry_s))-1;
+	gdt_activate(default_gdt,gdt_size,0x08,0x10,0x10,0x10,0x10,0x10);
+}
diff --git a/src/idt.c b/src/idt.c
new file mode 100644
index 0000000000000000000000000000000000000000..96d0fbd2987065030342d4f3096e7550b8694372
--- /dev/null
+++ b/src/idt.c
@@ -0,0 +1,235 @@
+#include "idt.h"
+#include "ioport.h"
+#include <stdint.h>
+
+extern void puts(char *);
+#define MAX_IDT_ENTRIES 256
+
+/* Use this to define a hardware interrupt entry into the IDT */
+#define IRQ_IDT(X) { extern void irq ## X(); idt_setup_descriptor (32+X, (uint32_t) irq ## X, 0x08, 0x8E); }
+
+/* Use this to define a kernel-only software interrupt into the IDT */
+#define KERN_IDT(X) { extern void isr ## X(); idt_setup_descriptor(X, (uint32_t) isr ## X, 0x08, 0x8E); }
+
+/* Use this to define a software interrupt triggerable by anyone into the IDT */
+#define USER_IDT(X) { extern void isr ## X(); idt_setup_descriptor (X, (uint32_t) isr ## X, 0x08, 0xEE); }
+
+
+struct idt_entry_struct idt_entries[MAX_IDT_ENTRIES];
+
+/**
+ * struct idt_register is the 48 bits data structure of the intel Gobal Descriptor Table register.
+ */
+struct idt_register {
+    uint16_t limit :16; /* 16 bits for the size of the Interrupt Descriptor Table (-1) */
+    uint32_t base : 32; /* 32 bits for the address of the Interrupt Descriptor Table */
+} __attribute__((packed)); /* this gcc directive avoid fields padding, base will not be aligned */
+
+void _lidt(struct idt_register *idt_register) {
+    asm("lidt (%0)" :: "r"(idt_register) :);
+}
+
+void *irq_handlers[16] = 
+{
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0
+};
+
+void *int_handlers[256];
+
+void idt_setup_descriptor(uint8_t num, uint32_t base, uint16_t sel, uint8_t flags)
+{
+	idt_entries[num].base_lo = base & 0xFFFF;
+	idt_entries[num].base_hi = (base >> 16) & 0xFFFF;
+	idt_entries[num].sel = sel;
+	idt_entries[num].always0 = 0;
+	idt_entries[num].flags = flags;
+}
+
+void idt_setup_irq_handler(int irq, void (*handler)(int_regs_t *r))
+{
+	irq_handlers[irq] = handler;
+}
+void idt_setup_int_handler(int intno, void (*handler)(int_regs_t *r))
+{
+	int_handlers[intno] = handler;
+}
+
+void null_handler(int_regs_t *r)
+{
+	return;
+}
+
+void remap_irq()
+{
+	_outb(0x20, 0x11);
+	_outb(0xA0, 0x11);
+	_outb(0x21, 0x20);
+	_outb(0xA1, 0x28);
+	_outb(0x21, 0x04);
+	_outb(0xA1, 0x02);
+	_outb(0x21, 0x01);
+	_outb(0xA1, 0x01);
+	_outb(0x21, 0x0);
+	_outb(0xA1, 0x0);
+}
+
+void setup_irq()
+{
+	IRQ_IDT(0);
+	IRQ_IDT(1);
+	IRQ_IDT(2);
+	IRQ_IDT(3);
+	IRQ_IDT(4);
+	IRQ_IDT(5);
+	IRQ_IDT(6);
+	IRQ_IDT(7);
+	IRQ_IDT(8);
+	IRQ_IDT(9);
+	IRQ_IDT(10);
+	IRQ_IDT(11);
+	IRQ_IDT(12);
+	IRQ_IDT(13);
+	IRQ_IDT(14);
+	IRQ_IDT(15);
+
+	uint8_t irq_num;
+	for(irq_num = 0; irq_num < 16; irq_num++)
+		idt_setup_irq_handler(irq_num, null_handler);
+
+	remap_irq();
+}
+
+void setup_softint()
+{
+	KERN_IDT(0);
+	KERN_IDT(1);
+	KERN_IDT(2);
+	KERN_IDT(3);
+	KERN_IDT(4);
+	KERN_IDT(5);
+	KERN_IDT(6);
+	KERN_IDT(7);
+	KERN_IDT(8);
+	KERN_IDT(9);
+	KERN_IDT(10);
+	KERN_IDT(11);
+	KERN_IDT(12);
+	KERN_IDT(13);
+	KERN_IDT(14);
+	KERN_IDT(15);
+	KERN_IDT(16);
+	KERN_IDT(17);
+	KERN_IDT(18);
+	KERN_IDT(19);
+	KERN_IDT(20);
+	KERN_IDT(21);
+	KERN_IDT(22);
+	KERN_IDT(23);
+	KERN_IDT(24);
+	KERN_IDT(25);
+	KERN_IDT(26);
+	KERN_IDT(27);
+	KERN_IDT(28);
+	KERN_IDT(29);
+	KERN_IDT(30);
+	KERN_IDT(31);
+
+    /* In idt0.s we defined a catchable interrupt 87, and want it to be triggerable from userland */
+    USER_IDT(87);
+}
+
+void setup_idt()
+{
+    struct idt_register idt_reg;
+	idt_reg.limit = sizeof(struct idt_entry_struct) * MAX_IDT_ENTRIES - 1;
+	idt_reg.base = (uint32_t)&idt_entries;
+
+	setup_irq();
+	setup_softint();
+	_lidt(&idt_reg);
+}
+
+int_regs_t* last_regs = 0;
+
+void end_of_interrupt()
+{
+    if (last_regs->int_no >= 40) {
+        _outb(0xA0, 0x20);
+    }
+	_outb(0x20, 0x20);
+}
+
+void irq_handler(int_regs_t* r)
+{
+	void (*handler)(int_regs_t* r);
+
+    last_regs = r;
+
+    handler = irq_handlers[r->int_no - 32];
+	if(handler)
+		handler(r);
+
+    end_of_interrupt();
+}
+
+char *int_mesg[] = {
+	"Division By Zero",
+	"Debug",
+	"Non Maskable Interrupt",
+	"Breakpoint",
+	"Into Detected Overflow",
+	"Out of Bounds",
+	"Invalid Opcode",
+	"No Coprocessor",
+
+	"Double Fault",
+	"Coprocessor Segment Overrun",
+	"Bad TSS",
+	"Segment Not Present",
+	"Stack Fault",
+	"General Protection Fault",
+	"Page Fault",
+	"Unknown Interrupt",
+
+	"Coprocessor Fault",
+	"Alignment Check",
+	"Machine Check",
+	"Reserved",
+	"Reserved",
+	"Reserved",
+	"Reserved",
+	"Reserved",
+
+	"Reserved",
+	"Reserved",
+	"Reserved",
+	"Reserved",
+	"Reserved",
+	"Reserved",
+	"Reserved",
+	"Reserved"
+};
+
+void isr_handler(int_regs_t* r)
+{
+	extern void puts(char* str);
+	extern void puthex(int d);
+	
+	void (*handler)(int_regs_t* r);
+
+	handler = int_handlers[r->int_no];
+	if(handler) {
+		handler(r);
+		return;
+	}
+
+	if(r->int_no < 32)
+	{
+		puts("Caught fault, halting. ");
+		puts(int_mesg[r->int_no]);
+		for(;;);
+	}
+   
+}
+
diff --git a/src/idt0.s b/src/idt0.s
new file mode 100644
index 0000000000000000000000000000000000000000..704638c5a601410dcada9b512a9d6e4fe1209e9d
--- /dev/null
+++ b/src/idt0.s
@@ -0,0 +1,125 @@
+%macro ISR_NOERRCODE 1
+global isr%1
+isr%1:
+    cli
+    push byte 0
+    push byte %1
+    jmp process_isr
+%endmacro
+
+%macro ISR_ERRCODE 1
+global isr%1
+isr%1:
+    cli
+    push byte %1
+    jmp process_isr
+%endmacro
+
+%macro IRQ 2
+global irq%1
+irq%1:
+    cli
+    push byte 0
+    push byte %2
+    jmp process_irq
+%endmacro
+
+%macro DEFINE_HANDLER 1
+extern %1_handler
+
+process_%1:
+    pusha
+    push esp
+    mov si, ds
+    mov ax, 0x10
+    mov ds, ax
+    mov es, ax
+    mov fs, ax
+    mov gs, ax
+   
+    mov eax, esp
+    push eax
+    call %1_handler
+    pop eax
+    add esp, 4
+    mov ds, si
+    mov es, si
+    mov fs, si
+    mov gs, si
+    popa
+    add esp, 8
+    iret
+%endmacro
+
+DEFINE_HANDLER isr
+DEFINE_HANDLER irq
+
+global zero_idt
+zero_idt:
+    mov edi, [esp + 4] ; Set begin to IDT pointer
+    mov eax, 0x00000000 ; Zero this
+    mov ecx, 0x200 ; 256 entries, 2 words per entry : 512
+    rep stosd ; So we would write 512 null words - this should zero our IDT
+    ret
+
+global reload_idt
+reload_idt:
+    mov eax, [esp + 4]
+    lidt [eax]
+    ret
+
+ISR_NOERRCODE 0
+ISR_NOERRCODE 1
+ISR_NOERRCODE 2
+ISR_NOERRCODE 3
+ISR_NOERRCODE 4
+ISR_NOERRCODE 5
+ISR_NOERRCODE 6
+ISR_NOERRCODE 7
+ISR_ERRCODE   8
+ISR_NOERRCODE 9
+ISR_ERRCODE   10
+ISR_ERRCODE   11
+ISR_ERRCODE   12
+ISR_ERRCODE   13
+ISR_ERRCODE   14
+ISR_NOERRCODE 15
+ISR_NOERRCODE 16
+ISR_NOERRCODE 17
+ISR_NOERRCODE 18
+ISR_NOERRCODE 19
+ISR_NOERRCODE 20
+ISR_NOERRCODE 21
+ISR_NOERRCODE 22
+ISR_NOERRCODE 23
+ISR_NOERRCODE 24
+ISR_NOERRCODE 25
+ISR_NOERRCODE 26
+ISR_NOERRCODE 27
+ISR_NOERRCODE 28
+ISR_NOERRCODE 29
+ISR_NOERRCODE 30
+ISR_NOERRCODE 31
+IRQ 0 , 32
+IRQ 1 , 33
+IRQ 2 , 34
+IRQ 3 , 35
+IRQ 4 , 36
+IRQ 5 , 37
+IRQ 6 , 38
+IRQ 7 , 39
+IRQ 8 , 40
+IRQ 9 , 41
+IRQ 10 , 42
+IRQ 11 , 43
+IRQ 12 , 44
+IRQ 13 , 45
+IRQ 14 , 46
+IRQ 15 , 47
+
+; We only handle the processor's and PIC's interrupts right now.
+; If you want to handle other software interrupts, feel free to add something like
+; ISR_NOERRCODE XX 
+; XX being the interrupt number.
+; Here is an example for the 87 interrupt :
+ISR_NOERRCODE 87
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000000000000000000000000000000000000..972ac657bdbf982f4c032de086e21e322dea4033
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,98 @@
+#include "gdt.h"
+#include "idt.h"
+#include "minilib.h"
+#include "mmu.h"
+#include "ioport.h"
+#include "syscalls.h"
+
+extern void user(void);
+extern void app_main(void);
+
+void empty_irq(int_regs_t *r) {
+}
+
+void syscall_handler(int_regs_t *r) {
+    switch(r->eax) {
+	    case SYSCALL_PUTC:
+		    putc(r->edi);
+		    break;
+	    default:
+		    puts("unhandled syscall\n");
+		    break;
+    };
+}
+
+static struct pte_s my_page_table[PT_SIZE] __attribute__((aligned (PAGE_SIZE)));
+
+void fault_handler(int_regs_t *r) {
+	puts("page fault! fault address=");
+	puthex(get_fault_address());
+	puts("\n");
+
+	/* Example: allow access to 0x800000 */	
+	int fault_page = get_fault_address() >> 12;
+	if (fault_page == 0x800) {
+		puts("Add page mapping...\n");
+		memset(my_page_table, 0, sizeof(my_page_table));
+		
+		my_page_table[0].g = 0; /* page locale */
+                my_page_table[0].pat = 0;
+                my_page_table[0].d = 0;
+                my_page_table[0].a = 0;
+                my_page_table[0].pcd = 0; /* cache activé */
+                my_page_table[0].pwt = 0; /* cache write back */
+                my_page_table[0].us = 1; /* page user */
+                my_page_table[0].rw = 1; /* page read write */
+                my_page_table[0].p = 1; /* entrée présente */
+                my_page_table[0].address = 0x800; /* map to physical page 0x800 */
+                my_page_table[0].unused1 = 0;
+		setup_page_table(2 /* our page table will map vpages starting at 2*0x400 == 0x800 to 0xBFF */ , my_page_table);
+		/* so my_page_table[0] represents vpage 0x800, which will be mapped to ppage 0x800 */
+
+		flush_tlb();
+
+		return;
+	}
+	for(;;);
+}
+
+/* multiboot entry-point with datastructure as arg. */
+void main(unsigned int * mboot_info)
+{
+    /* clear the screen */
+    clear_screen();
+    puts("Early boot.\n"); 
+
+    /* Initialize the memory */
+    puts("\t-> Setting up the GDT... ");
+    gdt_init_default();
+    puts("OK\n");
+
+    /* Initializa the Interrupt Descriptor Table */
+    puts("\t-> Setting up the IDT... ");
+    setup_idt();
+    puts("OK\n");
+
+    puts("\t-> Setting up the MMU... ");
+    setup_mmu();
+    puts("OK\n");
+
+    /* Installs two empty handlers for the timer (0) and the keyboard (1) */
+    idt_setup_irq_handler(0, empty_irq);
+    idt_setup_irq_handler(1, empty_irq);
+    
+    idt_setup_int_handler(87, syscall_handler);
+    idt_setup_int_handler(14, fault_handler);
+
+    /* Enables interrupts */ 
+    __asm volatile("sti");
+
+    /* minimal setup done ! */
+    app_main();
+
+    puts("\t-> Switching to user-mode... ");
+    user(); /* switch to user-mode and calls user_entry() in user.c */
+}
+
+
+
diff --git a/src/minilib.c b/src/minilib.c
new file mode 100644
index 0000000000000000000000000000000000000000..eb379c9eda89631726dceb87cd67075e606b21ae
--- /dev/null
+++ b/src/minilib.c
@@ -0,0 +1,109 @@
+#include "minilib.h"
+#include "ioport.h"
+
+void __assert__(int x, char *f, unsigned line)
+{
+    if (!x) {
+        puts("Assert violated: ");
+        puts("File ");
+        puts(f);
+        puts(" at line ");
+        putud(line);
+        for(;;);
+    }
+}
+
+/* base address for the video output assume to be set as character oriented by the multiboot */
+static unsigned char *video_memory = (unsigned char *) 0xB8000;
+
+/* clear screen */
+void clear_screen() {
+  int i;
+  for(i=0;i<80*25;i++) { 			/* for each one of the 80 char by 25 lines */
+    video_memory[i*2+1]=0x0F;			/* color is set to black background and white char */
+    video_memory[i*2]=(unsigned char)' '; 	/* character shown is the space char */
+  }
+}
+
+/* print a string on the screen */
+void puts(char *aString) {
+  char *current_char=aString;
+  while(*current_char!=0) {
+    putc(*current_char++);
+  }
+}
+
+/* print an number in hexa */
+char *hex_digit="0123456789ABCDEF";
+void puthex(unsigned aNumber) {
+  int i;
+  int started=0;
+  for(i=28;i>=0;i-=4) {
+    int k=(aNumber>>i)&0xF;
+    if(k!=0 || started) {
+      putc(hex_digit[k]);
+      started=1;
+    }
+  }
+  if(!started) putc('0');
+}
+
+void putud(unsigned aNumber)
+{
+    char s[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+    int i = 0;
+    while (aNumber > 0) {
+        s[i] = '0' + (aNumber % 10);
+        i++;
+        aNumber /= 10;
+    }
+    while (i > 0) 
+        putc(s[--i]);
+    
+}
+
+/* print a char on the screen */
+static int cursor_x=0;					/* here is the cursor position on X [0..79] */
+static int cursor_y=0;					/* here is the cursor position on Y [0..24] */
+
+void setCursor()
+{
+  int cursor_offset = cursor_x+cursor_y*80;
+  _outb(0x3d4,14);
+  _outb(0x3d5,((cursor_offset>>8)&0xFF));
+  _outb(0x3d4,15);
+  _outb(0x3d5,(cursor_offset&0xFF));
+}
+
+void putc(char c)
+{
+  if(cursor_x>79) {
+    cursor_x=0;
+    cursor_y++;
+  }
+  if(cursor_y>24) {
+    cursor_y=0;
+    clear_screen();
+  }
+  switch(c) {					/* deal with a special char */
+    case '\r': cursor_x=0; break;		/* carriage return */
+    case '\n': cursor_x=0; cursor_y++; break; 	/* new ligne */	
+    case 0x8 : if(cursor_x>0) cursor_x--; break;/* backspace */
+    case 0x9 : cursor_x=(cursor_x+8)&~7; break;	/* tabulation */
+						/* or print a simple character */
+    default  : 
+      video_memory[(cursor_x+80*cursor_y)*2]=c;
+      cursor_x++;
+      break;
+  }
+  setCursor();
+}
+
+void memset(void *buf, int c, int s) {
+	char *b = buf;
+	int i;
+	for (i = 0; i < s; i++) {
+		b[i] = c;
+	}
+}
+
diff --git a/src/mmu.c b/src/mmu.c
new file mode 100644
index 0000000000000000000000000000000000000000..96994804e42ef42fba04a6bb064af3ac2cff7949
--- /dev/null
+++ b/src/mmu.c
@@ -0,0 +1,73 @@
+#include "minilib.h"
+#include "tss.h"
+#include "mmu.h"
+
+static struct pde_s page_dir[PT_SIZE] __attribute__((aligned (PAGE_SIZE)));
+static struct pte_s page_table_kernel[PT_SIZE] __attribute__((aligned (PAGE_SIZE)));
+static struct pte_s page_table_user[PT_SIZE] __attribute__((aligned (PAGE_SIZE)));
+
+void setup_page_table(int index, struct pte_s *ptable) {
+	page_dir[index].ps = 0;
+	page_dir[index].a = 0;
+	page_dir[index].pcd = 0;
+	page_dir[index].pwt = 0;
+	page_dir[index].us = 1;
+	page_dir[index].rw = 1;
+	page_dir[index].p = 1;
+	page_dir[index].address = ((int)ptable) >> 12;
+}
+
+void setup_mmu() {
+	unsigned int i;
+
+	for (i = 0; i < PT_SIZE; i++) {
+		page_table_kernel[i].g = 0;
+		page_table_kernel[i].pat = 0;
+		page_table_kernel[i].d = 0;
+		page_table_kernel[i].a = 0;
+		page_table_kernel[i].pcd = 0;
+		page_table_kernel[i].pwt = 0;
+		page_table_kernel[i].us = 0;
+		page_table_kernel[i].rw = 1;
+		page_table_kernel[i].p = 1;
+		page_table_kernel[i].address = i;
+		page_table_kernel[i].unused1 = 0;
+	}
+
+	for (i = 0; i < PT_SIZE; i++) {
+		page_table_user[i].g = 0;
+		page_table_user[i].pat = 0;
+		page_table_user[i].d = 0;
+		page_table_user[i].a = 0;
+		page_table_user[i].pcd = 0;
+		page_table_user[i].pwt = 0;
+		page_table_user[i].us = 1;
+		page_table_user[i].rw = 1;
+		page_table_user[i].p = 1;
+		page_table_user[i].address = i + PT_SIZE;
+		page_table_user[i].unused1 = 0;
+	}
+
+
+	setup_page_table(PAGE_TABLE_KERNEL, page_table_kernel);
+	setup_page_table(PAGE_TABLE_USER, page_table_user);
+
+	i = (int) page_dir;
+	asm("movl %0, %%cr3"  : : "r"(i) :);
+
+	asm("movl %%cr0, %0" : "=r"(i) : :);
+	i |= CR0_PG | CR0_WP;
+	asm("movl %0, %%cr0"  : : "r"(i) :);
+}
+
+unsigned int get_fault_address() {
+	unsigned int v;
+	asm("movl %%cr2, %0" : "=r"(v) : :);
+	return v;
+}
+
+void flush_tlb() {
+	unsigned int v;
+	asm("movl %%cr3, %0" : "=r"(v) : :);
+	asm("movl %0, %%cr3"  : : "r"(v) :);
+}
diff --git a/src/tss.c b/src/tss.c
new file mode 100644
index 0000000000000000000000000000000000000000..a34da1a855062c1d7ff088476f1e6289a277ab24
--- /dev/null
+++ b/src/tss.c
@@ -0,0 +1,20 @@
+#include "minilib.h"
+#include "gdt.h"
+#include "tss.h"
+#include "mmu.h"
+
+#define STACK_SIZE	65536
+
+static struct tss_s tss __attribute__((aligned (PAGE_SIZE)));;
+
+static char kernel_stack[STACK_SIZE] __attribute__((aligned (PAGE_SIZE)));;
+
+void setup_tss(struct gdt_entry_s *e) {
+	unsigned int tss_addr = (int) &tss;
+	memset(&tss, 0, sizeof(tss));
+	tss.ss0 = 0x10; /* kernel data segment */ 
+	tss.esp0 = ((int) kernel_stack) + sizeof(kernel_stack) - 4;
+	e->base_high = (tss_addr >> 24) & 0xFF;
+	e->base_middle = (tss_addr >> 16) & 0xFF;
+	e->base_low = tss_addr & 0xFFFF;
+}
diff --git a/src/user.c b/src/user.c
new file mode 100644
index 0000000000000000000000000000000000000000..eacc960efbc2c65a9a4efd4f909551bf8cf6eaf6
--- /dev/null
+++ b/src/user.c
@@ -0,0 +1,21 @@
+
+char user_stack[65536];
+
+static void putc(int c) {
+	asm("movl $1, %%eax" "\n\t" "movl %0, %%edi" "\n\t" "int $87" : : "r"(c) : "eax", "edi");
+}
+
+static void puts(char *s) {
+	int i;
+	for (i = 0; s[i] != 0; i++) {
+		putc(s[i]);
+	}
+}
+void user_entry() {
+	puts("Hello from userland\n"); 
+
+	char *ptr = (char*) 0x800000;
+	*ptr = 42;
+	puts("Write succeeded!\n");
+	for(;;);
+}