Changeset 7f1c620 in mainline for genarch


Ignore:
Timestamp:
2006-07-04T17:17:56Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0ffa3ef5
Parents:
991779c5
Message:

Replace old u?? types with respective C99 variants (e.g. uint32_t, int64_t, uintptr_t etc.).

Location:
genarch
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • genarch/include/acpi/acpi.h

    r991779c5 r7f1c620  
    4040/* Root System Description Pointer */
    4141struct acpi_rsdp {
    42         __u8 signature[8];
    43         __u8 checksum;
    44         __u8 oemid[6];
    45         __u8 revision;
    46         __u32 rsdt_address;
    47         __u32 length;
    48         __u64 xsdt_address;
    49         __u32 ext_checksum;
    50         __u8 reserved[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];
    5151} __attribute__ ((packed));
    5252
    5353/* System Description Table Header */
    5454struct acpi_sdt_header {
    55         __u8 signature[4];
    56         __u32 length;
    57         __u8 revision;
    58         __u8 checksum;
    59         __u8 oemid[6];
    60         __u8 oem_table_id[8];
    61         __u32 oem_revision;
    62         __u32 creator_id;
    63         __u32 creator_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;
    6464} __attribute__ ((packed));;
    6565
    6666struct acpi_signature_map {
    67         __u8 *signature;
     67        uint8_t *signature;
    6868        struct acpi_sdt_header **sdt_ptr;
    6969        char *description;
     
    7373struct acpi_rsdt {
    7474        struct acpi_sdt_header header;
    75         __u32 entry[];
     75        uint32_t entry[];
    7676} __attribute__ ((packed));;
    7777
     
    7979struct acpi_xsdt {
    8080        struct acpi_sdt_header header;
    81         __u64 entry[];
     81        uint64_t entry[];
    8282} __attribute__ ((packed));;
    8383
     
    8787
    8888extern void acpi_init(void);
    89 extern int acpi_sdt_check(__u8 *sdt);
     89extern int acpi_sdt_check(uint8_t *sdt);
    9090
    9191#endif /* __ACPI_H__ */
  • genarch/include/acpi/madt.h

    r991779c5 r7f1c620  
    5454
    5555struct madt_apic_header {
    56         __u8 type;
    57         __u8 length;
     56        uint8_t type;
     57        uint8_t length;
    5858} __attribute__ ((packed));
    5959
     
    6262struct acpi_madt {
    6363        struct acpi_sdt_header header;
    64         __u32 l_apic_address;
    65         __u32 flags;
     64        uint32_t l_apic_address;
     65        uint32_t flags;
    6666        struct madt_apic_header apic_header[];
    6767} __attribute__ ((packed));
     
    6969struct madt_l_apic {
    7070        struct madt_apic_header header;
    71         __u8 acpi_id;
    72         __u8 apic_id;
    73         __u32 flags;   
     71        uint8_t acpi_id;
     72        uint8_t apic_id;
     73        uint32_t flags;
    7474} __attribute__ ((packed));
    7575
    7676struct madt_io_apic {
    7777        struct madt_apic_header header;
    78         __u8 io_apic_id;
    79         __u8 reserved;
    80         __u32 io_apic_address; 
    81         __u32 global_intr_base;
     78        uint8_t io_apic_id;
     79        uint8_t reserved;
     80        uint32_t io_apic_address;       
     81        uint32_t global_intr_base;
    8282} __attribute__ ((packed));
    8383
    8484struct madt_intr_src_ovrd {
    8585        struct madt_apic_header header;
    86         __u8 bus;
    87         __u8 source;
    88         __u32 global_int;
    89         __u16 flags;
     86        uint8_t bus;
     87        uint8_t source;
     88        uint32_t global_int;
     89        uint16_t flags;
    9090} __attribute__ ((packed));
    9191
    9292struct madt_nmi_src {
    9393        struct madt_apic_header header;
    94         __u16 flags;
    95         __u32 global_intr;
     94        uint16_t flags;
     95        uint32_t global_intr;
    9696} __attribute__ ((packed));
    9797
    9898struct madt_l_apic_nmi {
    9999        struct madt_apic_header header;
    100         __u8 acpi_id;
    101         __u16 flags;
    102         __u8 l_apic_lint;
     100        uint8_t acpi_id;
     101        uint16_t flags;
     102        uint8_t l_apic_lint;
    103103} __attribute__ ((packed));
    104104
    105105struct madt_l_apic_addr_ovrd {
    106106        struct madt_apic_header header;
    107         __u16 reserved;
    108         __u64 l_apic_address;
     107        uint16_t reserved;
     108        uint64_t l_apic_address;
    109109} __attribute__ ((packed));
    110110
    111111struct madt_io_sapic {
    112112        struct madt_apic_header header;
    113         __u8 io_apic_id;
    114         __u8 reserved;
    115         __u32 global_intr_base;
    116         __u64 io_apic_address;         
     113        uint8_t io_apic_id;
     114        uint8_t reserved;
     115        uint32_t global_intr_base;
     116        uint64_t io_apic_address;               
    117117} __attribute__ ((packed));
    118118
    119119struct madt_l_sapic {
    120120        struct madt_apic_header header;
    121         __u8 acpi_id;
    122         __u8 sapic_id;
    123         __u8 sapic_eid;
    124         __u8 reserved[3];
    125         __u32 flags;
    126         __u32 acpi_processor_uid_value;
    127         __u8 acpi_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];
    128128} __attribute__ ((packed));
    129129
    130130struct madt_platform_intr_src {
    131131        struct madt_apic_header header;
    132         __u16 flags;
    133         __u8 intr_type;
    134         __u8 processor_id;
    135         __u8 processor_eid;
    136         __u8 io_sapic_vector;
    137         __u32 global_intr;
    138         __u32 platform_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;
    139139} __attribute__ ((packed));
    140140
  • genarch/include/fb/fb.h

    r991779c5 r7f1c620  
    4040
    4141extern spinlock_t fb_lock;
    42 void fb_init(__address addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan);
     42void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan);
    4343
    4444#endif
  • genarch/include/mm/page_ht.h

    r991779c5 r7f1c620  
    6767        link_t link;            /**< Page hash table link. */
    6868        as_t *as;               /**< Address space. */
    69         __address page;         /**< Virtual memory page. */
    70         __address frame;        /**< Physical memory frame. */
     69        uintptr_t page;         /**< Virtual memory page. */
     70        uintptr_t frame;        /**< Physical memory frame. */
    7171        unsigned g : 1;         /**< Global page. */
    7272        unsigned x : 1;         /**< Execute. */
  • genarch/include/mm/page_pt.h

    r991779c5 r7f1c620  
    110110extern page_mapping_operations_t pt_mapping_operations;
    111111
    112 extern void page_mapping_insert_pt(as_t *as, __address page, __address frame, int flags);
    113 extern pte_t *page_mapping_find_pt(as_t *as, __address page);
     112extern void page_mapping_insert_pt(as_t *as, uintptr_t page, uintptr_t frame, int flags);
     113extern pte_t *page_mapping_find_pt(as_t *as, uintptr_t page);
    114114
    115115#endif
  • genarch/include/ofw/ofw.h

    r991779c5 r7f1c620  
    4040#define MAX_OFW_ARGS    10
    4141
    42 typedef __native ofw_arg_t;
     42typedef unative_t ofw_arg_t;
    4343typedef int ihandle;
    4444typedef int phandle;
     
    4949typedef struct {
    5050        const char *service;          /**< Command name */
    51         __native nargs;               /**< Number of in arguments */
    52         __native nret;                /**< Number of out arguments */
     51        unative_t nargs;               /**< Number of in arguments */
     52        unative_t nret;                /**< Number of out arguments */
    5353        ofw_arg_t args[MAX_OFW_ARGS]; /**< List of arguments */
    5454} ofw_args_t;
     
    6060extern void ofw_init(void);
    6161extern void ofw_done(void);
    62 extern __native ofw_call(const char *service, const int nargs, const int nret, ...);
     62extern unative_t ofw_call(const char *service, const int nargs, const int nret, ...);
    6363extern void ofw_putchar(const char ch);
    6464extern char ofw_getchar(void);
  • genarch/src/acpi/acpi.c

    r991779c5 r7f1c620  
    5252
    5353struct 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" }
    5555};
    5656
    57 static int rsdp_check(__u8 *rsdp) {
     57static int rsdp_check(uint8_t *rsdp) {
    5858        struct acpi_rsdp *r = (struct acpi_rsdp *) rsdp;
    59         __u8 sum = 0;
     59        uint8_t sum = 0;
    6060        int i;
    6161       
     
    7676}
    7777
    78 int acpi_sdt_check(__u8 *sdt)
     78int acpi_sdt_check(uint8_t *sdt)
    7979{
    8080        struct acpi_sdt_header *h = (struct acpi_sdt_header *) sdt;
    81         __u8 sum = 0;
     81        uint8_t sum = 0;
    8282        int i;
    8383
     
    9090static void map_sdt(struct acpi_sdt_header *sdt)
    9191{
    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);
    9494}
    9595
    9696static void configure_via_rsdt(void)
    9797{
    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);
    9999       
    100100        for (i=0; i<cnt; i++) {
    101101                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];
    103103               
    104104                        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))
    107107                                        goto next;
    108108                                *signature_map[j].sdt_ptr = h;
     
    117117static void configure_via_xsdt(void)
    118118{
    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);
    120120       
    121121        for (i=0; i<cnt; i++) {
    122122                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]);
    124124
    125125                        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))
    128128                                        goto next;
    129129                                *signature_map[j].sdt_ptr = h;
     
    139139void acpi_init(void)
    140140{
    141         __u8 *addr[2] = { NULL, (__u8 *) PA2KA(0xe0000) };
     141        uint8_t *addr[2] = { NULL, (uint8_t *) PA2KA(0xe0000) };
    142142        int i, j, length[2] = { 1024, 128*1024 };
    143         __u64 *sig = (__u64 *) RSDP_SIGNATURE;
     143        uint64_t *sig = (uint64_t *) RSDP_SIGNATURE;
    144144
    145145        /*
     
    149149         */
    150150
    151         addr[0] = (__u8 *) PA2KA(ebda);
     151        addr[0] = (uint8_t *) PA2KA(ebda);
    152152        for (i = (ebda ? 0 : 1); i < 2; i++) {
    153153                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])) {
    155155                                acpi_rsdp = (struct acpi_rsdp *) &addr[i][j];
    156156                                goto rsdp_found;
     
    164164        printf("%#zx: ACPI Root System Description Pointer\n", acpi_rsdp);
    165165
    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);
    168168
    169169        if (acpi_rsdt) map_sdt((struct acpi_sdt_header *) acpi_rsdt);
    170170        if (acpi_xsdt) map_sdt((struct acpi_sdt_header *) acpi_xsdt);   
    171171
    172         if (acpi_rsdt && !acpi_sdt_check((__u8 *) acpi_rsdt)) {
     172        if (acpi_rsdt && !acpi_sdt_check((uint8_t *) acpi_rsdt)) {
    173173                printf("RSDT: %s\n", "bad checksum");
    174174                return;
    175175        }
    176         if (acpi_xsdt && !acpi_sdt_check((__u8 *) acpi_xsdt)) {
     176        if (acpi_xsdt && !acpi_sdt_check((uint8_t *) acpi_xsdt)) {
    177177                printf("XSDT: %s\n", "bad checksum");
    178178                return;
  • genarch/src/acpi/madt.c

    r991779c5 r7f1c620  
    5656int isa_irq_map[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
    5757
    58 static void madt_l_apic_entry(struct madt_l_apic *la, __u32 index);
    59 static void madt_io_apic_entry(struct madt_io_apic *ioa, __u32 index);
    60 static void madt_intr_src_ovrd_entry(struct madt_intr_src_ovrd *override, __u32 index);
     58static void madt_l_apic_entry(struct madt_l_apic *la, uint32_t index);
     59static void madt_io_apic_entry(struct madt_io_apic *ioa, uint32_t index);
     60static void madt_intr_src_ovrd_entry(struct madt_intr_src_ovrd *override, uint32_t index);
    6161static int madt_cmp(void * a, void * b);
    6262
     
    9191static bool madt_cpu_enabled(index_t i);
    9292static bool madt_cpu_bootstrap(index_t i);
    93 static __u8 madt_cpu_apic_id(index_t i);
     93static uint8_t madt_cpu_apic_id(index_t i);
    9494static int madt_irq_to_pin(int irq);
    9595
     
    120120}
    121121
    122 __u8 madt_cpu_apic_id(index_t i)
     122uint8_t madt_cpu_apic_id(index_t i)
    123123{
    124124        ASSERT(i < madt_l_apic_entry_cnt);
     
    142142void acpi_madt_parse(void)
    143143{
    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);
    145145        struct madt_apic_header *h;
    146146       
    147         l_apic = (__u32 *) (__native) acpi_madt->l_apic_address;
     147        l_apic = (uint32_t *) (unative_t) acpi_madt->l_apic_address;
    148148
    149149        /* 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)) {
    151151                madt_entries_index_cnt++;
    152152        }
     
    157157                panic("Memory allocation error.");
    158158
    159         __u32 index = 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)) {
    162162                madt_entries_index[index++] = h;
    163163        }
    164164
    165165        /* 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);
    167167
    168168        /* Parse MADT entries */       
     
    207207 
    208208
    209 void madt_l_apic_entry(struct madt_l_apic *la, __u32 index)
     209void madt_l_apic_entry(struct madt_l_apic *la, uint32_t index)
    210210{
    211211        if (!madt_l_apic_entry_cnt++) {
     
    222222}
    223223
    224 void madt_io_apic_entry(struct madt_io_apic *ioa, __u32 index)
     224void madt_io_apic_entry(struct madt_io_apic *ioa, uint32_t index)
    225225{
    226226        if (!madt_io_apic_entry_cnt++) {
    227227                /* remember index of the first io apic entry */
    228228                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;
    230230        } else {
    231231                /* currently not supported */
     
    234234}
    235235
    236 void madt_intr_src_ovrd_entry(struct madt_intr_src_ovrd *override, __u32 index)
     236void madt_intr_src_ovrd_entry(struct madt_intr_src_ovrd *override, uint32_t index)
    237237{
    238238        ASSERT(override->source < sizeof(isa_irq_map)/sizeof(int));
  • genarch/src/fb/fb.c

    r991779c5 r7f1c620  
    5050SPINLOCK_INITIALIZE(fb_lock);
    5151
    52 static __u8 *fbaddress = NULL;
    53 
    54 static __u8 *blankline = NULL;
    55 static __u8 *dbbuffer = NULL; /* Buffer for fast scrolling console */
     52static uint8_t *fbaddress = NULL;
     53
     54static uint8_t *blankline = NULL;
     55static uint8_t *dbbuffer = NULL; /* Buffer for fast scrolling console */
    5656static int dboffset;
    5757
     
    9999static void rgb_3byte(void *dst, int rgb)
    100100{
    101         __u8 *scr = dst;
     101        uint8_t *scr = dst;
    102102#if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN))
    103103        scr[0] = RED(rgb, 8);
     
    113113static int byte3_rgb(void *src)
    114114{
    115         __u8 *scr = src;
     115        uint8_t *scr = src;
    116116#if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN))
    117117        return scr[0] << 16 | scr[1] << 8 | scr[2];
     
    125125{
    126126        /* 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);
    128128}
    129129
     
    131131static int byte2_rgb(void *src)
    132132{
    133         int color = *(__u16 *)(src);
     133        int color = *(uint16_t *)(src);
    134134        return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3);
    135135}
     
    138138static void rgb_1byte(void *dst, int rgb)
    139139{
    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);
    141141}
    142142
     
    144144static int byte1_rgb(void *src)
    145145{
    146         int color = *(__u8 *)src;
     146        int color = *(uint8_t *)src;
    147147        return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
    148148}
     
    185185static void scroll_screen(void)
    186186{
    187         __u8 *lastline = &fbaddress[(rows - 1) * ROW_BYTES];
     187        uint8_t *lastline = &fbaddress[(rows - 1) * ROW_BYTES];
    188188        int firstsz;
    189189
     
    226226
    227227/** Draw character at given position */
    228 static void draw_glyph(__u8 glyph, unsigned int col, unsigned int row)
     228static void draw_glyph(uint8_t glyph, unsigned int col, unsigned int row)
    229229{
    230230        unsigned int y;
     
    337337 *
    338338 */
    339 void fb_init(__address addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan)
     339void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan)
    340340{
    341341        switch (bpp) {
     
    367367       
    368368        /* Map the framebuffer */
    369         fbaddress = (__u8 *) hw_map((__address) addr, fbsize);
     369        fbaddress = (uint8_t *) hw_map((uintptr_t) addr, fbsize);
    370370       
    371371        xres = x;
     
    400400
    401401        /* Initialized blank line */
    402         blankline = (__u8 *) malloc(ROW_BYTES, FRAME_ATOMIC);
     402        blankline = (uint8_t *) malloc(ROW_BYTES, FRAME_ATOMIC);
    403403        if (!blankline)
    404404                panic("Failed to allocate blank line for framebuffer.");
  • genarch/src/i8042/i8042.c

    r991779c5 r7f1c620  
    8585#define IGNORE_CODE     0x7f
    8686
    87 static void key_released(__u8 sc);
    88 static void key_pressed(__u8 sc);
     87static void key_released(uint8_t sc);
     88static void key_pressed(uint8_t sc);
    8989static char key_read(chardev_t *d);
    9090
     
    9595#define ACTIVE_READ_BUFF_SIZE 16        /* Must be power of 2 */
    9696
    97 static __u8 active_read_buff[ACTIVE_READ_BUFF_SIZE];
     97static uint8_t active_read_buff[ACTIVE_READ_BUFF_SIZE];
    9898
    9999SPINLOCK_INITIALIZE(keylock);           /**< keylock protects keyflags and lockflags. */
     
    323323void i8042_interrupt(int n, istate_t *istate)
    324324{
    325         __u8 x;
    326         __u8 status;
     325        uint8_t x;
     326        uint8_t status;
    327327
    328328        while (((status=i8042_status_read()) & i8042_BUFFER_FULL_MASK)) {
     
    351351 * @param sc Scancode of the key being released.
    352352 */
    353 void key_released(__u8 sc)
     353void key_released(uint8_t sc)
    354354{
    355355        spinlock_lock(&keylock);
     
    376376 * @param sc Scancode of the key being pressed.
    377377 */
    378 void key_pressed(__u8 sc)
     378void key_pressed(uint8_t sc)
    379379{
    380380        char *map = sc_primary_map;
     
    454454}
    455455
    456 static __u8 active_read_buff_read(void)
     456static uint8_t active_read_buff_read(void)
    457457{
    458458        static int i=0;
     
    464464}
    465465
    466 static void active_read_buff_write(__u8 ch)
     466static void active_read_buff_write(uint8_t ch)
    467467{
    468468        static int i=0;
     
    474474
    475475
    476 static void active_read_key_pressed(__u8 sc)
     476static void active_read_key_pressed(uint8_t sc)
    477477{
    478478        char *map = sc_primary_map;
     
    548548
    549549        while(!(ch = active_read_buff_read())) {
    550                 __u8 x;
     550                uint8_t x;
    551551                while (!(i8042_status_read() & i8042_BUFFER_FULL_MASK))
    552552                        ;
     
    568568void i8042_poll(void)
    569569{
    570         __u8 x;
     570        uint8_t x;
    571571
    572572        while (((x = i8042_status_read() & i8042_BUFFER_FULL_MASK))) {
  • genarch/src/mm/as_pt.c

    r991779c5 r7f1c620  
    7777
    7878        if (flags & FLAG_AS_KERNEL) {
    79                 memsetb((__address) dst_ptl0, PAGE_SIZE, 0);
     79                memsetb((uintptr_t) dst_ptl0, PAGE_SIZE, 0);
    8080        } else {
    81                 __address src, dst;
     81                uintptr_t src, dst;
    8282       
    8383                /*
     
    8787                ipl = interrupts_disable();
    8888                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);
    9090
    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)];
    9393
    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));
    9696                mutex_unlock(&AS_KERNEL->lock);
    9797                interrupts_restore(ipl);
    9898        }
    9999
    100         return (pte_t *) KA2PA((__address) dst_ptl0);
     100        return (pte_t *) KA2PA((uintptr_t) dst_ptl0);
    101101}
    102102
     
    109109void ptl0_destroy(pte_t *page_table)
    110110{
    111         frame_free((__address)page_table);
     111        frame_free((uintptr_t)page_table);
    112112}
    113113
  • genarch/src/mm/page_ht.c

    r991779c5 r7f1c620  
    5353#include <align.h>
    5454
    55 static index_t hash(__native key[]);
    56 static bool compare(__native key[], count_t keys, link_t *item);
     55static index_t hash(unative_t key[]);
     56static bool compare(unative_t key[], count_t keys, link_t *item);
    5757static void remove_callback(link_t *item);
    5858
    59 static void ht_mapping_insert(as_t *as, __address page, __address frame, int flags);
    60 static void ht_mapping_remove(as_t *as, __address page);
    61 static pte_t *ht_mapping_find(as_t *as, __address page);
     59static void ht_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int flags);
     60static void ht_mapping_remove(as_t *as, uintptr_t page);
     61static pte_t *ht_mapping_find(as_t *as, uintptr_t page);
    6262
    6363/**
     
    9494 * @return Index into page hash table.
    9595 */
    96 index_t hash(__native key[])
     96index_t hash(unative_t key[])
    9797{
    9898        as_t *as = (as_t *) key[KEY_AS];
    99         __address page = (__address) key[KEY_PAGE];
     99        uintptr_t page = (uintptr_t) key[KEY_PAGE];
    100100        index_t index;
    101101       
     
    112112         * hash index.
    113113         */
    114         index |= ((__native) as) & (PAGE_HT_ENTRIES-1);
     114        index |= ((unative_t) as) & (PAGE_HT_ENTRIES-1);
    115115       
    116116        return index;
     
    125125 * @return true on match, false otherwise.
    126126 */
    127 bool compare(__native key[], count_t keys, link_t *item)
     127bool compare(unative_t key[], count_t keys, link_t *item)
    128128{
    129129        pte_t *t;
     
    138138
    139139        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);
    141141        } else {
    142                 return (key[KEY_AS] == (__address) t->as);
     142                return (key[KEY_AS] == (uintptr_t) t->as);
    143143        }
    144144}
     
    174174 * @param flags Flags to be used for mapping.
    175175 */
    176 void ht_mapping_insert(as_t *as, __address page, __address frame, int flags)
     176void ht_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int flags)
    177177{
    178178        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) };
    180180       
    181181        if (!hash_table_find(&page_ht, key)) {
     
    209209 * @param page Virtual address of the page to be demapped.
    210210 */
    211 void ht_mapping_remove(as_t *as, __address page)
    212 {
    213         __native key[2] = { (__address) as, page = ALIGN_DOWN(page, PAGE_SIZE) };
     211void ht_mapping_remove(as_t *as, uintptr_t page)
     212{
     213        unative_t key[2] = { (uintptr_t) as, page = ALIGN_DOWN(page, PAGE_SIZE) };
    214214       
    215215        /*
     
    232232 * @return NULL if there is no such mapping; requested mapping otherwise.
    233233 */
    234 pte_t *ht_mapping_find(as_t *as, __address page)
     234pte_t *ht_mapping_find(as_t *as, uintptr_t page)
    235235{
    236236        link_t *hlp;
    237237        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) };
    239239       
    240240        hlp = hash_table_find(&page_ht, key);
  • genarch/src/mm/page_pt.c

    r991779c5 r7f1c620  
    4747#include <memstr.h>
    4848
    49 static void pt_mapping_insert(as_t *as, __address page, __address frame, int flags);
    50 static void pt_mapping_remove(as_t *as, __address page);
    51 static pte_t *pt_mapping_find(as_t *as, __address page);
     49static void pt_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int flags);
     50static void pt_mapping_remove(as_t *as, uintptr_t page);
     51static pte_t *pt_mapping_find(as_t *as, uintptr_t page);
    5252
    5353page_mapping_operations_t pt_mapping_operations = {
     
    6969 * @param flags Flags to be used for mapping.
    7070 */
    71 void pt_mapping_insert(as_t *as, __address page, __address frame, int flags)
     71void pt_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int flags)
    7272{
    7373        pte_t *ptl0, *ptl1, *ptl2, *ptl3;
    7474        pte_t *newpt;
    7575
    76         ptl0 = (pte_t *) PA2KA((__address) as->page_table);
     76        ptl0 = (pte_t *) PA2KA((uintptr_t) as->page_table);
    7777
    7878        if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) {
    7979                newpt = (pte_t *)frame_alloc(ONE_FRAME, FRAME_KA);
    80                 memsetb((__address)newpt, PAGE_SIZE, 0);
     80                memsetb((uintptr_t)newpt, PAGE_SIZE, 0);
    8181                SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page), KA2PA(newpt));
    8282                SET_PTL1_FLAGS(ptl0, PTL0_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE);
     
    8787        if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) {
    8888                newpt = (pte_t *)frame_alloc(ONE_FRAME, FRAME_KA);
    89                 memsetb((__address)newpt, PAGE_SIZE, 0);
     89                memsetb((uintptr_t)newpt, PAGE_SIZE, 0);
    9090                SET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page), KA2PA(newpt));
    9191                SET_PTL2_FLAGS(ptl1, PTL1_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE);
     
    9696        if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) {
    9797                newpt = (pte_t *)frame_alloc(ONE_FRAME, FRAME_KA);
    98                 memsetb((__address)newpt, PAGE_SIZE, 0);
     98                memsetb((uintptr_t)newpt, PAGE_SIZE, 0);
    9999                SET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page), KA2PA(newpt));
    100100                SET_PTL3_FLAGS(ptl2, PTL2_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE);
     
    120120 * @param page Virtual address of the page to be demapped.
    121121 */
    122 void pt_mapping_remove(as_t *as, __address page)
     122void pt_mapping_remove(as_t *as, uintptr_t page)
    123123{
    124124        pte_t *ptl0, *ptl1, *ptl2, *ptl3;
     
    130130         */
    131131
    132         ptl0 = (pte_t *) PA2KA((__address) as->page_table);
     132        ptl0 = (pte_t *) PA2KA((uintptr_t) as->page_table);
    133133
    134134        if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT)
     
    148148
    149149        /* 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);
    151151
    152152        /*
     
    166166                 * Release the frame and remove PTL3 pointer from preceding table.
    167167                 */
    168                 frame_free(KA2PA((__address) ptl3));
     168                frame_free(KA2PA((uintptr_t) ptl3));
    169169                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);
    171171                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);
    173173                else
    174                         memsetb((__address) &ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0);
     174                        memsetb((uintptr_t) &ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0);
    175175        } else {
    176176                /*
     
    195195                         * Release the frame and remove PTL2 pointer from preceding table.
    196196                         */
    197                         frame_free(KA2PA((__address) ptl2));
     197                        frame_free(KA2PA((uintptr_t) ptl2));
    198198                        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);
    200200                        else
    201                                 memsetb((__address) &ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0);
     201                                memsetb((uintptr_t) &ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0);
    202202                }
    203203                else {
     
    224224                         * Release the frame and remove PTL1 pointer from preceding table.
    225225                         */
    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);
    228228                }
    229229        }
     
    242242 * @return NULL if there is no such mapping; entry from PTL3 describing the mapping otherwise.
    243243 */
    244 pte_t *pt_mapping_find(as_t *as, __address page)
     244pte_t *pt_mapping_find(as_t *as, uintptr_t page)
    245245{
    246246        pte_t *ptl0, *ptl1, *ptl2, *ptl3;
    247247
    248         ptl0 = (pte_t *) PA2KA((__address) as->page_table);
     248        ptl0 = (pte_t *) PA2KA((uintptr_t) as->page_table);
    249249
    250250        if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT)
  • genarch/src/ofw/memory_init.c

    r991779c5 r7f1c620  
    4444
    4545typedef struct {
    46         __address start;
     46        uintptr_t start;
    4747        size_t size;
    4848} memmap_t;
  • genarch/src/ofw/ofw.c

    r991779c5 r7f1c620  
    6464}
    6565
    66 __native ofw_call(const char *service, const int nargs, const int nret, ...)
     66unative_t ofw_call(const char *service, const int nargs, const int nret, ...)
    6767{
    6868        va_list list;
Note: See TracChangeset for help on using the changeset viewer.