C++ Bare Bones: Difference between revisions
[unchecked revision] | [unchecked revision] |
Content deleted Content added
Use external linkage rather than stack, as in the C version of this tutorial. |
|||
Line 108:
<source lang="asm">
global loader ; making entry point visible to linker
global magic ; we will use this in kmain
global mbd ; we will use this in kmain
extern kmain ; kmain is defined in kmain.cpp
Line 135 ⟶ 137:
loader:
mov esp, stack + STACKSIZE ; set up the stack
mov ebx, start_ctors ; call the constructors
Line 166 ⟶ 168:
align 4
magic: resd 1
mbd: resd 1
</source>
Line 191 ⟶ 194:
# reserve initial kernel stack space
.set STACKSIZE, 0x4000 # that is, 16k.
.
.comm mbd, 4 # we will use this in kmain
.comm magic, 4 # we will use this in kmain
loader:
mov $(stack + STACKSIZE), %esp # set up the stack
mov $start_ctors, %ebx # call the constructors
Line 234 ⟶ 239:
<source lang="c">
#include <cstdint>
extern "C" void kmain( void* mbd, unsigned int magic )▼
{
extern "C" uint32_t magic;
extern "C" void *mbd;
if ( magic != 0x2BADB002 )
{
|