Explorar el Código

Add off_t and physaddr_t, and the copy_{to,from}_phys helper routines.

tags/v0.9.3
Michael Brown hace 20 años
padre
commit
e3f2aa7b4d
Se han modificado 2 ficheros con 11 adiciones y 0 borrados
  1. 3
    0
      src/arch/i386/include/stdint.h
  2. 8
    0
      src/arch/i386/include/virtaddr.h

+ 3
- 0
src/arch/i386/include/stdint.h Ver fichero

@@ -2,6 +2,7 @@
2 2
 #define STDINT_H
3 3
 
4 4
 typedef unsigned           size_t;
5
+typedef unsigned	   off_t;
5 6
 
6 7
 typedef unsigned char      uint8_t;
7 8
 typedef unsigned short     uint16_t;
@@ -13,4 +14,6 @@ typedef signed short       int16_t;
13 14
 typedef signed long        int32_t;
14 15
 typedef signed long long   int64_t;
15 16
 
17
+typedef unsigned long	   physaddr_t;
18
+
16 19
 #endif /* STDINT_H */

+ 8
- 0
src/arch/i386/include/virtaddr.h Ver fichero

@@ -45,6 +45,14 @@ static inline void * phys_to_virt ( unsigned long phys_addr ) {
45 45
 	return ( void * ) ( phys_addr - virt_offset );
46 46
 }
47 47
 
48
+static inline void copy_to_phys ( physaddr_t dest, void *src, size_t len ) {
49
+	memcpy ( phys_to_virt ( dest ), src, len );
50
+}
51
+
52
+static inline void copy_from_phys ( void *dest, physaddr_t src, size_t len ) {
53
+	memcpy ( dest, phys_to_virt ( src ), len );
54
+}
55
+
48 56
 #else /* KEEP_IT_REAL */
49 57
 
50 58
 /*

Loading…
Cancelar
Guardar