diff options
Diffstat (limited to 'mini-os/head.S')
-rw-r--r-- | mini-os/head.S | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/mini-os/head.S b/mini-os/head.S new file mode 100644 index 0000000000..3f4e6670c3 --- /dev/null +++ b/mini-os/head.S @@ -0,0 +1,46 @@ +#include <os.h> + +/* Offsets in start_info structure */ +#define SHARED_INFO 4 +#define MOD_START 12 +#define MOD_LEN 16 + +#define ENTRY(X) .globl X ; X : + +.globl _start +_start: + cld + + lss stack_start,%esp + + /* Copy any module somewhere safe before it's clobbered by BSS. */ + mov MOD_LEN(%esi),%ecx + shr $2,%ecx + jz 2f /* bail from copy loop if no module */ + + mov $_end,%edi + add MOD_LEN(%esi),%edi + mov MOD_START(%esi),%eax + add MOD_LEN(%esi),%eax +1: sub $4,%eax + sub $4,%edi + mov (%eax),%ebx + mov %ebx,(%edi) + loop 1b + mov %edi,MOD_START(%esi) + + /* Clear BSS first so that there are no surprises... */ +2: xorl %eax,%eax + movl $__bss_start,%edi + movl $_end,%ecx + subl %edi,%ecx + rep stosb + + push %esi + call start_kernel + + +stack_start: + .long stack+8192, __KERNEL_DS + + |