- add missing file
git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@68 315a16e6-25f9-4109-90ae-ca3045a26c18
This commit is contained in:
parent
03a093329f
commit
0b681a49c0
1 changed files with 74 additions and 0 deletions
74
arch/x86/kernel/string.asm
Normal file
74
arch/x86/kernel/string.asm
Normal file
|
@ -0,0 +1,74 @@
|
|||
;
|
||||
; 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
|
Loading…
Add table
Reference in a new issue