; ; Copyright 2010 Stefan Lankes, Chair for Operating Systems, ; RWTH Aachen University ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. ; You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; See the License for the specific language governing permissions and ; limitations under the License. ; ; This file is part of metalsvm. ; This is the kernel's entry point. We could either call main here, ; or we can use this to setup the stack or other nice stuff, like ; perhaps setting up the GDT and segments. Please note that interrupts ; are disabled at this point: More on interrupts later! [BITS 32] SECTION .code global strcpy strcpy: push ebp mov ebp, esp push edi push esi mov esi, [ebp+12] mov edi, [ebp+8] L1: lodsb stosb test al, al jne L1 mov eax, [ebp+8] pop esi pop edi pop ebp ret global strncpy strncpy: push ebp mov ebp, esp push edi push esi mov ecx, [ebp+16] mov esi, [ebp+12] mov edi, [ebp+8] L2: dec ecx js L3 lodsb stosb test al, al jne L1 rep stosb L3: mov eax, [ebp+8] pop esi pop edi pop ebp ret