Skip to content
Burak Köken edited this page Apr 14, 2015 · 1 revision

arch.h header dosyası kernel'in ait olduğu mimariyle ilgili bazı tanımlamalar içerir. Bunlardan birisi olan kern__arch tanımlamasıyla kernelin hangi mimariye sahip olduğuna göre işlemler yapılabilir.

Header dosyasının dahil edilmesi :

#include <arch.h>

arch.h :

/*
 *  Copyright(C) 2014 Codnect Team
 *  Copyright(C) 2014 Burak Köken
 *
 *  This file is part of Uniq.
 *  
 *  Uniq is free software: you can redistribute it and/or modify it under the
 *  terms of the GNU General Public License as published by the Free Software
 *  Foundation, version 2 of the License.
 *
 *  Uniq is distributed in the hope that it will be useful, but WITHOUT ANY
 *  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 *  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 *  details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with Uniq.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __UNIQ_ARCH_H__
#define __UNIQ_ARCH_H__

#define __arch_i386__		386
#define __arch_i486__		486
#define __arch_i586__		586
#define __arch_i686__		686

#define __kern_arch__		__arch_i386__

#endif /* __UNIQ_ARCH_H__ */

###Kullanımı Örneğin mem.c kaynak kod dosyasında bu tanımlamaların kullanıldığını görebiliriz. Bazı işlemci komutlarının daha eski mimarilerde çalışmayacağından dolayı aşağıdaki kodu incelerseniz aşağıdaki şekilde önlemler alınabilir.

...
#include <arch.h>

...
#if (__kern_arch__ > __arch_i386__)

...

#endif