diff options
author | tholo <> | 1996-09-06 16:14:36 +0000 |
---|---|---|
committer | tholo <> | 1996-09-06 16:14:36 +0000 |
commit | ad3000d6f0c61cd65e3ea69468083d85287b2270 (patch) | |
tree | 15e5fe835c63a8a1f43f64e82c46f5d967703dba /src/lib | |
parent | c7823c0917675fd1ab482937ee1bd01d837b081c (diff) | |
download | openbsd-ad3000d6f0c61cd65e3ea69468083d85287b2270.tar.gz openbsd-ad3000d6f0c61cd65e3ea69468083d85287b2270.tar.bz2 openbsd-ad3000d6f0c61cd65e3ea69468083d85287b2270.zip |
asm -> __asm, clean lint(1) warnings
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index b9964b9b83..e82a5953fd 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #if defined(LIBC_SCCS) && !defined(lint) | 10 | #if defined(LIBC_SCCS) && !defined(lint) |
11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.8 1996/08/21 03:47:22 tholo Exp $"; | 11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.9 1996/09/06 16:14:36 tholo Exp $"; |
12 | #endif /* LIBC_SCCS and not lint */ | 12 | #endif /* LIBC_SCCS and not lint */ |
13 | 13 | ||
14 | /* | 14 | /* |
@@ -115,7 +115,7 @@ _ffs(input) | |||
115 | unsigned input; | 115 | unsigned input; |
116 | { | 116 | { |
117 | int result; | 117 | int result; |
118 | asm("bsfl %1,%0" : "=r" (result) : "r" (input)); | 118 | __asm("bsfl %1,%0" : "=r" (result) : "r" (input)); |
119 | return result+1; | 119 | return result+1; |
120 | } | 120 | } |
121 | 121 | ||
@@ -125,7 +125,7 @@ _fls(input) | |||
125 | unsigned input; | 125 | unsigned input; |
126 | { | 126 | { |
127 | int result; | 127 | int result; |
128 | asm("bsrl %1,%0" : "=r" (result) : "r" (input)); | 128 | __asm("bsrl %1,%0" : "=r" (result) : "r" (input)); |
129 | return result+1; | 129 | return result+1; |
130 | } | 130 | } |
131 | 131 | ||
@@ -135,7 +135,7 @@ _set_bit(pi, bit) | |||
135 | struct pginfo *pi; | 135 | struct pginfo *pi; |
136 | int bit; | 136 | int bit; |
137 | { | 137 | { |
138 | asm("btsl %0,(%1)" : | 138 | __asm("btsl %0,(%1)" : |
139 | : "r" (bit & (MALLOC_BITS-1)), "r" (pi->bits+(bit/MALLOC_BITS))); | 139 | : "r" (bit & (MALLOC_BITS-1)), "r" (pi->bits+(bit/MALLOC_BITS))); |
140 | } | 140 | } |
141 | 141 | ||
@@ -145,7 +145,7 @@ _clr_bit(pi, bit) | |||
145 | struct pginfo *pi; | 145 | struct pginfo *pi; |
146 | int bit; | 146 | int bit; |
147 | { | 147 | { |
148 | asm("btcl %0,(%1)" : | 148 | __asm("btcl %0,(%1)" : |
149 | : "r" (bit & (MALLOC_BITS-1)), "r" (pi->bits+(bit/MALLOC_BITS))); | 149 | : "r" (bit & (MALLOC_BITS-1)), "r" (pi->bits+(bit/MALLOC_BITS))); |
150 | } | 150 | } |
151 | 151 | ||
@@ -494,7 +494,7 @@ extend_pgdir(index) | |||
494 | 494 | ||
495 | /* Get new pages */ | 495 | /* Get new pages */ |
496 | new = (struct pginfo**) mmap(0, i * malloc_pagesize, PROT_READ|PROT_WRITE, | 496 | new = (struct pginfo**) mmap(0, i * malloc_pagesize, PROT_READ|PROT_WRITE, |
497 | MAP_ANON|MAP_PRIVATE, -1, 0); | 497 | MAP_ANON|MAP_PRIVATE, -1, (off_t)0); |
498 | if (new == (struct pginfo **)-1) | 498 | if (new == (struct pginfo **)-1) |
499 | return 0; | 499 | return 0; |
500 | 500 | ||
@@ -608,7 +608,7 @@ malloc_init () | |||
608 | 608 | ||
609 | /* Allocate one page for the page directory */ | 609 | /* Allocate one page for the page directory */ |
610 | page_dir = (struct pginfo **) mmap(0, malloc_pagesize, PROT_READ|PROT_WRITE, | 610 | page_dir = (struct pginfo **) mmap(0, malloc_pagesize, PROT_READ|PROT_WRITE, |
611 | MAP_ANON|MAP_PRIVATE, -1, 0); | 611 | MAP_ANON|MAP_PRIVATE, -1, (off_t)0); |
612 | if (page_dir == (struct pginfo **) -1) | 612 | if (page_dir == (struct pginfo **) -1) |
613 | wrterror("(Init) my first mmap failed. (check limits ?)\n"); | 613 | wrterror("(Init) my first mmap failed. (check limits ?)\n"); |
614 | 614 | ||
@@ -679,7 +679,7 @@ malloc_pages(size) | |||
679 | } | 679 | } |
680 | 680 | ||
681 | p = pf->page; | 681 | p = pf->page; |
682 | pf->page += size; | 682 | pf->page = (char *)pf->page + size; |
683 | pf->size -= size; | 683 | pf->size -= size; |
684 | break; | 684 | break; |
685 | } | 685 | } |
@@ -763,7 +763,7 @@ malloc_make_chunks(bits) | |||
763 | 763 | ||
764 | /* Do a bunch at a time */ | 764 | /* Do a bunch at a time */ |
765 | for(;k-i >= MALLOC_BITS; i += MALLOC_BITS) | 765 | for(;k-i >= MALLOC_BITS; i += MALLOC_BITS) |
766 | bp->bits[i / MALLOC_BITS] = ~0; | 766 | bp->bits[i / MALLOC_BITS] = (u_long)~0; |
767 | 767 | ||
768 | for(; i < k; i++) | 768 | for(; i < k; i++) |
769 | set_bit(bp,i); | 769 | set_bit(bp,i); |
@@ -825,9 +825,9 @@ malloc_bytes(size) | |||
825 | k <<= bp->shift; | 825 | k <<= bp->shift; |
826 | 826 | ||
827 | if (malloc_junk) | 827 | if (malloc_junk) |
828 | memset(bp->page + k, SOME_JUNK, bp->size); | 828 | memset((char *)bp->page + k, SOME_JUNK, bp->size); |
829 | 829 | ||
830 | return bp->page + k; | 830 | return (void *)((char *)bp->page + k); |
831 | } | 831 | } |
832 | 832 | ||
833 | /* | 833 | /* |
@@ -1043,7 +1043,7 @@ free_pages(ptr, index, info) | |||
1043 | 1043 | ||
1044 | l = i << malloc_pageshift; | 1044 | l = i << malloc_pageshift; |
1045 | 1045 | ||
1046 | tail = ptr+l; | 1046 | tail = (char *)ptr + l; |
1047 | 1047 | ||
1048 | /* add to free-list */ | 1048 | /* add to free-list */ |
1049 | if (!px) | 1049 | if (!px) |
@@ -1063,7 +1063,7 @@ free_pages(ptr, index, info) | |||
1063 | } else { | 1063 | } else { |
1064 | 1064 | ||
1065 | /* Find the right spot, leave pf pointing to the modified entry. */ | 1065 | /* Find the right spot, leave pf pointing to the modified entry. */ |
1066 | tail = ptr+l; | 1066 | tail = (char *)ptr + l; |
1067 | 1067 | ||
1068 | for(pf = free_list.next; pf->end < ptr && pf->next; pf = pf->next) | 1068 | for(pf = free_list.next; pf->end < ptr && pf->next; pf = pf->next) |
1069 | ; /* Race ahead here */ | 1069 | ; /* Race ahead here */ |
@@ -1078,7 +1078,7 @@ free_pages(ptr, index, info) | |||
1078 | px = 0; | 1078 | px = 0; |
1079 | } else if (pf->end == ptr ) { | 1079 | } else if (pf->end == ptr ) { |
1080 | /* Append to the previous entry */ | 1080 | /* Append to the previous entry */ |
1081 | pf->end += l; | 1081 | pf->end = (char *)pf->end + l; |
1082 | pf->size += l; | 1082 | pf->size += l; |
1083 | if (pf->next && pf->end == pf->next->page ) { | 1083 | if (pf->next && pf->end == pf->next->page ) { |
1084 | /* And collapse the next too. */ | 1084 | /* And collapse the next too. */ |
@@ -1116,7 +1116,7 @@ free_pages(ptr, index, info) | |||
1116 | * Keep the cache intact. Notice that the '>' above guarantees that | 1116 | * Keep the cache intact. Notice that the '>' above guarantees that |
1117 | * the pf will always have at least one page afterwards. | 1117 | * the pf will always have at least one page afterwards. |
1118 | */ | 1118 | */ |
1119 | pf->end = pf->page + malloc_cache; | 1119 | pf->end = (char *)pf->page + malloc_cache; |
1120 | pf->size = malloc_cache; | 1120 | pf->size = malloc_cache; |
1121 | 1121 | ||
1122 | brk(pf->end); | 1122 | brk(pf->end); |
@@ -1136,6 +1136,7 @@ free_pages(ptr, index, info) | |||
1136 | * Free a chunk, and possibly the page it's on, if the page becomes empty. | 1136 | * Free a chunk, and possibly the page it's on, if the page becomes empty. |
1137 | */ | 1137 | */ |
1138 | 1138 | ||
1139 | /* ARGSUSED */ | ||
1139 | static __inline void | 1140 | static __inline void |
1140 | free_bytes(ptr, index, info) | 1141 | free_bytes(ptr, index, info) |
1141 | void *ptr; | 1142 | void *ptr; |