00001 00006 /* 00007 * The contents of this file are subject to the Mozilla Public License 00008 * Version 1.0 (the "License"); you may not use this file except in 00009 * compliance with the License. You may obtain a copy of the License at 00010 * http://www.mozilla.org/MPL/ 00011 * 00012 * Software distributed under the License is distributed on an "AS IS" 00013 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 00014 * License for the specific language governing rights and limitations 00015 * under the License. 00016 * 00017 * The Original Code is legOS code, released October 17, 1999. 00018 * 00019 * The Initial Developer of the Original Code is Markus L. Noga. 00020 * Portions created by Markus L. Noga are Copyright (C) 1999 00021 * Markus L. Noga. All Rights Reserved. 00022 * 00023 * Contributor(s): Markus L. Noga <markus@noga.de> 00024 */ 00025 00026 typedef unsigned size_t; // data type for memory sizes 00027 00028 00030 // 00031 // Functions 00032 // 00034 00036 00040 void *memset(void* s,int c,size_t n) { 00041 void *res; 00042 __asm__ __volatile__( 00043 " add.w %1,%0\n" 00044 "0:cmp.w %1,%0\n" 00045 " beq 1f\n" 00046 " mov.b %2l,@-%0\n" 00047 " bra 0b\n" 00048 "1:" 00049 : "=&r" (res) // output 00050 : "r" (s), "r" (c), "0" (n) // input 00051 : "cc","memory" // clobbered (final) 00052 ); 00053 return res; 00054 }