kasm.h

00001 /***************************************************************************
00002                           kasm.h  -  description
00003                              -------------------
00004     begin                : Sat Dec 13 2003
00005     copyright            : (C) 2003 by Dynacube Team
00006     email                : mdshah82@yahoo.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 /*
00019 File Contains asm generic level functions
00020 */
00021 
00022 #ifndef __ASM_H
00023 #define __ASM_H
00024 
00025         #include "common/ktypes.h"
00026                 
00027         #define lds(desc_sel) __asm__ __volatile__("movl %0, %%ds"::"r"(desc_sel));
00028         #define lss(desc_sel) __asm__ __volatile__("movl %0, %%ss"::"r"(desc_sel));
00029         #define les(desc_sel) __asm__ __volatile__("movl %0, %%es"::"r"(desc_sel));
00030         #define lfs(desc_sel) __asm__ __volatile__("movl %0, %%fs"::"r"(desc_sel));
00031         #define lgs(desc_sel) __asm__ __volatile__("movl %0, %%gs"::"r"(desc_sel));
00032 
00033         #define cli()   __asm__ __volatile__("cli");
00034         #define sti() __asm__ __volatile__("sti");
00035 
00036         #define setCR0(val) __asm__ __volatile__ ("movl %%eax, %%cr0"::"a"(val));
00037         #define getCR0(var) __asm__ __volatile__ ("movl %%cr0,%%eax":"=a"(var));
00038 
00039         #define setCR3(val) __asm__ __volatile__ ("movl %%eax, %%cr3"::"a"(val));        
00040         #define getCR3(var) __asm__ __volatile__ ("movl %%cr3,%%eax":"=a"(var));
00041         
00042         #define intr_wait(intr) __asm__ __volatile__("pushl %%eax"::"a"(intr)); \
00043                                 __asm__ __volatile__("int $0x30"::"a"(6));        
00044 
00045        #define sleep(time_out) __asm__ __volatile__("pushl %%eax"::"a"(time_out)); \
00046                                __asm__ __volatile__("int $0x30"::"a"(5));
00047                                
00048        #define wait_intr_timer(intr,time_out) __asm__ __volatile__("pushl %%eax"::"a"(time_out)); \
00049                                               __asm__ __volatile__("pushl %%eax"::"a"(intr)); \
00050                                               __asm__ __volatile__("int $0x30"::"a"(7));
00051                 
00052   void lidt(IDT *);
00053   void lgdt(GDT *gdt);
00054   void sgdt(GDT *gdt);
00055   void kdump();
00056   
00057 #endif
00058 
00059 

Generated on Thu Jul 27 23:52:26 2006 for Dynacube by  doxygen 1.4.7