- Timestamp:
- 2006-07-04T17:17:56Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0ffa3ef5
- Parents:
- 991779c5
- Location:
- genarch
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
genarch/include/acpi/acpi.h
r991779c5 r7f1c620 40 40 /* Root System Description Pointer */ 41 41 struct acpi_rsdp { 42 __u8signature[8];43 __u8checksum;44 __u8oemid[6];45 __u8revision;46 __u32rsdt_address;47 __u32length;48 __u64xsdt_address;49 __u32ext_checksum;50 __u8reserved[3];42 uint8_t signature[8]; 43 uint8_t checksum; 44 uint8_t oemid[6]; 45 uint8_t revision; 46 uint32_t rsdt_address; 47 uint32_t length; 48 uint64_t xsdt_address; 49 uint32_t ext_checksum; 50 uint8_t reserved[3]; 51 51 } __attribute__ ((packed)); 52 52 53 53 /* System Description Table Header */ 54 54 struct acpi_sdt_header { 55 __u8signature[4];56 __u32length;57 __u8revision;58 __u8checksum;59 __u8oemid[6];60 __u8oem_table_id[8];61 __u32oem_revision;62 __u32creator_id;63 __u32creator_revision;55 uint8_t signature[4]; 56 uint32_t length; 57 uint8_t revision; 58 uint8_t checksum; 59 uint8_t oemid[6]; 60 uint8_t oem_table_id[8]; 61 uint32_t oem_revision; 62 uint32_t creator_id; 63 uint32_t creator_revision; 64 64 } __attribute__ ((packed));; 65 65 66 66 struct acpi_signature_map { 67 __u8*signature;67 uint8_t *signature; 68 68 struct acpi_sdt_header **sdt_ptr; 69 69 char *description; … … 73 73 struct acpi_rsdt { 74 74 struct acpi_sdt_header header; 75 __u32entry[];75 uint32_t entry[]; 76 76 } __attribute__ ((packed));; 77 77 … … 79 79 struct acpi_xsdt { 80 80 struct acpi_sdt_header header; 81 __u64entry[];81 uint64_t entry[]; 82 82 } __attribute__ ((packed));; 83 83 … … 87 87 88 88 extern void acpi_init(void); 89 extern int acpi_sdt_check( __u8*sdt);89 extern int acpi_sdt_check(uint8_t *sdt); 90 90 91 91 #endif /* __ACPI_H__ */ -
genarch/include/acpi/madt.h
r991779c5 r7f1c620 54 54 55 55 struct madt_apic_header { 56 __u8type;57 __u8length;56 uint8_t type; 57 uint8_t length; 58 58 } __attribute__ ((packed)); 59 59 … … 62 62 struct acpi_madt { 63 63 struct acpi_sdt_header header; 64 __u32l_apic_address;65 __u32flags;64 uint32_t l_apic_address; 65 uint32_t flags; 66 66 struct madt_apic_header apic_header[]; 67 67 } __attribute__ ((packed)); … … 69 69 struct madt_l_apic { 70 70 struct madt_apic_header header; 71 __u8acpi_id;72 __u8apic_id;73 __u32flags;71 uint8_t acpi_id; 72 uint8_t apic_id; 73 uint32_t flags; 74 74 } __attribute__ ((packed)); 75 75 76 76 struct madt_io_apic { 77 77 struct madt_apic_header header; 78 __u8io_apic_id;79 __u8reserved;80 __u32io_apic_address;81 __u32global_intr_base;78 uint8_t io_apic_id; 79 uint8_t reserved; 80 uint32_t io_apic_address; 81 uint32_t global_intr_base; 82 82 } __attribute__ ((packed)); 83 83 84 84 struct madt_intr_src_ovrd { 85 85 struct madt_apic_header header; 86 __u8bus;87 __u8source;88 __u32global_int;89 __u16flags;86 uint8_t bus; 87 uint8_t source; 88 uint32_t global_int; 89 uint16_t flags; 90 90 } __attribute__ ((packed)); 91 91 92 92 struct madt_nmi_src { 93 93 struct madt_apic_header header; 94 __u16flags;95 __u32global_intr;94 uint16_t flags; 95 uint32_t global_intr; 96 96 } __attribute__ ((packed)); 97 97 98 98 struct madt_l_apic_nmi { 99 99 struct madt_apic_header header; 100 __u8acpi_id;101 __u16flags;102 __u8l_apic_lint;100 uint8_t acpi_id; 101 uint16_t flags; 102 uint8_t l_apic_lint; 103 103 } __attribute__ ((packed)); 104 104 105 105 struct madt_l_apic_addr_ovrd { 106 106 struct madt_apic_header header; 107 __u16reserved;108 __u64l_apic_address;107 uint16_t reserved; 108 uint64_t l_apic_address; 109 109 } __attribute__ ((packed)); 110 110 111 111 struct madt_io_sapic { 112 112 struct madt_apic_header header; 113 __u8io_apic_id;114 __u8reserved;115 __u32global_intr_base;116 __u64io_apic_address;113 uint8_t io_apic_id; 114 uint8_t reserved; 115 uint32_t global_intr_base; 116 uint64_t io_apic_address; 117 117 } __attribute__ ((packed)); 118 118 119 119 struct madt_l_sapic { 120 120 struct madt_apic_header header; 121 __u8acpi_id;122 __u8sapic_id;123 __u8sapic_eid;124 __u8reserved[3];125 __u32flags;126 __u32acpi_processor_uid_value;127 __u8acpi_processor_uid_str[1];121 uint8_t acpi_id; 122 uint8_t sapic_id; 123 uint8_t sapic_eid; 124 uint8_t reserved[3]; 125 uint32_t flags; 126 uint32_t acpi_processor_uid_value; 127 uint8_t acpi_processor_uid_str[1]; 128 128 } __attribute__ ((packed)); 129 129 130 130 struct madt_platform_intr_src { 131 131 struct madt_apic_header header; 132 __u16flags;133 __u8intr_type;134 __u8processor_id;135 __u8processor_eid;136 __u8io_sapic_vector;137 __u32global_intr;138 __u32platform_intr_src_flags;132 uint16_t flags; 133 uint8_t intr_type; 134 uint8_t processor_id; 135 uint8_t processor_eid; 136 uint8_t io_sapic_vector; 137 uint32_t global_intr; 138 uint32_t platform_intr_src_flags; 139 139 } __attribute__ ((packed)); 140 140 -
genarch/include/fb/fb.h
r991779c5 r7f1c620 40 40 41 41 extern spinlock_t fb_lock; 42 void fb_init( __addressaddr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan);42 void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan); 43 43 44 44 #endif -
genarch/include/mm/page_ht.h
r991779c5 r7f1c620 67 67 link_t link; /**< Page hash table link. */ 68 68 as_t *as; /**< Address space. */ 69 __addresspage; /**< Virtual memory page. */70 __addressframe; /**< Physical memory frame. */69 uintptr_t page; /**< Virtual memory page. */ 70 uintptr_t frame; /**< Physical memory frame. */ 71 71 unsigned g : 1; /**< Global page. */ 72 72 unsigned x : 1; /**< Execute. */ -
genarch/include/mm/page_pt.h
r991779c5 r7f1c620 110 110 extern page_mapping_operations_t pt_mapping_operations; 111 111 112 extern void page_mapping_insert_pt(as_t *as, __address page, __addressframe, int flags);113 extern pte_t *page_mapping_find_pt(as_t *as, __addresspage);112 extern void page_mapping_insert_pt(as_t *as, uintptr_t page, uintptr_t frame, int flags); 113 extern pte_t *page_mapping_find_pt(as_t *as, uintptr_t page); 114 114 115 115 #endif -
genarch/include/ofw/ofw.h
r991779c5 r7f1c620 40 40 #define MAX_OFW_ARGS 10 41 41 42 typedef __nativeofw_arg_t;42 typedef unative_t ofw_arg_t; 43 43 typedef int ihandle; 44 44 typedef int phandle; … … 49 49 typedef struct { 50 50 const char *service; /**< Command name */ 51 __nativenargs; /**< Number of in arguments */52 __nativenret; /**< Number of out arguments */51 unative_t nargs; /**< Number of in arguments */ 52 unative_t nret; /**< Number of out arguments */ 53 53 ofw_arg_t args[MAX_OFW_ARGS]; /**< List of arguments */ 54 54 } ofw_args_t; … … 60 60 extern void ofw_init(void); 61 61 extern void ofw_done(void); 62 extern __nativeofw_call(const char *service, const int nargs, const int nret, ...);62 extern unative_t ofw_call(const char *service, const int nargs, const int nret, ...); 63 63 extern void ofw_putchar(const char ch); 64 64 extern char ofw_getchar(void); -
genarch/src/acpi/acpi.c
r991779c5 r7f1c620 52 52 53 53 struct acpi_signature_map signature_map[] = { 54 { ( __u8*)"APIC", (void *) &acpi_madt, "Multiple APIC Description Table" }54 { (uint8_t *)"APIC", (void *) &acpi_madt, "Multiple APIC Description Table" } 55 55 }; 56 56 57 static int rsdp_check( __u8*rsdp) {57 static int rsdp_check(uint8_t *rsdp) { 58 58 struct acpi_rsdp *r = (struct acpi_rsdp *) rsdp; 59 __u8sum = 0;59 uint8_t sum = 0; 60 60 int i; 61 61 … … 76 76 } 77 77 78 int acpi_sdt_check( __u8*sdt)78 int acpi_sdt_check(uint8_t *sdt) 79 79 { 80 80 struct acpi_sdt_header *h = (struct acpi_sdt_header *) sdt; 81 __u8sum = 0;81 uint8_t sum = 0; 82 82 int i; 83 83 … … 90 90 static void map_sdt(struct acpi_sdt_header *sdt) 91 91 { 92 page_mapping_insert(AS_KERNEL, ( __address) sdt, (__address) sdt, PAGE_NOT_CACHEABLE);93 map_structure(( __address) sdt, sdt->length);92 page_mapping_insert(AS_KERNEL, (uintptr_t) sdt, (uintptr_t) sdt, PAGE_NOT_CACHEABLE); 93 map_structure((uintptr_t) sdt, sdt->length); 94 94 } 95 95 96 96 static void configure_via_rsdt(void) 97 97 { 98 int i, j, cnt = (acpi_rsdt->header.length - sizeof(struct acpi_sdt_header))/sizeof( __u32);98 int i, j, cnt = (acpi_rsdt->header.length - sizeof(struct acpi_sdt_header))/sizeof(uint32_t); 99 99 100 100 for (i=0; i<cnt; i++) { 101 101 for (j=0; j<sizeof(signature_map)/sizeof(struct acpi_signature_map); j++) { 102 struct acpi_sdt_header *h = (struct acpi_sdt_header *) ( __native) acpi_rsdt->entry[i];102 struct acpi_sdt_header *h = (struct acpi_sdt_header *) (unative_t) acpi_rsdt->entry[i]; 103 103 104 104 map_sdt(h); 105 if (*(( __u32 *) &h->signature[0])==*((__u32*) &signature_map[j].signature[0])) {106 if (!acpi_sdt_check(( __u8*) h))105 if (*((uint32_t *) &h->signature[0])==*((uint32_t *) &signature_map[j].signature[0])) { 106 if (!acpi_sdt_check((uint8_t *) h)) 107 107 goto next; 108 108 *signature_map[j].sdt_ptr = h; … … 117 117 static void configure_via_xsdt(void) 118 118 { 119 int i, j, cnt = (acpi_xsdt->header.length - sizeof(struct acpi_sdt_header))/sizeof( __u64);119 int i, j, cnt = (acpi_xsdt->header.length - sizeof(struct acpi_sdt_header))/sizeof(uint64_t); 120 120 121 121 for (i=0; i<cnt; i++) { 122 122 for (j=0; j<sizeof(signature_map)/sizeof(struct acpi_signature_map); j++) { 123 struct acpi_sdt_header *h = (struct acpi_sdt_header *) (( __address) acpi_rsdt->entry[i]);123 struct acpi_sdt_header *h = (struct acpi_sdt_header *) ((uintptr_t) acpi_rsdt->entry[i]); 124 124 125 125 map_sdt(h); 126 if (*(( __u32 *) &h->signature[0])==*((__u32*) &signature_map[j].signature[0])) {127 if (!acpi_sdt_check(( __u8*) h))126 if (*((uint32_t *) &h->signature[0])==*((uint32_t *) &signature_map[j].signature[0])) { 127 if (!acpi_sdt_check((uint8_t *) h)) 128 128 goto next; 129 129 *signature_map[j].sdt_ptr = h; … … 139 139 void acpi_init(void) 140 140 { 141 __u8 *addr[2] = { NULL, (__u8*) PA2KA(0xe0000) };141 uint8_t *addr[2] = { NULL, (uint8_t *) PA2KA(0xe0000) }; 142 142 int i, j, length[2] = { 1024, 128*1024 }; 143 __u64 *sig = (__u64*) RSDP_SIGNATURE;143 uint64_t *sig = (uint64_t *) RSDP_SIGNATURE; 144 144 145 145 /* … … 149 149 */ 150 150 151 addr[0] = ( __u8*) PA2KA(ebda);151 addr[0] = (uint8_t *) PA2KA(ebda); 152 152 for (i = (ebda ? 0 : 1); i < 2; i++) { 153 153 for (j = 0; j < length[i]; j += 16) { 154 if (*(( __u64*) &addr[i][j]) == *sig && rsdp_check(&addr[i][j])) {154 if (*((uint64_t *) &addr[i][j]) == *sig && rsdp_check(&addr[i][j])) { 155 155 acpi_rsdp = (struct acpi_rsdp *) &addr[i][j]; 156 156 goto rsdp_found; … … 164 164 printf("%#zx: ACPI Root System Description Pointer\n", acpi_rsdp); 165 165 166 acpi_rsdt = (struct acpi_rsdt *) ( __native) acpi_rsdp->rsdt_address;167 if (acpi_rsdp->revision) acpi_xsdt = (struct acpi_xsdt *) (( __address) acpi_rsdp->xsdt_address);166 acpi_rsdt = (struct acpi_rsdt *) (unative_t) acpi_rsdp->rsdt_address; 167 if (acpi_rsdp->revision) acpi_xsdt = (struct acpi_xsdt *) ((uintptr_t) acpi_rsdp->xsdt_address); 168 168 169 169 if (acpi_rsdt) map_sdt((struct acpi_sdt_header *) acpi_rsdt); 170 170 if (acpi_xsdt) map_sdt((struct acpi_sdt_header *) acpi_xsdt); 171 171 172 if (acpi_rsdt && !acpi_sdt_check(( __u8*) acpi_rsdt)) {172 if (acpi_rsdt && !acpi_sdt_check((uint8_t *) acpi_rsdt)) { 173 173 printf("RSDT: %s\n", "bad checksum"); 174 174 return; 175 175 } 176 if (acpi_xsdt && !acpi_sdt_check(( __u8*) acpi_xsdt)) {176 if (acpi_xsdt && !acpi_sdt_check((uint8_t *) acpi_xsdt)) { 177 177 printf("XSDT: %s\n", "bad checksum"); 178 178 return; -
genarch/src/acpi/madt.c
r991779c5 r7f1c620 56 56 int isa_irq_map[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; 57 57 58 static void madt_l_apic_entry(struct madt_l_apic *la, __u32index);59 static void madt_io_apic_entry(struct madt_io_apic *ioa, __u32index);60 static void madt_intr_src_ovrd_entry(struct madt_intr_src_ovrd *override, __u32index);58 static void madt_l_apic_entry(struct madt_l_apic *la, uint32_t index); 59 static void madt_io_apic_entry(struct madt_io_apic *ioa, uint32_t index); 60 static void madt_intr_src_ovrd_entry(struct madt_intr_src_ovrd *override, uint32_t index); 61 61 static int madt_cmp(void * a, void * b); 62 62 … … 91 91 static bool madt_cpu_enabled(index_t i); 92 92 static bool madt_cpu_bootstrap(index_t i); 93 static __u8madt_cpu_apic_id(index_t i);93 static uint8_t madt_cpu_apic_id(index_t i); 94 94 static int madt_irq_to_pin(int irq); 95 95 … … 120 120 } 121 121 122 __u8madt_cpu_apic_id(index_t i)122 uint8_t madt_cpu_apic_id(index_t i) 123 123 { 124 124 ASSERT(i < madt_l_apic_entry_cnt); … … 142 142 void acpi_madt_parse(void) 143 143 { 144 struct madt_apic_header *end = (struct madt_apic_header *) ((( __u8*) acpi_madt) + acpi_madt->header.length);144 struct madt_apic_header *end = (struct madt_apic_header *) (((uint8_t *) acpi_madt) + acpi_madt->header.length); 145 145 struct madt_apic_header *h; 146 146 147 l_apic = ( __u32 *) (__native) acpi_madt->l_apic_address;147 l_apic = (uint32_t *) (unative_t) acpi_madt->l_apic_address; 148 148 149 149 /* calculate madt entries */ 150 for (h = &acpi_madt->apic_header[0]; h < end; h = (struct madt_apic_header *) ((( __u8*) h) + h->length)) {150 for (h = &acpi_madt->apic_header[0]; h < end; h = (struct madt_apic_header *) (((uint8_t *) h) + h->length)) { 151 151 madt_entries_index_cnt++; 152 152 } … … 157 157 panic("Memory allocation error."); 158 158 159 __u32index = 0;160 161 for (h = &acpi_madt->apic_header[0]; h < end; h = (struct madt_apic_header *) ((( __u8*) h) + h->length)) {159 uint32_t index = 0; 160 161 for (h = &acpi_madt->apic_header[0]; h < end; h = (struct madt_apic_header *) (((uint8_t *) h) + h->length)) { 162 162 madt_entries_index[index++] = h; 163 163 } 164 164 165 165 /* Quicksort MADT index structure */ 166 qsort(madt_entries_index, madt_entries_index_cnt, sizeof( __address), &madt_cmp);166 qsort(madt_entries_index, madt_entries_index_cnt, sizeof(uintptr_t), &madt_cmp); 167 167 168 168 /* Parse MADT entries */ … … 207 207 208 208 209 void madt_l_apic_entry(struct madt_l_apic *la, __u32index)209 void madt_l_apic_entry(struct madt_l_apic *la, uint32_t index) 210 210 { 211 211 if (!madt_l_apic_entry_cnt++) { … … 222 222 } 223 223 224 void madt_io_apic_entry(struct madt_io_apic *ioa, __u32index)224 void madt_io_apic_entry(struct madt_io_apic *ioa, uint32_t index) 225 225 { 226 226 if (!madt_io_apic_entry_cnt++) { 227 227 /* remember index of the first io apic entry */ 228 228 madt_io_apic_entry_index = index; 229 io_apic = ( __u32 *) (__native) ioa->io_apic_address;229 io_apic = (uint32_t *) (unative_t) ioa->io_apic_address; 230 230 } else { 231 231 /* currently not supported */ … … 234 234 } 235 235 236 void madt_intr_src_ovrd_entry(struct madt_intr_src_ovrd *override, __u32index)236 void madt_intr_src_ovrd_entry(struct madt_intr_src_ovrd *override, uint32_t index) 237 237 { 238 238 ASSERT(override->source < sizeof(isa_irq_map)/sizeof(int)); -
genarch/src/fb/fb.c
r991779c5 r7f1c620 50 50 SPINLOCK_INITIALIZE(fb_lock); 51 51 52 static __u8*fbaddress = NULL;53 54 static __u8*blankline = NULL;55 static __u8*dbbuffer = NULL; /* Buffer for fast scrolling console */52 static uint8_t *fbaddress = NULL; 53 54 static uint8_t *blankline = NULL; 55 static uint8_t *dbbuffer = NULL; /* Buffer for fast scrolling console */ 56 56 static int dboffset; 57 57 … … 99 99 static void rgb_3byte(void *dst, int rgb) 100 100 { 101 __u8*scr = dst;101 uint8_t *scr = dst; 102 102 #if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN)) 103 103 scr[0] = RED(rgb, 8); … … 113 113 static int byte3_rgb(void *src) 114 114 { 115 __u8*scr = src;115 uint8_t *scr = src; 116 116 #if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN)) 117 117 return scr[0] << 16 | scr[1] << 8 | scr[2]; … … 125 125 { 126 126 /* 5-bit, 6-bits, 5-bits */ 127 *(( __u16*)(dst)) = RED(rgb, 5) << 11 | GREEN(rgb, 6) << 5 | BLUE(rgb, 5);127 *((uint16_t *)(dst)) = RED(rgb, 5) << 11 | GREEN(rgb, 6) << 5 | BLUE(rgb, 5); 128 128 } 129 129 … … 131 131 static int byte2_rgb(void *src) 132 132 { 133 int color = *( __u16*)(src);133 int color = *(uint16_t *)(src); 134 134 return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3); 135 135 } … … 138 138 static void rgb_1byte(void *dst, int rgb) 139 139 { 140 *( __u8*)dst = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3);140 *(uint8_t *)dst = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3); 141 141 } 142 142 … … 144 144 static int byte1_rgb(void *src) 145 145 { 146 int color = *( __u8*)src;146 int color = *(uint8_t *)src; 147 147 return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5); 148 148 } … … 185 185 static void scroll_screen(void) 186 186 { 187 __u8*lastline = &fbaddress[(rows - 1) * ROW_BYTES];187 uint8_t *lastline = &fbaddress[(rows - 1) * ROW_BYTES]; 188 188 int firstsz; 189 189 … … 226 226 227 227 /** Draw character at given position */ 228 static void draw_glyph( __u8glyph, unsigned int col, unsigned int row)228 static void draw_glyph(uint8_t glyph, unsigned int col, unsigned int row) 229 229 { 230 230 unsigned int y; … … 337 337 * 338 338 */ 339 void fb_init( __addressaddr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan)339 void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan) 340 340 { 341 341 switch (bpp) { … … 367 367 368 368 /* Map the framebuffer */ 369 fbaddress = ( __u8 *) hw_map((__address) addr, fbsize);369 fbaddress = (uint8_t *) hw_map((uintptr_t) addr, fbsize); 370 370 371 371 xres = x; … … 400 400 401 401 /* Initialized blank line */ 402 blankline = ( __u8*) malloc(ROW_BYTES, FRAME_ATOMIC);402 blankline = (uint8_t *) malloc(ROW_BYTES, FRAME_ATOMIC); 403 403 if (!blankline) 404 404 panic("Failed to allocate blank line for framebuffer."); -
genarch/src/i8042/i8042.c
r991779c5 r7f1c620 85 85 #define IGNORE_CODE 0x7f 86 86 87 static void key_released( __u8sc);88 static void key_pressed( __u8sc);87 static void key_released(uint8_t sc); 88 static void key_pressed(uint8_t sc); 89 89 static char key_read(chardev_t *d); 90 90 … … 95 95 #define ACTIVE_READ_BUFF_SIZE 16 /* Must be power of 2 */ 96 96 97 static __u8active_read_buff[ACTIVE_READ_BUFF_SIZE];97 static uint8_t active_read_buff[ACTIVE_READ_BUFF_SIZE]; 98 98 99 99 SPINLOCK_INITIALIZE(keylock); /**< keylock protects keyflags and lockflags. */ … … 323 323 void i8042_interrupt(int n, istate_t *istate) 324 324 { 325 __u8x;326 __u8status;325 uint8_t x; 326 uint8_t status; 327 327 328 328 while (((status=i8042_status_read()) & i8042_BUFFER_FULL_MASK)) { … … 351 351 * @param sc Scancode of the key being released. 352 352 */ 353 void key_released( __u8sc)353 void key_released(uint8_t sc) 354 354 { 355 355 spinlock_lock(&keylock); … … 376 376 * @param sc Scancode of the key being pressed. 377 377 */ 378 void key_pressed( __u8sc)378 void key_pressed(uint8_t sc) 379 379 { 380 380 char *map = sc_primary_map; … … 454 454 } 455 455 456 static __u8active_read_buff_read(void)456 static uint8_t active_read_buff_read(void) 457 457 { 458 458 static int i=0; … … 464 464 } 465 465 466 static void active_read_buff_write( __u8ch)466 static void active_read_buff_write(uint8_t ch) 467 467 { 468 468 static int i=0; … … 474 474 475 475 476 static void active_read_key_pressed( __u8sc)476 static void active_read_key_pressed(uint8_t sc) 477 477 { 478 478 char *map = sc_primary_map; … … 548 548 549 549 while(!(ch = active_read_buff_read())) { 550 __u8x;550 uint8_t x; 551 551 while (!(i8042_status_read() & i8042_BUFFER_FULL_MASK)) 552 552 ; … … 568 568 void i8042_poll(void) 569 569 { 570 __u8x;570 uint8_t x; 571 571 572 572 while (((x = i8042_status_read() & i8042_BUFFER_FULL_MASK))) { -
genarch/src/mm/as_pt.c
r991779c5 r7f1c620 77 77 78 78 if (flags & FLAG_AS_KERNEL) { 79 memsetb(( __address) dst_ptl0, PAGE_SIZE, 0);79 memsetb((uintptr_t) dst_ptl0, PAGE_SIZE, 0); 80 80 } else { 81 __addresssrc, dst;81 uintptr_t src, dst; 82 82 83 83 /* … … 87 87 ipl = interrupts_disable(); 88 88 mutex_lock(&AS_KERNEL->lock); 89 src_ptl0 = (pte_t *) PA2KA(( __address) AS_KERNEL->page_table);89 src_ptl0 = (pte_t *) PA2KA((uintptr_t) AS_KERNEL->page_table); 90 90 91 src = ( __address) &src_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)];92 dst = ( __address) &dst_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)];91 src = (uintptr_t) &src_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)]; 92 dst = (uintptr_t) &dst_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)]; 93 93 94 memsetb(( __address) dst_ptl0, PAGE_SIZE, 0);95 memcpy((void *) dst, (void *) src, PAGE_SIZE - (src - ( __address) src_ptl0));94 memsetb((uintptr_t) dst_ptl0, PAGE_SIZE, 0); 95 memcpy((void *) dst, (void *) src, PAGE_SIZE - (src - (uintptr_t) src_ptl0)); 96 96 mutex_unlock(&AS_KERNEL->lock); 97 97 interrupts_restore(ipl); 98 98 } 99 99 100 return (pte_t *) KA2PA(( __address) dst_ptl0);100 return (pte_t *) KA2PA((uintptr_t) dst_ptl0); 101 101 } 102 102 … … 109 109 void ptl0_destroy(pte_t *page_table) 110 110 { 111 frame_free(( __address)page_table);111 frame_free((uintptr_t)page_table); 112 112 } 113 113 -
genarch/src/mm/page_ht.c
r991779c5 r7f1c620 53 53 #include <align.h> 54 54 55 static index_t hash( __nativekey[]);56 static bool compare( __nativekey[], count_t keys, link_t *item);55 static index_t hash(unative_t key[]); 56 static bool compare(unative_t key[], count_t keys, link_t *item); 57 57 static void remove_callback(link_t *item); 58 58 59 static void ht_mapping_insert(as_t *as, __address page, __addressframe, int flags);60 static void ht_mapping_remove(as_t *as, __addresspage);61 static pte_t *ht_mapping_find(as_t *as, __addresspage);59 static void ht_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int flags); 60 static void ht_mapping_remove(as_t *as, uintptr_t page); 61 static pte_t *ht_mapping_find(as_t *as, uintptr_t page); 62 62 63 63 /** … … 94 94 * @return Index into page hash table. 95 95 */ 96 index_t hash( __nativekey[])96 index_t hash(unative_t key[]) 97 97 { 98 98 as_t *as = (as_t *) key[KEY_AS]; 99 __address page = (__address) key[KEY_PAGE];99 uintptr_t page = (uintptr_t) key[KEY_PAGE]; 100 100 index_t index; 101 101 … … 112 112 * hash index. 113 113 */ 114 index |= (( __native) as) & (PAGE_HT_ENTRIES-1);114 index |= ((unative_t) as) & (PAGE_HT_ENTRIES-1); 115 115 116 116 return index; … … 125 125 * @return true on match, false otherwise. 126 126 */ 127 bool compare( __nativekey[], count_t keys, link_t *item)127 bool compare(unative_t key[], count_t keys, link_t *item) 128 128 { 129 129 pte_t *t; … … 138 138 139 139 if (keys == PAGE_HT_KEYS) { 140 return (key[KEY_AS] == ( __address) t->as) && (key[KEY_PAGE] == t->page);140 return (key[KEY_AS] == (uintptr_t) t->as) && (key[KEY_PAGE] == t->page); 141 141 } else { 142 return (key[KEY_AS] == ( __address) t->as);142 return (key[KEY_AS] == (uintptr_t) t->as); 143 143 } 144 144 } … … 174 174 * @param flags Flags to be used for mapping. 175 175 */ 176 void ht_mapping_insert(as_t *as, __address page, __addressframe, int flags)176 void ht_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int flags) 177 177 { 178 178 pte_t *t; 179 __native key[2] = { (__address) as, page = ALIGN_DOWN(page, PAGE_SIZE) };179 unative_t key[2] = { (uintptr_t) as, page = ALIGN_DOWN(page, PAGE_SIZE) }; 180 180 181 181 if (!hash_table_find(&page_ht, key)) { … … 209 209 * @param page Virtual address of the page to be demapped. 210 210 */ 211 void ht_mapping_remove(as_t *as, __addresspage)212 { 213 __native key[2] = { (__address) as, page = ALIGN_DOWN(page, PAGE_SIZE) };211 void ht_mapping_remove(as_t *as, uintptr_t page) 212 { 213 unative_t key[2] = { (uintptr_t) as, page = ALIGN_DOWN(page, PAGE_SIZE) }; 214 214 215 215 /* … … 232 232 * @return NULL if there is no such mapping; requested mapping otherwise. 233 233 */ 234 pte_t *ht_mapping_find(as_t *as, __addresspage)234 pte_t *ht_mapping_find(as_t *as, uintptr_t page) 235 235 { 236 236 link_t *hlp; 237 237 pte_t *t = NULL; 238 __native key[2] = { (__address) as, page = ALIGN_DOWN(page, PAGE_SIZE) };238 unative_t key[2] = { (uintptr_t) as, page = ALIGN_DOWN(page, PAGE_SIZE) }; 239 239 240 240 hlp = hash_table_find(&page_ht, key); -
genarch/src/mm/page_pt.c
r991779c5 r7f1c620 47 47 #include <memstr.h> 48 48 49 static void pt_mapping_insert(as_t *as, __address page, __addressframe, int flags);50 static void pt_mapping_remove(as_t *as, __addresspage);51 static pte_t *pt_mapping_find(as_t *as, __addresspage);49 static void pt_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int flags); 50 static void pt_mapping_remove(as_t *as, uintptr_t page); 51 static pte_t *pt_mapping_find(as_t *as, uintptr_t page); 52 52 53 53 page_mapping_operations_t pt_mapping_operations = { … … 69 69 * @param flags Flags to be used for mapping. 70 70 */ 71 void pt_mapping_insert(as_t *as, __address page, __addressframe, int flags)71 void pt_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int flags) 72 72 { 73 73 pte_t *ptl0, *ptl1, *ptl2, *ptl3; 74 74 pte_t *newpt; 75 75 76 ptl0 = (pte_t *) PA2KA(( __address) as->page_table);76 ptl0 = (pte_t *) PA2KA((uintptr_t) as->page_table); 77 77 78 78 if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) { 79 79 newpt = (pte_t *)frame_alloc(ONE_FRAME, FRAME_KA); 80 memsetb(( __address)newpt, PAGE_SIZE, 0);80 memsetb((uintptr_t)newpt, PAGE_SIZE, 0); 81 81 SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page), KA2PA(newpt)); 82 82 SET_PTL1_FLAGS(ptl0, PTL0_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE); … … 87 87 if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) { 88 88 newpt = (pte_t *)frame_alloc(ONE_FRAME, FRAME_KA); 89 memsetb(( __address)newpt, PAGE_SIZE, 0);89 memsetb((uintptr_t)newpt, PAGE_SIZE, 0); 90 90 SET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page), KA2PA(newpt)); 91 91 SET_PTL2_FLAGS(ptl1, PTL1_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE); … … 96 96 if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) { 97 97 newpt = (pte_t *)frame_alloc(ONE_FRAME, FRAME_KA); 98 memsetb(( __address)newpt, PAGE_SIZE, 0);98 memsetb((uintptr_t)newpt, PAGE_SIZE, 0); 99 99 SET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page), KA2PA(newpt)); 100 100 SET_PTL3_FLAGS(ptl2, PTL2_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE); … … 120 120 * @param page Virtual address of the page to be demapped. 121 121 */ 122 void pt_mapping_remove(as_t *as, __addresspage)122 void pt_mapping_remove(as_t *as, uintptr_t page) 123 123 { 124 124 pte_t *ptl0, *ptl1, *ptl2, *ptl3; … … 130 130 */ 131 131 132 ptl0 = (pte_t *) PA2KA(( __address) as->page_table);132 ptl0 = (pte_t *) PA2KA((uintptr_t) as->page_table); 133 133 134 134 if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) … … 148 148 149 149 /* Destroy the mapping. Setting to PAGE_NOT_PRESENT is not sufficient. */ 150 memsetb(( __address) &ptl3[PTL3_INDEX(page)], sizeof(pte_t), 0);150 memsetb((uintptr_t) &ptl3[PTL3_INDEX(page)], sizeof(pte_t), 0); 151 151 152 152 /* … … 166 166 * Release the frame and remove PTL3 pointer from preceding table. 167 167 */ 168 frame_free(KA2PA(( __address) ptl3));168 frame_free(KA2PA((uintptr_t) ptl3)); 169 169 if (PTL2_ENTRIES) 170 memsetb(( __address) &ptl2[PTL2_INDEX(page)], sizeof(pte_t), 0);170 memsetb((uintptr_t) &ptl2[PTL2_INDEX(page)], sizeof(pte_t), 0); 171 171 else if (PTL1_ENTRIES) 172 memsetb(( __address) &ptl1[PTL1_INDEX(page)], sizeof(pte_t), 0);172 memsetb((uintptr_t) &ptl1[PTL1_INDEX(page)], sizeof(pte_t), 0); 173 173 else 174 memsetb(( __address) &ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0);174 memsetb((uintptr_t) &ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0); 175 175 } else { 176 176 /* … … 195 195 * Release the frame and remove PTL2 pointer from preceding table. 196 196 */ 197 frame_free(KA2PA(( __address) ptl2));197 frame_free(KA2PA((uintptr_t) ptl2)); 198 198 if (PTL1_ENTRIES) 199 memsetb(( __address) &ptl1[PTL1_INDEX(page)], sizeof(pte_t), 0);199 memsetb((uintptr_t) &ptl1[PTL1_INDEX(page)], sizeof(pte_t), 0); 200 200 else 201 memsetb(( __address) &ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0);201 memsetb((uintptr_t) &ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0); 202 202 } 203 203 else { … … 224 224 * Release the frame and remove PTL1 pointer from preceding table. 225 225 */ 226 frame_free(KA2PA(( __address) ptl1));227 memsetb(( __address) &ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0);226 frame_free(KA2PA((uintptr_t) ptl1)); 227 memsetb((uintptr_t) &ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0); 228 228 } 229 229 } … … 242 242 * @return NULL if there is no such mapping; entry from PTL3 describing the mapping otherwise. 243 243 */ 244 pte_t *pt_mapping_find(as_t *as, __addresspage)244 pte_t *pt_mapping_find(as_t *as, uintptr_t page) 245 245 { 246 246 pte_t *ptl0, *ptl1, *ptl2, *ptl3; 247 247 248 ptl0 = (pte_t *) PA2KA(( __address) as->page_table);248 ptl0 = (pte_t *) PA2KA((uintptr_t) as->page_table); 249 249 250 250 if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) -
genarch/src/ofw/memory_init.c
r991779c5 r7f1c620 44 44 45 45 typedef struct { 46 __addressstart;46 uintptr_t start; 47 47 size_t size; 48 48 } memmap_t; -
genarch/src/ofw/ofw.c
r991779c5 r7f1c620 64 64 } 65 65 66 __nativeofw_call(const char *service, const int nargs, const int nret, ...)66 unative_t ofw_call(const char *service, const int nargs, const int nret, ...) 67 67 { 68 68 va_list list;
Note:
See TracChangeset
for help on using the changeset viewer.