📄 system.h
字号:
/* * OSV * Copyright (C) 2002 Ciprian DOSOFTEI <rocksoul@mail.com> * All rights reserved. * * http://backster.free.fr/osv * * This file is part of the OSV project. OSV is free software, also known as * "open source"; you can redistribute it and/or modify it under the terms * of the GNU General Public License (GPL), version 2, as published by the Free * Software Foundation (FSF). To explore alternate licensing terms, contact * the author at rocksoul@mail.com or +40740649907. * * OSV 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 GPL for more details. You should have * received a copy of the GPL along with OSV; see the file COPYING. If * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. */#ifndef ASMSYSTEM#define ASMSYSTEM#include <asm/types.h>#define __save_flags(x) __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */)#define __restore_flags(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory")#define __cli() __asm__ __volatile__("cli": : :"memory")#define __sti() __asm__ __volatile__("sti": : :"memory")#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory")#define local_irq_save(x) __asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (x): /* no input */ :"memory")#define local_irq_restore(x) __restore_flags(x)#define local_irq_disable() __cli()#define local_irq_enable() __sti()#define nop() __asm__ __volatile__ ("nop")#define cli() __cli()#define sti() __sti()#define save_flags(x) __save_flags(x)#define restore_flags(x) __restore_flags(x)#define get_flags(x) __save_flags(x)#define set_flags(x) __restore_flags(x)extern inline dword get_CR0 (void){ register dword x; __asm__ __volatile__ ("movl %%cr0,%0" : "=r" (x)); return (x);}extern inline dword get_CR2 (void){ register dword x; __asm__ __volatile__ ("movl %%cr2,%0" : "=r" (x)); return (x);}extern inline dword get_CR3 (void){ register dword x; __asm__ __volatile__ ("movl %%cr3,%0" : "=r" (x)); return (x);}#define set_CR0(c) __asm__ __volatile__ ("movl %%eax, %%cr0"::"a" (c))#define set_CR3(c) __asm__ __volatile__ ("movl %%eax, %%cr3"::"a" (c))extern inline void flush_tlb(void) { set_CR3(get_CR3()); }extern inline void rep_nop(void) { __asm__ __volatile__("rep;nop"); }#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -